;+ ; NAME sqrtfts2gif.pro ; ; PURPOSE Perform square root scaling on images. ; ; SYNTAX sqrtfts2gif, list ; ; OUTPUT Images in GIF format. ; ; HISTORY Andrew L. Stanger HAO/NCAR 6 December 1999 ;- pro sqrtfts2gif, fts_list red = bindgen (256) green = red blue = red fts_name = '' close,1 lct, '/home/stanger/color/bwy5.lut' ; color table. lct, '/home/stanger/color/bwy2.lut' ; color table. lct, '/home/stanger/color/bwy.lut' ; color table. lct, '/home/stanger/color/qualy.lut' ; color table. lct, '/home/stanger/color/qual.lut' ; color table. tvlct, red, green, blue, /get ;--- File list loop. CLOSE, 1 OPENR, 1, fts_list ; Open list file. WHILE (NOT EOF (1)) DO $ BEGIN ;{ ;--- Read FITS image header & pixel data. READF, 1, fts_name ; Get FITS file name. print, 'fts_name: ', fts_name ; READ_GIF, fts_name, fts_img ; Read GIF image. fts_img = readfits (fts_name, hdu) ; Read FITS image. ;--- Extract information from header. ; fts_min = MIN (fts_img, max=fts_max) fts_min = fxpar (hdu, 'DISPMIN') fts_max = fxpar (hdu, 'DISPMAX') img_min = fxpar (hdu, 'DATAMIN') img_max = fxpar (hdu, 'DATAMAX') offset = 5.0E-7 ; Mk3 offset = 1.2E-6 ; Mk4 offset = 1.0E-6 ; Mk4 offset = 0.0E-6 ; Mk4 bwy2.lut offset = 0.5E-6 ; Mk4 qual.lut offset = 0.2E-6 ; Mk4 qual.lut i_min = 0.0 i_max = (img_max - fts_max) / 2.0 + fts_max i_max = fts_max + offset ;--- Compute square root of image. new_img = SQRT (fts_img > 0.0) * 1.5 ; Compute square root. new_img = ((fts_img > 0.0) ^ (0.25)) * 1.5 new_img = ((fts_img > 0.0) ^ (0.25)) ; bwy.lut new_img = ((fts_img > 0.0) ^ (0.40)) ; qual.lut new_img = ((fts_img > 0.0) ^ (0.30)) ; bwy2.lut new_img = ((fts_img > 0.0) ^ (0.25)) ; bwy2.lut new_img = ((fts_img > 0.0) ^ (0.50)) ; qual.lut ; new_min = MIN (new_img, max=new_max) ; Get image min/max. new_min = SQRT (i_min) new_max = SQRT (i_max) new_min = i_min ^ (0.50) new_max = i_max ^ (0.50) print, FORMAT = '("fts_min/max: ", E10.3, E10.3)', fts_min, fts_max print, FORMAT = '("img_min/max: ", E10.3, E10.3)', img_min, img_max print, FORMAT = '("new_min/max: ", E10.3, E10.3)', new_min, new_max ; IF (new_min LT 0.0) THEN $ ; Symmetric about zero. ; IF (-new_min LT new_max) THEN new_min = -new_max ELSE new_max = -new_min ; print, FORMAT = '("new_min/max: ", E10.3, E10.3)', new_min, new_max ; new_min = -5.00e-8 ; new_max = 5.00e-8 ; print, FORMAT = '("new_min/max: ", E10.3, E10.3)', new_min, new_max ;--- Convert to byte pixels. ;--- Display image. byt_img = BYTSCL (new_img, min=new_min, max=new_max, top=255) TV, byt_img ; Display image. ;--- Write newference image to disk. fpos = strpos (fts_name, '.fts') new_name = strmid (fts_name, 0, fpos) + '.sqrt.gif' print, 'Write sqrt image : ', new_name WRITE_GIF, new_name, byt_img, red, green, blue ; Write new image. END ;} CLOSE, 1 END