;read in raw data (rho.skw) image
dimage=READ_SKW(PICKFILE(FILTER='*.skw')) ; read raw data
(skw) file
; display image in display image space
tv,dimage
END
IDL procedure code to read raw data (*.SKW) images
FUNCTION READ_SKW, file_name
; read in SKW image and return image as an array of floats in the range of 0 to 255
OPENR, rho, file_name, /get_lun ; open file as 'rho'
file_stats = FSTAT(rho) ; get file info
width = ((2)^(FIX( ALOG( SQRT( file_stats.SIZE / 2 ) )/
ALOG(2) )))
; determine image size
temp = intarr(width,width) ; create a 256x256 integer array
'temp'
readu, rho, temp ; read 'rho' into array 'temp'
;IF Mac and Unix architecture:
;
; simage=swap_endian(temp) ; swap endian of 'temp' into SKW image
space:
;ELSE (for intel architecture)
simage=temp ; don't swap endian... just re-assign variable
to
; different name.
;END architecture specific code.
; 0=black;4095=white
close, rho ; close 'rho'
free_lun, rho ; deallocate 'rho'
dimage = FLOAT(simage)/16 ; convert SKW image space to display
image
; space: 0=black;255=white
RETURN, dimage
END