next up previous 399
Next: Specifications of CONVERT IDL Procedures
Up: Other Methods
Previous: A faster route (but a little more complicated)

Using the IDL Astronomy Users' Library

If this all seems a bit tedious, then those of you with with the IDL Astronomy Users' Library installed on your machines might choose to take advantage of its FITS conversion procedures to make life easier still. Users wishing to obtain a copy of the library can find it at http://idlastro.gsfc.nasa.gov/homepage.html.

The library contains IDL procedures from a number of sources that allow FITS format files to be read into IDL data structures. The routine chosen for the example below was FXREAD which may be found in the /pro/bintable sub-directory. It is part of a comprehensive suite of FITS conversion programs that seems particularly easy to use.

So if you first convert your NDF into a FITS file using NDF2FITS like this:

% ndf2fits in=m42 out=m42.fit comp=d
you can then use the following code from within IDL to place the image into an IDL structure and display it.

; Read the FITS file
fxread, 'm42.fit', DATA, HEADER

; Determine the size of the image
SIZEX=fxpar(header, 'NAXIS1')
SIZEY=fxpar(header, 'NAXIS2')

; Find the data type being read
DTYPE=fxpar(header, 'BITPIX')

; Scale the image for display
IMAGE=congrid(DATA,SIZEX,SIZEY,/INTERP)
window, 0,xsize=SIZEX,ysize=SIZEY

; Display the image
TVSCL, IMAGE
As can be seen above, various values contained within the FITS header of the original can be obtained using the FXPAR procedure.

You should bear in mind that a number of other procedures (such as IEEE_TO_HOST and GET_DATE) from the Astronomy Users' Library are also needed by IDL when compiling this code. Consequently it is essential that the whole library should be obtained from the archive.



next up previous 399
Next: Specifications of CONVERT IDL Procedures
Up: Other Methods
Previous: A faster route (but a little more complicated)

CONVERT A Format-conversion Package
Starlink User Note 55
Malcolm J. Currie
G.J.Privett
A.J.Chipperfield
D.S.Berry
A.C.Davenhall
2010 February 2
E-mail:ussc@star.rl.ac.uk

Copyright © 2005 Council for the Central Laboratory of the Research Councils