;+ ; NAME fitsdisp.pro ; ; PURPOSE Display a FITS image. ; ; SYNTAX fitsdisp, img, hdu ; ; EXAMPLE fitsdisp, img, hdu ; fitsdisp, img, hdu, /gif ; ; EXTERNAL ; PROCEDURES fits_annotate.pro ; ; HISTORY Andrew L. Stanger HAO/NCAR 14 September 2001 ;- PRO fitsdisp, fits_name, xdim_prev, ydim_prev, gif=gif, wmin=wmin, wmax=wmax xb = 160 ; X-axis border for annotation. yb = 88 ; Y-axis border for annotation. 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') ;--- "Erase" left annotation area. leftborder = BYTARR (xb, ydim + yb) leftborder [*, *] = 0 TV, leftborder ;--- Resize window if it 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, wmin=wmin, wmax=wmax ;--- 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)') bunit = fxpar (hdu, 'BUNIT') datamin = fxpar (hdu, 'DATAMIN') datamax = fxpar (hdu, 'DATAMAX') dispmin = fxpar (hdu, 'DISPMIN') dispmax = fxpar (hdu, '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 ;--- 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 TV, BYTSCL (img, min=dmin, max=dmax, top=249), xb, yb ;--- 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 ENDIF ;} RETURN END