Where the noperec number should be the size of the first axis of the image.% ndf2unf in=imagein out=fileout noperec=339
You can then read the created file using an IDL batch file similar to:
; Supply the name of the image and its dimensions. FNAME='fileout' SD1=339 SD2=244 ; Set up the main array and temporary array ; use NOZERO option to avoid initialisation IMAGE=INTARR(SD1,SD2,/NOZERO) TEMP= INTARR(SD1, /NOZERO) ; Display what is going on. PRINT, "Converting file: ", FNAME ; Open the file generated by NDF2UNF for read access only. OPENR, UNIT, fname, /GET_LUN, /F77_UNFORMATTED ; Read the image one record at a time. FOR I=0,SD2-1 DO BEGIN READU, UNIT, TEMP & $ ; Transfer each line into the main image array. FOR J=0,SD1-1 DO BEGIN IMAGE(J,I)=TEMP(J) & $ ENDFOR & ENDFOR ; Close the opened file unit. CLOSE, 1 ; Scale the image for display. IMAGE=CONGRID(IMAGE,SD1,SD2,/INTERP) WINDOW, 0,XSIZE=SD1,YSIZE=SD2 ; Display the image. TVSCL, IMAGE
The image is then contained in the integer array IMAGE and may be manipulated by IDL. This would allow such operations as storing it as a UNIX unformatted file where the image might subsequently be read in from disc in one go.
It should be remembered that the data type of the F77 unformatted file created by NDF2UNF may differ depending on the type of data stored in the original NDF. If this is the case you might need to change the type definition of the arrays image and temp to reflect this. The data type used within each component of an NDF may be determined using NDFTRACE.
CONVERT A Format-conversion Package