;+ ; NAME fv.pro ; ; PURPOSE Display a FITS image. ; ; SYNTAX fv, fits_image, /gif, cm='colormap.lut' ; ; fits_image filename of Spartan WLC FITS image. ; gif write displayed image as a GIF file. ; cm pathname of ASCII colormap file. ; Each line has the syntax: index red green blue ; where index = 0, 1, 2, ... 255, ; and red/green/blue are in the range [0:255]. ; wmin display minimum value. ; wmax display maximum value. ; ; EXAMPLES fv, '19981101.1234.mk3.cpb.fts' ; fv, '19981101.1234.mk3.rpb.fts',cm='/home/stanger/color/bwy.lut' ; fv, '19981101.1234.mk3.rpb.fts', /gif ; ; EXTERNAL ; PROCEDURES fitsdisp.pro ; fits_annotate.pro ; ; HISTORY Andrew L. Stanger HAO/NCAR 14 September 2001 ;- PRO fv, fits_name, gif=gif, cm=cm, wmin=wmin, wmax=wmax ;--- Load color map. ;loadct, 3 ; standard RSI color table #3. ;lct, '/home/stanger/color/sunsetcp.lut' ; Load color table. lct, '/home/stanger/color/bwy.lut' ; Load color table. IF (KEYWORD_SET (cm)) THEN lct, cm red = bytarr (256) green = bytarr (256) blue = bytarr (256) tvlct, red, green, blue, /GET ; Fetch RGB color look-up tables. xb = 160 yb = 88 xdim_prev = 0 ydim_prev = 0 dispmin = 0.0 dispmax = 0.0 ;--- Read FITS image header & pixel data. ftspos = STRPOS (fits_name, '.fts') basename = STRMID (fits_name, 0, ftspos) print, 'basename: ', basename img = readfits (fits_name, hdu) ;--- Extract information from header. xdim = fxpar (hdu, 'NAXIS1') ydim = fxpar (hdu, 'NAXIS2') ;--- Resize window [if image size has changed]. if (xdim NE xdim_prev OR ydim NE ydim_prev) THEN $ WINDOW, xsize=xdim+xb, ys=ydim+yb print, 'xdim + xb: ', xdim + xb print, 'ydim + yb: ', ydim + yb xdim_prev = xdim ydim_prev = ydim ;--- Annotate image. fits_annotate, hdu, xdim, ydim, xb, yb ;--- Get information from FITS header. orbit_id = fxpar (hdu, 'ORBIT-ID') image_id = fxpar (hdu, 'IMAGE-ID') telescop = fxpar (hdu, 'TELESCOP') instrume = fxpar (hdu, 'INSTRUME') dateobs = fxpar (hdu, 'DATE-OBS') timeobs = fxpar (hdu, 'TIME-OBS') type_obs = fxpar (hdu, 'TYPE-OBS') dataform = fxpar (hdu, 'DATAFORM') rsun = fxpar (hdu, 'RSUN') srsun = STRING (rsun, FORMAT='(F7.2)') solar_p0 = fxpar (hdu, 'SOLAR_P0') solar_b0 = fxpar (hdu, 'SOLAR_B0') bunit = fxpar (hdu, 'BUNIT') bscale = fxpar (hdu, 'BSCALE') bzero = fxpar (hdu, 'BZERO') datamin = fxpar (hdu, 'DATAMIN') datamax = fxpar (hdu, 'DATAMAX') dispmin = fxpar (hdu, 'DISPMIN', count=countmin) dispmax = fxpar (hdu, 'DISPMAX', count=countmax) print, 'rsun: ', rsun print, 'solar_p0: ', solar_p0 print, 'solar_b0: ', solar_b0 print, 'bscale/bzero: ', bscale, bzero print, 'datamin/datamax: ', datamin, datamax print, 'dispmin/dispmax: ', dispmin, dispmax ; telescop = STRTRIM (telescop, 2) ; IF (telescop NE 'SPARTAN 201' AND instrume NE 'WLC') THEN $ ; BEGIN ; PRINT, 'TELESCOP: ', telescop, ' should be "SPARTAN 201".' ; PRINT, 'INSTRUME: ', instrume, ' should be "WLC".' ; RETURN ; END imin = MIN (img, max=imax) print, 'imin/imax: ', imin, imax ;--- Display image. dmin = dispmin dmax = dispmax ; IF (KEYWORD_SET (wmin) OR wmin EQ 0.0) THEN dmin = wmin IF (KEYWORD_SET (wmin)) THEN dmin = wmin IF (KEYWORD_SET (wmax)) THEN dmax = wmax print, 'dmin/dmax: ', dmin, dmax ; TV, BYTSCL (img, min=dispmin, max=dispmax, top=249), xb, yb fitsdisp, fits_name, xdim_prev, ydim_prev, gif=gif, wmin=dmin, wmax=dmax ;--- Write displayed image as a GIF file (if "gif" keyword is set). IF (KEYWORD_SET (gif)) THEN $ BEGIN gif_file = basename + '.gif' img_gif = TVRD () WRITE_GIF, gif_file, img_gif, red, green, blue END END