PRO dt_event,event ;{ @dt_com CASE event.id OF ;--------------------------------------------------------------------------- ; This section allows user to type in path where datafiles are and then ; changes the working directory to that path ;--------------------------------------------------------------------------- path_bx1:BEGIN ;{ WIDGET_CONTROL,path_bx1,GET_VALUE=newpath WIDGET_CONTROL,/HOURGLASS newpath=newpath(0) len=STRLEN(newpath)-1 IF (STRPOS(newpath, '/',len) NE -1) THEN $ newpath=STRMID(newpath,0,len) test=chk_dir(newpath) IF (test EQ 1) THEN BEGIN CD,newpath filelist1=file_list(newpath,fltr,/CD) filelist1=strip_dirname(filelist1) path1=newpath+'/' WIDGET_CONTROL,files1,SET_VALUE=filelist1 ENDIF END ;} ;--------------------------------------------------------------------------- ; Read all files located in path_bx1 that have the appropriate filetypes ; specified by the filters and prints them in the files box for selection ;--------------------------------------------------------------------------- files1:BEGIN ;{ WIDGET_CONTROL,img1,GET_VALUE=img1_Id WIDGET_CONTROL,path_bx1,GET_VALUE=path WIDGET_CONTROL,mult_sld1,GET_VALUE=mult path=path(0) IF (STRMID(path,STRLEN(path)-1,1) NE '/') THEN path=path+'/' WSET,img1_id WIDGET_CONTROL,/HOURGLASS file=path+filelist1(event.index) CATCH,file_err IF (file_err NE 0) THEN BEGIN junk=WIDGET_MESSAGE(!ERR_STRING,/ERROR,TITLE='BUMMER') RETURN ENDIF IF (STRMID(file,STRLEN(file)-3,3) EQ 'gif') THEN BEGIN READ_GIF,file,image1 hdu1='' ENDIF $ ELSE image1=readfits(file,hdu1) image1(*,0)=0 image1(*,2)=0 sz=SIZE(image1) scope=fxpar(hdu1,'TELESCOP') scope_err=!err instr=fxpar(hdu1,'INSTRUME') instr_err=!err IF (instr_err NE -1) THEN BEGIN ;IF (instr EQ 'LASCO ') THEN hdu1=it_lasco(hdu1) ;IF (instr EQ 'LASCO ') THEN image1=SQRT(image1) IF (instr EQ 'EIT') THEN it_eit_wavelngth,hdu1,1 IF (instr EQ 'EIT ') THEN it_eit_wavelngth,hdu1,1 IF (instr EQ 'EIT') THEN image1=ALOG10(image1) ;This scaling works better IF (instr EQ 'EIT ') THEN image1=ALOG10(image1) ENDIF IF (scope_err EQ -1) THEN BEGIN fxaddpar,hdu1,'TELESCOP','YOHKOH' IF (sz(1) EQ 256) THEN image1=it_yoh512(image1,hdu1) IF (fxpar(hdu1,'RADIUS') LT 190) THEN BEGIN image1=image1(0:255,0:255) image1=it_yoh512(image1,hdu1) ENDIF mx=MAX(image1) ENDIF ELSE mx=it_getmax(image1,mult) mn=fxpar(hdu1,'DATAMIN') IF (fxpar(hdu1,'TELESCOP') EQ 'DPM ') THEN BEGIN pangle=fxpar(hdu1,'SOLAR_P0') if (fxpar(hdu1,'CROTA1') NE 0.0) THEN $ image1=ROT(image1,pangle) fxaddpar,hdu1,'CROTA1',0.0 rad=it_getrad(hdu1) image1=it_disk(image1,hdu1,radius=rad*2.5) mx=it_getmax(image1,mult) IF (image1(0,0) EQ -1) THEN RETURN ENDIF IF (fxpar(hdu1,'TELESCOP') EQ 'MLSO DIGITAL PROMINENCE MONITOR') THEN BEGIN pangle=fxpar(hdu1,'SOLAR_P0') if (fxpar(hdu1,'CROTA1') NE 0.0) THEN $ image1=ROT(image1,pangle) fxaddpar,hdu1,'CROTA1',0.0 rad=it_getrad(hdu1) image1=it_disk(image1,hdu1,radius=rad*2.5) mx=it_getmax(image1,mult) IF (image1(0,0) EQ -1) THEN RETURN ENDIF IF (fxpar(hdu1,'TELESCOP') EQ 'MK3 ') THEN mx=MAX(image1) IF (fxpar(hdu1,'TELESCOP') EQ 'H-ALPHA ') THEN mx=MAX(image1) IF (fxpar(hdu1,'TELESCOP') EQ 'Mk4') THEN BEGIN mx=700 mn=-200 ENDIF IF (instr_err NE -1) THEN BEGIN sub=fxpar(hdu1,'SUBT') subt_err=!err IF (subt_err NE -1) THEN BEGIN mx=255 mn=0 ENDIF ENDIF BSCALE,image1,MIN=mn,MAX=mx,/COMBINED,/LOWER IF (sz(1) LE 512) THEN $ WIDGET_CONTROL,img1,SET_DRAW_VIEW=[0,0] tv,image1 WIDGET_CONTROL,sld_min1,SET_SLIDER_MIN=MIN(image1) WIDGET_CONTROL,sld_min1,SET_VALUE=MIN(image1) WIDGET_CONTROL,sld_max1,SET_SLIDER_MAX=MAX(image1) WIDGET_CONTROL,sld_max1,SET_VALUE=MAX(image1) WIDGET_CONTROL,img1,SET_UVALUE=image1 base1=image1 END ;} ;--------------------------------------------------------------------------- ; There is a file in the same direcotry as dt.pro that contains all of ; the .lut filenames needed for this program (color_tables.txt). This ; section reads that file and displays the filenames in the colortable box ; for selection by the user. The color table is read in and then shoved into ; the lower half of a 255 level table by the ssw routine combine_colors. ;--------------------------------------------------------------------------- col_table1:BEGIN ;{ temp=INTARR(4,256) WIDGET_CONTROL,/HOURGLASS openr,11,'/home/tdarnell/idl/image_tools/'+tables(event.index) readf,11,temp close,11 _r = temp(1,*) _g = temp(2,*) _b = temp(3,*) tvlct,_r,_g,_b combine_colors,/LOWER END ;} ;--------------------------------------------------------------------------- ; Performs the same function as that of path_box1 ;--------------------------------------------------------------------------- path_bx2:BEGIN ;{ WIDGET_CONTROL,path_bx2,GET_VALUE=newpath WIDGET_CONTROL,/HOURGLASS newpath=newpath(0) len=STRLEN(newpath)-1 IF (STRPOS(newpath,'/',len) NE -1) THEN $ newpath=STRMID(newpath,0,len) test=chk_dir(newpath) IF (test EQ 1) THEN BEGIN CD,newpath filelist2=file_list(newpath,fltr,/CD) filelist2=strip_dirname(filelist2) path2=newpath+'/' WIDGET_CONTROL,files2,SET_VALUE=filelist2 ENDIF END ;} ;--------------------------------------------------------------------------- ; Same as files1 ;--------------------------------------------------------------------------- files2:BEGIN ;{ WIDGET_CONTROL,img2,GET_VALUE=img1_Id WIDGET_CONTROL,path_bx2,GET_VALUE=path WIDGET_CONTROL,mult_sld2,GET_VALUE=mult path=path(0) IF (STRMID(path,STRLEN(path)-1,1) NE '/') THEN path=path+'/' WSET,img1_Id WIDGET_CONTROL,/HOURGLASS file=path+filelist2(event.index) CATCH,file_err IF (file_err NE 0) THEN BEGIN junk=WIDGET_MESSAGE(!ERR_STRING,/ERROR,TITLE='BUMMER') RETURN ENDIF IF (STRMID(file,STRLEN(file)-3,3) EQ 'gif') THEN BEGIN READ_GIF,file,image2 hdu2='' ENDIF $ ELSE image2=readfits(file,hdu2) sz=SIZE(image2) scope=fxpar(hdu2,'TELESCOP') scope_err=!err instr=fxpar(hdu2,'INSTRUME') instr_err=!err IF (instr_err NE -1) THEN BEGIN ;IF (instr EQ 'LASCO ') THEN hdu2=it_lasco(hdu2) ;IF (instr EQ 'LASCO ') THEN image2=SQRT(image2) IF (instr EQ 'EIT') THEN it_eit_wavelngth,hdu2,2 IF (instr EQ 'EIT ') THEN it_eit_wavelngth,hdu2,2 IF (instr EQ 'EIT') THEN image2=ALOG10(image2) IF (instr EQ 'EIT ') THEN image2=ALOG10(image2) ENDIF IF (scope_err EQ -1) THEN BEGIN fxaddpar,hdu2,'TELESCOP','YOHKOH' IF (sz(1) EQ 256) THEN image2=it_yoh512(image2,hdu2) IF (fxpar(hdu2,'RADIUS') LT 190) THEN BEGIN image2=image2(0:255,0:255) image2=it_yoh512(image2,hdu2) ENDIF mx=MAX(image2) ENDIF ELSE mx=it_getmax(image2,mult) mn=fxpar(hdu2,'DATAMIN') ;mn=MIN(image2) IF (fxpar(hdu2,'TELESCOP') EQ 'DPM ') THEN BEGIN pangle=fxpar(hdu2,'SOLAR_P0') if (fxpar(hdu2,'CROTA1') NE 0.0) THEN $ image2=ROT(image2,pangle) fxaddpar,hdu2,'CROTA1',0.0 rad=it_getrad(hdu2) image2=it_disk(image2,hdu2,radius=rad*2.5) IF (image2(0,0) EQ -1) THEN RETURN ENDIF IF (fxpar(hdu2,'TELESCOP') EQ 'MLSO DIGITAL PROMINENCE MONITOR') THEN BEGIN rad=it_getrad(hdu2) image2=it_disk(image2,hdu2,radius=rad*2.5) IF(image2(0,0) EQ -1) THEN RETURN ENDIF IF (fxpar(hdu2,'TELESCOP') EQ 'MK3 ') THEN mx=MAX(image2) IF (fxpar(hdu2,'TELESCOP') EQ 'H-ALPHA ') THEN mx=MAX(image2) IF (fxpar(hdu2,'TELESCOP') EQ 'Mk4') THEN BEGIN mx=400 mn=-100 ENDIF IF (instr_err NE -1) THEN BEGIN sub=fxpar(hdu2,'SUBT') subt_err=!err IF (subt_err NE -1) THEN BEGIN mx=255 mn=0 ENDIF ENDIF BSCALE,image2,MIN=mn,MAX=mx,/COMBINED IF (sz(1) LE 512) THEN $ WIDGET_CONTROL,img2,SET_DRAW_VIEW=[0,0] tv,image2 WIDGET_CONTROL,sld_min2,SET_SLIDER_MIN=128 WIDGET_CONTROL,sld_min2,SET_SLIDER_MAX=MAX(image2) WIDGET_CONTROL,sld_min2,SET_VALUE=MIN(image2) WIDGET_CONTROL,sld_max2,SET_SLIDER_MAX=MAX(image2) WIDGET_CONTROL,sld_max2,SET_VALUE=MAX(image2) WIDGET_CONTROL,img2,SET_UVALUE=image2 base2=image2 END ;} ;--------------------------------------------------------------------------- ; Same as col_table1 except that all of the colors are put in the upper ; half of a 256 level table using combine_colors. ;--------------------------------------------------------------------------- col_table2:BEGIN ;{ temp=INTARR(4,256) WIDGET_CONTROL,/HOURGLASS openr,11,'/home/tdarnell/idl/image_tools/'+tables(event.index) readf,11,temp close,11 _r = temp(1,*) _g = temp(2,*) _b = temp(3,*) tvlct,_r,_g,_b combine_colors END ;} img1:BEGIN ;{ IF (event.press EQ 1) THEN go=1 IF (event.press EQ 4) THEN go=0 IF (event.type EQ 2) AND (go EQ 1) THEN BEGIN ;{ x=event.x y=event.y sz=SIZE(image1) IF (x LE 10) THEN x=10 IF (y LE 10) THEN y=10 IF (x GE sz(1)-11) THEN x=sz(1)-11 IF (y GE sz(2)-11) THEN y=sz(2)-11 image1(x-10:x+10,y-10:y+10)=0 ENDIF ;} IF (event.press EQ 2) THEN BEGIN ;{ WIDGET_CONTROL,/HOURGLASS WIDGET_CONTROL,img1,GET_VALUE=img1_Id WSET, img1_Id BSCALE,image1,/COMBINED,/LOWER tv,image1 base1=image1 ENDIF ;} END ;} img2:BEGIN ;{ IF (event.press EQ 1) THEN go=1 IF (event.press EQ 4) THEN go=0 IF (event.type EQ 2) AND (go EQ 1) THEN BEGIN ;{ x=event.x y=event.y sz=SIZE(image2) IF (x LE 10) THEN x=10 IF (y LE 10) THEN y=10 IF (x GE sz(1)-11) THEN x=sz(1)-11 IF (y GE sz(2)-11) THEN y=sz(2)-11 image2(x-10:x+10,y-10:y+10)=0 ENDIF ;} IF (event.press EQ 2) THEN BEGIN ;{ WIDGET_CONTROL,/HOURGLASS WIDGET_CONTROL,img2,GET_VALUE=img2_Id WSET, img2_Id BSCALE,image2,/COMBINED tv,image2 base2=image2 ENDIF ;} END ;} ;--------------------------------------------------------------------------- ; This handles all of the button function located at the bottom of the main ; program window. There are two groups of buttons, btns1 and btns2, each ; are attached to the columns that the main images are attached to (image1 & ; image2). Most of them are self-explanatory except for a few each of which ; will have some annotation to explain them. ;--------------------------------------------------------------------------- btns1:BEGIN ;{ CASE event.value OF 'QUIT':BEGIN ;{ WIDGET_CONTROL,event.top,/DESTROY END ;} 'CTOOL':BEGIN ;{ ctool END ;} 'SMOOTH1':BEGIN ;{ WIDGET_CONTROL,/HOURGLASS WIDGET_CONTROL,img1,GET_VALUE=img1_Id WSET,img1_Id image1=SMOOTH(image1,3) BSCALE,image1,/COMBINED,/LOWER TV,image1 base1=image1 END ;} ;--------------------------------------------------------------------------- ; This button stores whatever composite image has been made with the 1 -> 2 ; or the 1 <- 2 buttons into a buffer for later recall. There are 2 buffers ; buff1 and buff2 which a user can store a composite in. ;--------------------------------------------------------------------------- 'STORE1':BEGIN ;{ WIDGET_CONTROL,/HOURGLASS image1=final_img buff_flag=1 print,'Buff_flag: ',buff_flag sz=SIZE(image1) fxaddpar,hdu1,'CRPIX1',sz(1)/2 fxaddpar,hdu1,'CRPIX2',sz(2)/2 hdu3=hdu2 base1=image1 WIDGET_CONTROL,img1,GET_VALUE=img1_Id TVLCT,r,g,b,/GET combine_colors,/LOWER,/DISABLE WSET,img1_Id BSCALE,image1,/COMBINED,/LOWER TV,image1 WIDGET_CONTROL,img1,SET_UVALUE=image1 base1=image1 END ;} 'RESIZE':BEGIN ;{ xinput,newrad,'Enter new radius (pixels):',/ACCEPT_ENTER WIDGET_CONTROL,/HOURGLASS image1=it_resize(image1,hdu1,float(newrad)) WIDGET_CONTROL,img1,GET_VALUE=img1_Id WSET,img1_Id BSCALE,image1,/COMBINED,/LOWER TV,image1 WIDGET_CONTROL,img1,SET_UVALUE=image1 base1=image1 fxaddpar,hdu1,'CRRADIUS',float(newrad) END ;} ;--------------------------------------------------------------------------- ; Compose image1 onto image2. Image1 is scaled to the same size as image2 ; in pixels/solar radius, centers both images, crops yohkoh or eit images at ; the limb if there is dpm data or at 1.2 times radius if there is no dpm ; data. This section does a lot of stuff and most of it can be confusing. ; The steps for compositing are: ; 1. Check for existence of dpmon data. ; 2. Check for yohkoh or soho data ; 3. If dpmon and if yohkoh or soho, crop yohkoh or soho at limb using ; it_disk. ; 4. Center both images into a larger, square array for easier addition. ; This uses it_center, which gets centering info from .fits header. ; 5. Scale image1 to same pixel/solar radius as image2 using it_scale.pro ; 6. Add the images together using it_add.pro. The method of addition ; depends on data type. If there is prominence data, put the prominence ; in and cut out mkIII where prominence is. If there is no dpm, then ; place yohkoh or soho in place of mkIII out to 1.2 times solar radius. ; Looking at the image output better explains this. ;--------------------------------------------------------------------------- '1 -> 2':BEGIN ;{ WIDGET_CONTROL,/HOURGLASS xc1=fxpar(hdu1,'CRPIX1') IF (xc1 LT 0) THEN BEGIN cen_err=WIDGET_MESSAGE('Image center info in image 1 is invalid', $ /ERROR,TITLE='Bummer') RETURN ENDIF yc1=fxpar(hdu1,'CRPIX2') IF (yc1 LT 0) THEN BEGIN cen_err=WIDGET_MESSAGE('Image center info in image 1 is invalid', $ /ERROR,TITLE='Bummer') RETURN ENDIF xc2=fxpar(hdu2,'CRPIX1') IF (xc2 LT 0) THEN BEGIN cen_err=WIDGET_MESSAGE('Image center info in image 2 is invalid', $ /ERROR,TITLE='Bummer') RETURN ENDIF yc2=fxpar(hdu2,'CRPIX2') IF (yc1 LT 0) THEN BEGIN cen_err=WIDGET_MESSAGE('Image center info in image 2 is invalid', $ /ERROR,TITLE='Bummer') RETURN ENDIF radius1=it_getrad(hdu1) radius2=it_getrad(hdu2) IF (buff_flag NE 1) THEN BEGIN ;{ print,'Going to it_disk...' print,'buff_flag: ',buff_flag IF (fxpar(hdu1,'TELESCOP') EQ 'YOHKOH ') THEN $ image1=it_disk(image1,hdu1,radius=radius1*1.2) IF (fxpar(hdu1,'TELESCOP') EQ 'SOHO') THEN $ IF (fxpar(hdu1,'INSTRUME') EQ 'EIT') THEN $ image1=it_disk(image1,hdu1,radius=radius1*1.2) IF (fxpar(hdu2,'TELESCOP') EQ 'YOHKOH ') THEN $ image2=it_disk(image2,hdu2,radius=radius2*1.2) IF (fxpar(hdu2,'TELESCOP') EQ 'SOHO') THEN $ IF (fxpar(hdu2,'INSTRUME') EQ 'EIT') THEN $ image2=it_disk(image2,hdu2,radius=radius2*1.2) IF (fxpar(hdu1,'TELESCOP') EQ 'CHIP ') THEN $ image2=it_disk(image2,hdu2,radius=radius2*1.2) IF (fxpar(hdu2,'TELESCOP') EQ 'CHIP ') THEN $ image2=it_disk(image2,hdu2,radius=radius2*1.2) IF (fxpar(hdu1,'TELESCOP') EQ 'H-ALPHA ') THEN $ image1=it_disk(image1,hdu1,radius=radius1*1.05) IF (fxpar(hdu2,'TELESCOP') EQ 'H-ALPHA ') THEN $ image2=it_disk(image2,hdu2,radius=radius2*1.05) IF (fxpar(hdu1,'TELESCOP') EQ 'SINGER ') THEN $ image2=it_disk(image2,hdu2,radius=radius2*1.05) IF (fxpar(hdu2,'TELESCOP') EQ 'SINGER ') THEN $ image2=it_disk(image2,hdu2,radius=radius2*1.05) IF (fxpar(hdu1,'TELESCOP') EQ 'MK3 ') THEN $ image1=it_disk(image1,hdu1,radius=radius1*2.2) IF (fxpar(hdu2,'TELESCOP') EQ 'MK3 ') THEN $ image2=it_disk(image2,hdu2,radius=radius1*2.2) IF (fxpar(hdu1,'TELESCOP') EQ 'Mk4') THEN $ ;image1=it_disk(image1,hdu1,radius=radius1*2.2) image1=it_disk(image1,hdu1,radius=radius1*1.8) IF (fxpar(hdu2,'TELESCOP') EQ 'Mk4') THEN $ ;image2=it_disk(image2,hdu2,radius=radius2*2.2) image2=it_disk(image2,hdu2,radius=radius2*1.8) ; Get rid of diffraction rings in LASCO ;IF (fxpar(hdu1,'INSTRUME') EQ 'LASCO ') THEN $ ; image1=image1-it_disk(image1,hdu1,radius=radius1*2.2) ;IF (fxpar(hdu2,'INSTRUME') EQ 'LASCO ') THEN $ ; image2=image2-it_disk(image2,hdu2,radius=radius2*2.2) ENDIF ;} IF (fxpar(hdu2,'TELESCOP') EQ 'YOHKOH ') THEN $ IF (fxpar(hdu1,'TELESCOP') EQ 'MK3 ') THEN $ image1=image1 - it_disk(image1,hdu1,radius=radius1*1.2) IF (fxpar(hdu1,'TELESCOP') EQ 'Mk4 ') THEN BEGIN image1=image1 - it_disk(image1,hdu1,radius=radius1*1.01) ENDIF IF (fxpar(hdu1,'TELESCOP') EQ 'YOHKOH ') THEN $ IF (fxpar(hdu2,'TELESCOP') EQ 'MK3 ') THEN $ image2=image2 - it_disk(image2,hdu2,radius=radius2*1.2) IF (fxpar(hdu2,'TELESCOP') EQ 'Mk4 ') THEN BEGIN image2=image2 - it_disk(image2,hdu2,radius=radius2*1.01) ENDIF image1=it_center(image1,xc1,yc1) image2=it_center(image2,xc2,yc2) image1=it_scale(image1,radius1,radius2) sub=fxpar(hdu2,'SUBT') subt_err=!err sub=fxpar(hdu1,'SUBT') subt_err2=!err ;--------------------------------------------------------------------------- ; To resolve a rounding error in the colortable procedure, I had to zero out ; image2 below values of 129 before adding them with it_add.pro. This only ; has to be done if there is dpm data (it figures). You can imagine how long ; it took me to figure THAT out. ;--------------------------------------------------------------------------- ;IF (fxpar(hdu1,'TELESCOP') EQ 'MLSO DIGITAL PROMINENCE MONITOR') OR $ ; (fxpar(hdu1,'TELESCOP') EQ 'DPM ') THEN $ ; image2(where(image2 LE 129))=0 ;IF (fxpar(hdu2,'TELESCOP') EQ 'MLSO DIGITAL PROMINENCE MONITOR') OR $ ; (fxpar(hdu2,'TELESCOP') EQ 'DPM ') THEN $ ; image2(where(image2 LE 129))=0 image2(where(image2 LE 128))=128 IF (fxpar(hdu1,'TELESCOP') EQ 'MLSO DIGITAL PROMINENCE MONITOR') THEN $ comparr=it_add(image1,image2,/dpm) ELSE $ IF (fxpar(hdu2,'TELESCOP') EQ 'MLSO DIGITAL PROMINENCE MONITOR') THEN $ comparr=it_add(image1,image2,/dpm) ELSE $ IF (fxpar(hdu3,'TELESCOP') EQ 'MLSO DIGITAL PROMINENCE MONITOR') THEN $ comparr=it_add(image1,image2,/dpm) ELSE $ IF (fxpar(hdu1,'TELESCOP') EQ 'DPM ') THEN $ comparr=it_add(image1,image2,/dpm) ELSE $ IF (fxpar(hdu2,'TELESCOP') EQ 'DPM ') THEN $ comparr=it_add(image1,image2,/dpm) ELSE $ IF (fxpar(hdu3,'TELESCOP') EQ 'DPM ') THEN $ comparr=it_add(image1,image2,/dpm) ELSE $ IF (subt_err NE -1) OR (subt_err2 NE -1) THEN $ comparr=it_add(image1,image2,/subt) ELSE $ comparr=it_add(image1,image2) s=SIZE(comparr) WINDOW,/FREE,XSIZE=s(1),YSIZE=s(2),RETAIN=2 TV,comparr final_img=comparr fxaddpar,hdu1,'CRRADIUS',radius2 END ;} ;---------------------------------------------------------------------------- ; This adds two disk images togther by interlacing them together. ;---------------------------------------------------------------------------- 'INTERLACE':BEGIN ;{ WIDGET_CONTROL,/HOURGLASS xc1=fxpar(hdu1,'CRPIX1') yc1=fxpar(hdu1,'CRPIX2') xc2=fxpar(hdu2,'CRPIX1') yc2=fxpar(hdu2,'CRPIX2') radius1=it_getrad(hdu1) radius2=it_getrad(hdu2) IF (fxpar(hdu1,'TELESCOP') EQ 'MK3 ') OR $ (fxpar(hdu2,'TELESCOP') EQ 'MK3 ') THEN buff_flag=1 ELSE $ buff_flag = 0 IF (buff_flag NE 1) THEN BEGIN ;{ print,'buff_flag: ',buff_flag IF (fxpar(hdu1,'TELESCOP') EQ 'YOHKOH ') THEN $ image1=it_disk(image1,hdu1,radius=radius1*1.2) IF (fxpar(hdu1,'TELESCOP') EQ 'SOHO') THEN $ IF (fxpar(hdu1,'INSTRUME') EQ 'EIT') THEN $ image1=it_disk(image1,hdu1,radius=radius1*1.5) IF (fxpar(hdu2,'TELESCOP') EQ 'YOHKOH ') THEN $ image2=it_disk(image2,hdu2,radius=radius2*1.2) IF (fxpar(hdu2,'TELESCOP') EQ 'SOHO') THEN $ IF (fxpar(hdu2,'INSTRUME') EQ 'EIT') THEN $ image2=it_disk(image2,hdu2,radius=radius2*1.5) IF (fxpar(hdu1,'TELESCOP') EQ 'CHIP ') THEN $ image2=it_disk(image2,hdu2,radius=radius2*1.2) IF (fxpar(hdu2,'TELESCOP') EQ 'CHIP ') THEN $ image2=it_disk(image2,hdu2,radius=radius2*1.2) IF (fxpar(hdu1,'TELESCOP') EQ 'H-ALPHA ') THEN $ image1=it_disk(image1,hdu1,radius=radius1*1.05) IF (fxpar(hdu2,'TELESCOP') EQ 'H-ALPHA ') THEN $ image2=it_disk(image2,hdu2,radius=radius2*1.05) IF (fxpar(hdu1,'TELESCOP') EQ 'SINGER ') THEN $ image2=it_disk(image2,hdu2,radius=radius2*1.05) IF (fxpar(hdu2,'TELESCOP') EQ 'SINGER ') THEN $ image2=it_disk(image2,hdu2,radius=radius2*1.05) ENDIF ;} image2(where(image2 LE 129))=0 image1=it_center(image1,xc1,yc1) image2=it_center(image2,xc2,yc2) ;image1=it_scale(image1,radius1,radius2) image2=it_scale(image2,radius2,radius1) comparr=it_interlace(image1,image2) s=SIZE(comparr) WINDOW,/FREE,XSIZE=s(1),YSIZE=s(2) TV,comparr final_img=comparr fxaddpar,hdu1,'CRRADIUS',radius1 END ;} ENDCASE END ;} ;--------------------------------------------------------------------------- ; Here is the second set of buttons attached to the image2 column. Most ; of these are counterparts to the first set except for the COLOR button ; which lets you play with the overall colortable IDL is using at the time, ; and the ANNOTATE button which reads all of the available headers and ; extracts all of the necessary info to annotate the image. This button ; calls it_annotate.pro. ;--------------------------------------------------------------------------- btns2:BEGIN ;{ CASE event.value OF 'SAVE':BEGIN ;{ WIDGET_CONTROL,/HOURGLASS IF (fxpar(hdu3,'TELESCOP') EQ 'INITIALIZE') THEN $ final_img=it_annotate(final_img,hdr1=hdu1,hdr2=hdu2) ELSE $ final_img=it_annotate(final_img,hdr1=hdu1,hdr2=hdu2,hdr3=hdu3) sz=SIZE(final_img) WINDOW,/FREE,XSIZE=sz(1),ySIZE=sz(2) TV,final_img buff_flag=0 it_savegif,final_img END ;} 'COLOR':BEGIN ;{ xload END ;} 'SMOOTH2':BEGIN ;{ WIDGET_CONTROL,/HOURGLASS WIDGET_CONTROL,img2,GET_VALUE=img2_Id WSET,img2_Id image2=SMOOTH(image2,9) BSCALE,image2,/COMBINED tv,image2 base2=image2 END ;} 'STORE2':BEGIN ;{ buff2=final_img buff_flag=1 sz=SIZE(buff2) fxaddpar,hdu2,'CRPIX1',sz(1)/2 fxaddpar,hdu2,'CRPIX2',sz(2)/2 hdu3=hdu1 ;END ;} ;'RCLBF2':BEGIN ;{ image2=buff2 base2=buff2 WIDGET_CONTROL,img2,GET_VALUE=img2_Id TVLCT,r,g,b,/GET combine_colors WSET,img2_Id WIDGET_CONTROL,/HOURGLASS BSCALE,image2,/COMBINED tv,image2 WIDGET_CONTROL,img2,SET_UVALUE=image2 base2=image2 END ;} 'RESIZE':BEGIN ;{ xinput,newrad,'Enter new radius (pixels):',/ACCEPT_ENTER WIDGET_CONTROL,/HOURGLASS ;image2=it_resize(image2,hdu2,194.1) image2=it_resize(image2,hdu2,float(newrad)) WIDGET_CONTROL,img2,GET_VALUE=img2_Id WSET,img2_Id BSCALE,image2,/COMBINED TV,image2 WIDGET_CONTROL,img2,SET_UVALUE=image2 base2=image2 fxaddpar,hdu2,'CRRADIUS',float(newrad) END ;} '1 <- 2':BEGIN ;{ WIDGET_CONTROL,/HOURGLASS xc1=fxpar(hdu1,'CRPIX1') yc1=fxpar(hdu1,'CRPIX2') xc2=fxpar(hdu2,'CRPIX1') yc2=fxpar(hdu2,'CRPIX2') radius1=it_getrad(hdu1) radius2=it_getrad(hdu2) IF (buff_flag NE 1) THEN BEGIN ;{ IF (fxpar(hdu1,'TELESCOP') EQ 'YOHKOH ') THEN $ image1=it_disk(image1,hdu1,radius=radius1*1.2) IF (fxpar(hdu1,'TELESCOP') EQ 'SOHO') THEN $ IF (fxpar(hdu1,'INSTRUME') EQ 'EIT') THEN $ image1=it_disk(image1,hdu1,radius=radius1*1.2) IF (fxpar(hdu2,'TELESCOP') EQ 'YOHKOH ') THEN $ image2=it_disk(image2,hdu2,radius=radius2*1.2) IF (fxpar(hdu2,'TELESCOP') EQ 'SOHO') THEN $ IF (fxpar(hdu2,'INSTRUME') EQ 'EIT') THEN $ image2=it_disk(image2,hdu2,radius=radius2*1.2) IF (fxpar(hdu1,'TELESCOP') EQ 'CHIP ') THEN $ image2=it_disk(image2,hdu2,radius=radius2*1.2) IF (fxpar(hdu2,'TELESCOP') EQ 'CHIP ') THEN $ image2=it_disk(image2,hdu2,radius=radius2*1.2) IF (fxpar(hdu1,'TELESCOP') EQ 'H-ALPHA ') THEN $ image1=it_disk(image1,hdu1,radius=radius1*1.05) IF (fxpar(hdu2,'TELESCOP') EQ 'H-ALPHA ') THEN $ image2=it_disk(image2,hdu2,radius=radius2*1.05) IF (fxpar(hdu1,'TELESCOP') EQ 'SINGER ') THEN $ image2=it_disk(image2,hdu2,radius=radius2*1.05) IF (fxpar(hdu2,'TELESCOP') EQ 'SINGER ') THEN $ image2=it_disk(image2,hdu2,radius=radius2*1.05) IF (fxpar(hdu1,'TELESCOP') EQ 'MK3 ') THEN $ image1=it_disk(image1,hdu1,radius=radius1*2.2) IF (fxpar(hdu2,'TELESCOP') EQ 'MK3 ') THEN $ image2=it_disk(image2,hdu2,radius=radius1*2.2) IF (fxpar(hdu1,'TELESCOP') EQ 'Mk4') THEN $ ;image1=it_disk(image1,hdu1,radius=radius1*2.3) image1=it_disk(image1,hdu1,radius=radius1*1.8) IF (fxpar(hdu2,'TELESCOP') EQ 'Mk4') THEN $ ;image2=it_disk(image2,hdu2,radius=radius2*2.3) image2=it_disk(image2,hdu2,radius=radius2*1.8) ; Get rid of diffraction rings in LASCO ;IF (fxpar(hdu1,'INSTRUME') EQ 'LASCO ') THEN $ ; image1=image1-it_disk(image1,hdu1,radius=radius1*2.1) ;IF (fxpar(hdu2,'INSTRUME') EQ 'LASCO ') THEN $ ; image2=image2-it_disk(image2,hdu2,radius=radius2*2.1) ENDIF ;} ;IF (buff_flag EQ 1) THEN $ IF (fxpar(hdu1,'TELESCOP') EQ 'YOHKOH ') THEN $ IF (fxpar(hdu2,'TELESCOP') EQ 'MK3 ') THEN $ image2=image2 - it_disk(image2,hdu2,radius=radius2*1.2) IF (fxpar(hdu2,'TELESCOP') EQ 'YOHKOH ') THEN $ IF (fxpar(hdu1,'TELESCOP') EQ 'MK3 ') THEN $ image1=image1 - it_disk(image1,hdu1,radius=radius1*1.2) image1=it_center(image1,xc1,yc1) image2=it_center(image2,xc2,yc2) image2=it_scale(image2,radius2,radius1) sub=fxpar(hdu1,'SUBT') subt_err=!err sub=fxpar(hdu2,'SUBT') subt_err2=!err IF (fxpar(hdu1,'TELESCOP') EQ 'MLSO DIGITAL PROMINENCE MONITOR') THEN $ comparr=it_add(image1,image2,/dpm) ELSE $ IF (fxpar(hdu2,'TELESCOP') EQ 'MLSO DIGITAL PROMINENCE MONITOR') THEN $ comparr=it_add(image1,image2,/dpm) ELSE $ IF (fxpar(hdu3,'TELESCOP') EQ 'MLSO DIGITAL PROMINENCE MONITOR') THEN $ comparr=it_add(image1,image2,/dpm) ELSE $ IF (fxpar(hdu1,'TELESCOP') EQ 'DPM ') THEN $ comparr=it_add(image1,image2,/dpm) ELSE $ IF (fxpar(hdu2,'TELESCOP') EQ 'DPM ') THEN $ comparr=it_add(image1,image2,/dpm) ELSE $ IF (fxpar(hdu3,'TELESCOP') EQ 'DPM ') THEN $ comparr=it_add(image1,image2,/dpm) ELSE $ IF (subt_err NE -1) OR (subt_err2 NE -1) THEN $ comparr=it_add(image1,image2,/subt) ELSE $ comparr=it_add(image1,image2) s=SIZE(comparr) WINDOW,/FREE,XSIZE=s(1),YSIZE=s(2) TV,comparr final_img=comparr fxaddpar,hdu2,'CRRADIUS',radius1 END ;} 'ANNOTATE':BEGIN ;{ WIDGET_CONTROL,/HOURGLASS IF (fxpar(hdu3,'TELESCOP') EQ 'INITIALIZE') THEN $ final_img=it_annotate(final_img,hdr1=hdu1,hdr2=hdu2) ELSE $ final_img=it_annotate(final_img,hdr1=hdu1,hdr2=hdu2,hdr3=hdu3) sz=SIZE(final_img) WINDOW,/FREE,XSIZE=sz(1),ySIZE=sz(2) TV,final_img END ;} ENDCASE END ;} ;--------------------------------------------------------------------------- ; Code for adjusting the min and max values of image1 for scaling. Uses ; ssw bscale.pro to perform the scaling because it allowed for easier ; use of dual color tables. By setting the /LOWER keyword, the image is ; placed (relatively efficiently) into the lower half of the color table. ;--------------------------------------------------------------------------- sld_min1:BEGIN ;{ WIDGET_CONTROL,sld_min1,GET_VALUE=mn WIDGET_CONTROL,sld_max1,GET_VALUE=mx WIDGET_CONTROL,/HOURGLASS image1=BYTSCLI(base1,MIN=mn,MAX=mx) BSCALE,image1,/COMBINED,/LOWER WIDGET_CONTROL,img1,GET_VALUE=img1_Id WSET,img1_Id tv,image1 END ;} sld_max1:BEGIN ;{ WIDGET_CONTROL,sld_min1,GET_VALUE=mn WIDGET_CONTROL,sld_max1,GET_VALUE=mx WIDGET_CONTROL,/HOURGLASS image1=BYTSCLI(base1,MIN=mn,MAX=mx) BSCALE,image1,/COMBINED,/LOWER WIDGET_CONTROL,img1,GET_VALUE=img1_Id WSET,img1_Id tv,image1 END ;} ;--------------------------------------------------------------------------- ; Code for adjusting min and max values for image2 for scaling. Also uses ; bscale.pro but without the /LOWER keyword set. Placed in upper half of ; color table. ;--------------------------------------------------------------------------- sld_min2:BEGIN ;{ WIDGET_CONTROL,sld_min2,GET_VALUE=mn WIDGET_CONTROL,sld_max2,GET_VALUE=mx WIDGET_CONTROL,/HOURGLASS image2=BYTSCLI(base2,MIN=mn,MAX=mx) BSCALE,image2,/COMBINED WIDGET_CONTROL,img2,GET_VALUE=img2_Id WSET,img2_Id tv,image2 END ;} sld_max2:BEGIN ;{ WIDGET_CONTROL,sld_min2,GET_VALUE=mn WIDGET_CONTROL,sld_max2,GET_VALUE=mx WIDGET_CONTROL,/HOURGLASS image2=BYTSCLI(base2,MIN=mn,MAX=mx) BSCALE,image2,/COMBINED WIDGET_CONTROL,img2,GET_VALUE=img2_Id WSET,img2_Id tv,image2 END ;} mult_sld1:BEGIN ;{ WIDGET_CONTROL,mult_sld1,GET_VALUE=mult print,'Multiplier1: ',mult END ;} mult_sld2:BEGIN ;{ WIDGET_CONTROL,mult_sld2,GET_VALUE=mult print,'Multiplier2: ',mult END ;} ENDCASE END ;} PRO dt @dt_com ; ;----------------------------------------------------------------------- ;Initialize vars ;----------------------------------------------------------------------- ; ver_no='0.9' fltr=STRARR(4) image1=INTARR(512,512) image2=INTARR(512,512) path1=curdir() path2=curdir() savpath='' buff_flag=0 str='' fltr=['*fts','*fits','sf_fits*','*FTS','*gif','*GIF','efr*','efz*','ecd*'] fxaddpar,hdu3,'TELESCOP','INITIALIZE' go=0 ; ;----------------------------------------------------------------------- ; Initialize file lists and colortable list arrays ;----------------------------------------------------------------------- ; tables=STRARR(100) OPENR,unit,'/home/tdarnell/idl/image_tools/color_tables.txt',/GET_LUN i=0 WHILE (NOT EOF(unit)) DO BEGIN READF,unit,FORMAT='(A)',str tables(i)=str i=i+1 ENDWHILE tables=tables(0:i-1) CLOSE,unit,/ALL filelist1=file_list(path1,fltr,/FILE,/CD) filelist1=strip_dirname(filelist1,path=pathlist) path1=pathlist(0) filelist2=file_list(path2,fltr,/FILE,/CD) filelist2=strip_dirname(filelist2,path=pathlist) path2=pathlist(0) base=WIDGET_BASE(TITLE='DataTool Ver.'+ver_no,/ROW) col1=WIDGET_BASE(base,/FRAME,/COLUMN) col2=WIDGET_BASE(base,/FRAME,/COLUMN) t=WIDGET_LABEL(col1, VALUE='Image 1') img1=WIDGET_DRAW(col1,SCR_XSIZE=550,SCR_YSIZE=550,RETAIN=2, $ XSIZE=1600,YSIZE=1600,/SCROLL, /MOTION_EVENTS, /BUTTON_EVENTS, $ UVALUE=image1) sld_min1=WIDGET_SLIDER(col1) sld_max1=WIDGET_SLIDER(col1) path_bx1=WIDGET_TEXT(col1,VALUE=path1,/EDITABLE) row1=WIDGET_BASE(col1,/FRAME,/ROW) files1=WIDGET_LIST(row1,XSIZE=17,YSIZE=5,VALUE=filelist1) col_table1=WIDGET_LIST(row1,VALUE=tables,XSIZE=17,YSIZE=5) mult_sld1=CW_FSLIDER(row1,/VERTICAL,MINIMUM=0,MAXIMUM=10, $ FORMAT='(G3.2)',VALUE=1.2,/SUPPRESS_VALUE) t=WIDGET_LABEL(col2, VALUE='Image 2') img2=WIDGET_DRAW(col2,SCR_XSIZE=550,SCR_YSIZE=550,RETAIN=2, $ XSIZE=1600,YSIZE=1600,/SCROLL, /BUTTON_EVENTS, $ UVALUE=image2) sld_min2=WIDGET_SLIDER(col2) sld_max2=WIDGET_SLIDER(col2) path_bx2=WIDGET_TEXT(col2,VALUE=path2,/EDITABLE) row2=WIDGET_BASE(col2,/FRAME,/ROW) files2=WIDGET_LIST(row2,XSIZE=17,YSIZE=5,VALUE=filelist2) col_table2=WIDGET_LIST(row2,XSIZE=17,YSIZE=5,VALUE=tables) mult_sld2=CW_FSLIDER(row2,/VERTICAL,MINIMUM=0,MAXIMUM=10, $ FORMAT='(G3.2)',VALUE=1.2,/SUPPRESS_VALUE) btns1=CW_BGROUP(col1,['QUIT','CTOOL','SMOOTH1','STORE1','1 -> 2' $ ,'RESIZE','INTERLACE'], $ /ROW,/RETURN_NAME) btns2=CW_BGROUP(col2,['SAVE','COLOR','SMOOTH2','STORE2','1 <- 2' $ ,'RESIZE','ANNOTATE'], $ /ROW,/RETURN_NAME) WIDGET_CONTROL,base,/REALIZE XMANAGER,'dt', base END