PRO diff_event,event COMMON widgets,back_list,fore_list,meas_window,buttons,path_box,img,image, $ filelist,backimg,foreimg,hdu1,hdu2,text_array,minslider, $ maxslider,months,time1,time2 CASE event.id OF back_list:BEGIN ;{ WIDGET_CONTROL,path_box,GET_VALUE=path ;IF (STRMID(path,STRLEN(path)-1,1) NE '/') THEN path=path+'/' path=path+'/' backfile=filelist(event.index) time1=STRMID(backfile,7,2)+':'+STRMID(backfile,10,2) ;CATCH,file_err ;IF (file_err NE 0) THEN BEGIN ; junk=WIDGET_MESSAGE(!ERR_STRING,/ERROR,TITLE='Bummer') ; RETURN ;ENDIF close,1 & openr,1,backfile & readu,1,backimg & close,1 WIDGET_CONTROL,img,GET_VALUE=img_Id WSET,img_Id diffimg=foreimg-backimg diffimg=it_drawcircle(diffimg) WIDGET_CONTROL,minslider,GET_VALUE=mn WIDGET_CONTROL,maxslider,GET_VALUE=mx dispimg=BYTSCL(diffimg,MIN=mn,MAX=mx,TOP=230) tv,dispimg END ;} fore_list:BEGIN ;{ WIDGET_CONTROL,path_box,GET_VALUE=path ;IF (STRMID(path,STRLEN(path)-1,1) NE '/') THEN path=path+'/' path=path+'/' forefile=filelist(event.index) time2=STRMID(forefile,7,2)+':'+STRMID(forefile,10,2) ;CATCH,file_err ;IF (file_err NE 0) THEN BEGIN ; junk=WIDGET_MESSAGE(!ERR_STRING,/ERROR,TITLE='Bummer') ; RETURN ;ENDIF close,1 & openr,1,forefile & readu,1,foreimg & close,1 WIDGET_CONTROL,img,GET_VALUE=img_Id WSET,img_Id diffimg=foreimg-backimg diffimg=it_drawcircle(diffimg) doy=STRMID(forefile,3,3) year=STRMID(forefile,0,2) doy2date,doy,year,month,day date_str=STRING(day)+'-'+months(month-1)+'-'+STRING(year) date_str=STRCOMPRESS(date_str,/REMOVE_ALL) WIDGET_CONTROL,minslider,GET_VALUE=mn WIDGET_CONTROL,maxslider,GET_VALUE=mx dispimg=BYTSCL(diffimg,MIN=mn,MAX=mx,TOP=230) tv,dispimg XYOUTS,0,490,'HAO MK3 K-Coronameter',CHARSIZE=2.0,/DEVICE XYOUTS,0,475,date_str,CHARSIZE=1.5,/DEVICE XYOUTS,350,490,time2+' minus '+time1,CHARSIZE=1.5,/DEVICE XYOUTS,0,3,'North is straight up',CHARSIZE=1.5,/DEVICE WIDGET_CONTROL,fore_list,SET_UVALUE=forefile END ;} minslider:BEGIN WIDGET_CONTROL,minslider,GET_VALUE=mn WIDGET_CONTROL,minslider,SET_VALUE=mn END maxslider:BEGIN WIDGET_CONTROL,maxslider,GET_VALUE=mx WIDGET_CONTROL,maxslider,SET_VALUE=mx END img:BEGIN ;{ x=event.x y=event.y mk3rad=104.4435 acirc=!PI * 2.0/360.0 xcen=255.5 ycen=255.5 xdis=xcen-x & xdissq=xdis*xdis ydis=ycen-y & ydissq=ydis*ydis radius=SQRT(xdissq+ydissq)/mk3rad theta=(ATAN(ydis,xdis)/acirc) + 90 IF (theta LT 0.) THEN theta=theta+360 IF (theta GT 360.) THEN theta=theta-360 text_array(0,*)='x= '+STRING(x) text_array(1,*)='y= '+STRING(y) text_array(2,*)='Radius= '+STRING(radius) text_array(3,*)='Theta= '+STRING(theta) WIDGET_CONTROL,meas_window,SET_VALUE=text_array END ;} buttons:BEGIN ;{ CASE event.value OF ;{ 'Quit':BEGIN WIDGET_CONTROL,event.top,/DESTROY END 'Save as Gif':BEGIN ;{ final_img=TVRD() WIDGET_CONTROL,fore_list,GET_UVALUE=file df_savegif,final_img,file END ;} 'View Direct':BEGIN ;{ junk = WIDGET_MESSAGE('This part of the code is not connected yet', $ TITLE='BUMMER',/INFORMATION) RETURN END ;} ENDCASE ;} END ;} ENDCASE END PRO diff COMMON widgets ; Mauna Loa image differencing program. ; ; Initialize vars ; path=curdir() ;fltr=['*fts','*fits'] fltr=['*slit'] filelist=file_list(path,fltr,/FILE,/CD) filelist=strip_dirname(filelist) image=intarr(512,512) backimg=image foreimg=image text_array=STRARR(5,20) months=['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct' $ ,'Nov','Dec'] ; ; Initialize widgets ; base = WIDGET_BASE(TITLE='Mauna Loa Image Differencing Program',/ROW) panel1=WIDGET_BASE(base,/COLUMN) panel2=WIDGET_BASE(base,/COLUMN,/FRAME) ; Load difference color table dfcol ; ; Change cursor to thin arrow ; device,$ cursor_image=$ [1,63,95,111,119,123,125,254,256,0,0,0,0,11,5,0],$ cursor_mask=$ [65025,768,1280,2304,4352,8448,16640,33024,257,258,4,8,16,32,64,128],$ cursor_xy=[0,15] WDELETE label_panel=WIDGET_BASE(panel1,/ROW) file_panel=WIDGET_BASE(panel1,/ROW,/FRAME) minslider=WIDGET_SLIDER(panel1,MINIMUM=-2000, MAXIMUM=3000, $ VALUE=-500,TITLE='MIN') maxslider=WIDGET_SLIDER(panel1,MINIMUM=-2000, MAXIMUM=3000, $ VALUE=500,TITLE='MAX') l=WIDGET_LABEL(panel1,VALUE='Measurement Window',/ALIGN_CENTER) meas_panel=WIDGET_BASE(panel1,/ROW,/FRAME) l=WIDGET_LABEL(panel1,VALUE='File Operations') button_panel=WIDGET_BASE(panel1,/ROW,/FRAME) label1=WIDGET_BASE(label_panel,XSIZE=230,YSIZE=20) label2=WIDGET_BASE(label_panel,XSIZE=200,YSIZE=20) l=WIDGET_LABEL(label1,VALUE='Background Images:') back_list=WIDGET_LIST(file_panel,XSIZE=15,YSIZE=5,VALUE=filelist) l=WIDGET_LABEL(label2,VALUE='Foreground Images:') fore_list=WIDGET_LIST(file_panel,XSIZE=15,YSIZE=5,VALUE=filelist) meas_window=WIDGET_TEXT(meas_panel,XSIZE=60, YSIZE=4) buttons=CW_BGROUP(button_panel,['View Direct','Save as Gif','Quit'] $ ,/ROW,/RETURN_NAME) l=WIDGET_LABEL(panel1,VALUE='Path:') path_box=WIDGET_TEXT(panel1,VALUE=path,/EDITABLE) l=WIDGET_LABEL(panel2,VALUE='Subtracted Image') img=WIDGET_DRAW(panel2,COLORS=256,/MOTION_EVENTS,XSIZE=512,YSIZE=512, $ UVALUE=image,RETAIN=2) ; ; Draw widgets ; WIDGET_CONTROL,base,/REALIZE XMANAGER,'diff',base END