;+ ; NAME: ; RemoteView_Display2D ; PURPOSE: ; Calculates a line-of-sight integration throught the 3D volume data in ; FOVCube. ; CATEGORY: ; RemoteView project ; CALLING SEQUENCE: PRO RemoteView_Display2D, D3D, FOVInfo, FOVCube, FOVLoc, iView, $ voxel = Voxel , $ f3dfnc = f3dfnc , $ base_dir = base_dir , $ base_name = base_name , $ images = images , $ title = title , $ format = format , $ logo = logo , $ rim = rim , $ silent = silent , $ range = range , $ view_nr = view_nr , $ radialfilter= radialfilter, $ _extra = _extra ; INPUTS: ; D3D array[1]; type: structure ; contains information about volume data (see ; href=RemoteView_Init=) ; FOVCube array[nX,nY,nZ]; type: float ; function values covering fov of nX,nY lines of sight ; at nZ positions along line of sight ; FOVLoc array[3,nX,nY,nZ]; type: float ; heliographic locations at all of the line of sight ; segments. Always in spherical coordinates (even for ; rectangular matrix) i.e. heliographic longitude, ; latitude in radians; and heliocentric distance in AU. ; iView scalar; type: integer ; image number (used only in file name construction) ; OPTIONAL INPUT PARAMETERS: ; base_dir=base_dir ; scalar; type: string; default: getenv('TUB') ; destination directory for all image files ; base_name-base_name ; scalar; type: string; default: f3dfnc ; base name for output image files ; view_nr=view_nr scalar; type: integer; default: none ; overrides argument 'iView' ; iView is the loop parameter used in the calling ; procedure href=remoteview= to loop over multiple ; view. Often remoteview itself is called in a loop ; processing a single view per call. iView will ; always be 1 in this case, and image files would ; be overwritten. Keyword view_nr can be added to ; the remoteview call to replace iView and avoid ; overwriting of images. ; OUTPUTS: ; (images to display or file) ; images=images scalar or array; type: string ; fully-qualified names of all image files created ; (if no image was created, 'images' will be undefined) ; INCLUDE: @compile_opt.pro ; On error, return to caller @vu_fnc_include.pro ; ; EXTERNAL: ; ThomsonBrightness ; CALLS: ; twin, destroyvar, boost, BadValue, TimeGet, TimeUnit ; ThomsonRadialFilter, IntegrateLOS, ThomsonUBVConst, bin_write ; CheckDir, SuperArray, InitVar ; COMMON BLOCKS: common SkyDisplaySave, PreviousImage ; PROCEDURE: ; MODIFICATION HISTORY: ; JUN-2001, Paul Hick (UCSD/CASS) ; SEP-2008, Paul Hick (UCSD/CASS; pphick@ucsd.edu) ; Added legend. Modified labeling. ;- InitVar, range, [0.1,1.0] breakval = gridgen(255,range=range) InitVar, silent, 0 InitVar, f3dfnc, 'ThomsonBrightness' InitVar, view_nr, iView stereo = FOVInfo.view_stereo left = stereo AND (view_nr mod 2) nDim = size(FOVCube, /dim) elo_sun = SuperArray(*FOVInfo.view_elo, nDim[2], /trail) elo_earth = atan(FOVloc[2,*,*,*]*sin(elo_sun), FOVInfo.view_loc[2]-FOVloc[2,*,*,*]*cos(elo_sun)) elo_earth = reform(elo_earth, /overwrite) IF silent LE 0 THEN message, /info, f3dfnc CASE f3dfnc OF 'ThomsonBrightness': BEGIN dRR = (FOVinfo.view_extent[1]-FOVinfo.view_extent[0])/(nDim[2]-1) f3darg = [dRR,ThomsonUBVConst(3),0] title = vu_fnc(vu_los_thomson_b,/los,/name) + $ ' ('+vu_fnc(vu_los_thomson_b,/los,/unit)+')' END ELSE: ENDCASE zpix = IntegrateLOS(FOVloc, FOVCube, $ f3dfnc = f3dfnc , $ f3darg = f3darg , $ elo_earth = elo_earth , $ elo_sun = elo_sun , $ minRR = minRR , $ silent = silent ) CASE f3dfnc OF 'ThomsonBrightness': BEGIN InitVar, radialfilter, ThomsonRadialFilter(elo_sun) zpix /= radialfilter END ELSE : ENDCASE zmin = range[0];min(zpix) zmax = range[1];max(zpix) nearsun = where(elo_sun LT 1.0/!radeg) IF nearsun[0] NE -1 THEN zpix[nearsun] = BadValue(zpix) ; Orbit display (read from Z-buffer) orbs = tvrd() orbs_pix = where(orbs NE !p.background) orbs = tvrd() tmp = orbs orbs = SuperArray(orbs,3,/trail) tvlct,/get,r,g,b orbs[*,*,0] = r[tmp] orbs[*,*,1] = g[tmp] orbs[*,*,2] = b[tmp] zpix = congrid(zpix,D3D.xysize[0],D3D.xysize[1]) zpix = GetColors(zpix, breakval) tmp = zpix zpix = SuperArray(zpix,3,/trail) loadct, 3 tvlct,/get,r,g,b rgbo = [[r],[g],[b]] ; Needed for color legend zpix[*,*,0] = r[tmp] zpix[*,*,1] = g[tmp] zpix[*,*,2] = b[tmp] zpix = reform(zpix,1L*D3D.xysize[0]*D3D.xysize[1],3,/overwrite) orbs = reform(orbs,1L*D3D.xysize[0]*D3D.xysize[1],3,/overwrite) FOR i=0,2 DO zpix[orbs_pix,i] = orbs[orbs_pix,i] zpix = reform(zpix,D3D.xysize[0],D3D.xysize[1],3,/overwrite) InitVar, rim, [0.0,0.12,0.1,0.1] IF voxel GT 0 AND total(rim) NE 0 THEN BEGIN rim = round([ rim[0:1]*D3D.xysize[0],rim[2:3]*D3D.xysize[1]]) xysize = D3D.xysize+[rim[0]+rim[1],rim[2]+rim[3]] bar = [round(0.5*rim[1]),D3D.xysize[1]] ; Set up the text labeling around the actual image set_plot,'Z' device, z_buffering=0, set_resolution=xysize reset_colors erase, !p.background xyouts, 0.02, 0.95, /normal, TimeGet(FOVInfo.view_time, /ymd, upto=TimeUnit(/min)), _extra=_extra IF IsType(title, /defined) THEN xyouts, 0.80, 0.02, /normal, title, align=1, _extra=_extra IF format EQ '' THEN format = '(F10.2)' InitVar, format, '(F10.2)' xyouts, 0.98, 0.02, /normal, string(zmin,format=format), align=1, _extra=_extra xyouts, 0.98, 0.95, /normal, string(zmax,format=format), align=1, _extra=_extra tmp = zpix zpix = SuperArray(tvrd(),3,/trail) ; Insert skymap zpix[rim[0]:rim[0]+D3D.xysize[0]-1,rim[2]:rim[2]+D3D.xysize[1]-1,*] = tmp ; Insert logo IF IsType(logo, /string) THEN BEGIN IF img_read(logo, logo_img, truedim=3, /silent) THEN BEGIN tmp = size(logo_img, /dim) zpix[0:tmp[0]-1,0:tmp[1]-1,*] = logo_img ENDIF ENDIF ; Insert color bar tmp = rgbo tmp = congrid(tmp,bar[1],3) tmp = byte(round(tmp)) tmp = SuperArray(tmp,bar[0],/lead) zpix[xysize[0]-bar[0]:*,rim[2]:rim[2]+bar[1]-1,*] = tmp ENDIF IF D3D.Interleave THEN BEGIN CASE left OF 0: BEGIN PreviousImage = zpix RETURN END 1: BEGIN OddRows = 1+2*indgen(D3D.xysize[1]/2) zpix[*,OddRows] = PreviousImage[*,OddRows] END ENDCASE ENDIF ; The 24-bit Tiff file contains the full 24-bit true color image ; The reduction to an 8-bit pseudo-image is done by COLOR_QUAN. The resulting ; image often has 'dirty' pixels with the wrong colors. to_base = IsType(base_dir, /defined) IF to_base THEN to_base = CheckDir(base_dir) IF NOT to_base THEN base_dir = getenv('TUB') InitVar, base_name, f3dfnc file = filepath(root=base_dir,base_name+string(format='(I3.3)',view_nr)) IF (1B-D3D.Interleave)*stereo THEN file += (['r','l'])[left] file = filepath(root=base_dir,base_name+string(format='(I3.3)',view_nr)) IF (1B-D3D.Interleave)*stereo THEN file += (['r','l'])[left] set_plot, !TheTerminal reset_colors destroyvar, images IF D3D.Bmp8 THEN BEGIN tmp_file = file+'.bmp' boost, images, tmp_file write_bmp, tmp_file, color_quan(zpix,3,r,g,b), r,g,b IF silent LE 0 THEN message, /info, 'created '+tmp_file ENDIF IF D3D.Bmp24 THEN BEGIN tmp_file = file+'.bmp' boost, images, tmp_file write_bmp, tmp_file, reverse( transpose(zpix, [2,0,1]) ,1) IF silent LE 0 THEN message, /info, 'created '+tmp_file ENDIF IF D3D.Tiff24 THEN BEGIN ; Writing true-color (24-bit) Tiff-file tmp_file = file+'.tif' boost, images, tmp_file ;write_tiff, tmp_file, red=reverse(zpix[*,*,0],2), gr=reverse(zpix[*,*,1],2), bl=reverse(zpix[*,*,2],2), planarconfig=2 write_tiff, tmp_file, red=zpix[*,*,0], gr=zpix[*,*,1], bl=zpix[*,*,2], planarconfig=2 IF silent LE 0 THEN message, /info, 'created '+tmp_file ENDIF IF D3D.Tiff8 THEN BEGIN ; Writing pseudo-color (8-bit) Tiff-file tmp_file = file+'.tif' boost, images, tmp_file write_tiff, tmp_file, reverse( color_quan(zpix,3,r,g,b) ,2), red=r, gr=g, bl=b IF silent LE 0 THEN message, /info, 'created '+tmp_file ENDIF IF D3D.PNG THEN BEGIN tmp_file = file+'.png' boost, images, tmp_file write_png, tmp_file, transpose(zpix, [2,0,1]) IF silent LE 0 THEN message, /info, 'created '+tmp_file ENDIF IF D3D.Gif THEN BEGIN tmp_file = file+'.gif' boost, images, tmp_file write_gif, tmp_file, color_quan(zpix,3,r,g,b), r, g, b IF silent LE 0 THEN message, /info, 'created '+tmp_file ENDIF IF D3D.PPM THEN BEGIN tmp_file = file+'.ppm' boost, images, tmp_file write_ppm, tmp_file, zpix IF silent LE 0 THEN message, /info, 'created '+tmp_file ENDIF IF D3D.JPG THEN BEGIN tmp_file = file+'.jpg' boost, images, tmp_file write_jpeg, tmp_file, zpix, true=3 IF silent LE 0 THEN message, /info, 'created '+tmp_file ENDIF IF D3D.Display THEN BEGIN npix = size(zpix, /dim) twin, /show, xsize=npix[0], ysize=npix[1], /nocoordinates, $ ;twin, /show, xsize=D3D.xysize[0], ysize=D3D.xysize[1], /nocoordinates, $ tr =(1B-stereo) or D3D.Interleave, $ br =(1B-D3D.Interleave)*stereo*(1B-left), $ bl =(1B-D3D.Interleave)*stereo*left ;IF size(zpix, /n_dim) EQ 3 AND !d.n_colors EQ 2L^24 THEN BEGIN ; True-color display IF size(zpix, /n_dim) EQ 3 AND !d.n_colors GT 256 THEN BEGIN ; True-color display loadct, 0 ; Why am I doing this??? tv, zpix, true=(where(npix EQ 3))[0]+1 ENDIF ELSE BEGIN ; Convert to 8-bit image for pseudo-display true = size(zpix, /n_dim) EQ 3 IF true THEN zpix = color_quan(zpix,3,r,g,b) tv, zpix IF true THEN tvlct, r,g,b ENDELSE ENDIF RETURN & END