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:
you can then use the following code from within IDL to place the image into an IDL structure and display it.% ndf2fits in=m42 out=m42.fit comp=d
As can be seen above, various values contained within the FITS header of the original can be obtained using the FXPAR procedure.; 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
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.
CONVERT A Format-conversion Package