pro kont_event,event COMMON co,aktual,xpos,ypos COMMON kontrola,kont1,kont2,kontbase2,kontbase ;COMMON innerkont,slid,kontline widget_control,event.id,get_uvalue=uvalue case uvalue of 'SHOW':begin widget_control,kont1,get_value=ips1 & ips1=ips1(0) widget_control,kont2,get_value=ips2 & ips2=ips2(0) widget_control,kontbase2,/destroy kontdraw=widget_draw(kontbase,xsize=600,ysize=400) ;kontline=widget_slider(kontbase,title='Line',uvalue='LINE', $ ; value=0,min=0,max=500) ;slid=0 widget_control,kontdraw,get_value=okno & wset,okno plot,smooth(aktual(*,ips1),4) oplot,smooth(aktual(*,ips2),4),color=250 end ;'LINE':begin ; device,set_graphics=6 ; arrow,slid,0,slid,300,hsize=0,color=!D.N_colors-1 ; widget_control,kontline,get_value=slid ; arrow,slid,0,slid,300,hsize=0,color=!D.N_colors-1 ; device,set_graphics=3 ; end endcase end pro save_event,event widget_control,event.id,get_uvalue=uvalue COMMON grafika,draw COMMON uloz,savefield COMMON co,aktual,xpos,ypos case uvalue of 'OK':begin ; widget_control,draw,get_value=okno & wset,okno ; s2=size(aktual) ; device,set_graphics=6 ; arrow,0,ypos,s2(1),ypos,hsize=0,color=!D.N_colors-1 ; device,set_graphics=3 ; device,set_graphics=6 ; arrow,xpos,0,xpos,s2(2),hsize=0,color=!D.N_colors-1 ; device,set_graphics=3 widget_control,savefield,get_value=nazev & nazev=nazev(0)+'.fts' writefits,nazev,aktual ;tvrd() widget_control,event.top,/destroy end endcase end pro foto1_event,event COMMON grafika,draw COMMON co,aktual,xpos,ypos COMMON blok,base,ibase COMMON inner,slider1,obrazek,drawbase,base1 COMMON uloz,savefield COMMON slid,slider,slidlab COMMON lines,hline,vline COMMON kontrola,kont1,kont2,kontbase2,kontbase COMMON pozice,ukazpozici,poslabel widget_control,event.id,get_uvalue=uvalue case uvalue of 'LOAD':begin ukazpozici=0 widget_control,ibase,/destroy ibase=widget_base(base,/row,xsize=800,ysize=600) drawbase=widget_base(ibase,xsize=550,ysize=550) cesta=pickfile() pripona=strmid(cesta,strlen(cesta)-3,3) if pripona eq 'fts' then obrazek=readfits(cesta) if pripona eq 'tif' then obrazek=read_tiff(cesta,/unsigned) ;obrazek=read_tiff(pickfile(filter='*.tif'),/unsigned) aktual=obrazek s=size(obrazek) draw=widget_draw(drawbase,xsize=s(1),ysize=s(2),x_scroll_size=500,y_scroll_size=500,$ /motion_events,uvalue='OBR') widget_control,draw,get_value=okno wset,okno tvscl,obrazek base1=widget_base(ibase,/column) drop=widget_button(base1,value='CHANGE SIZE',/menu) dr1=widget_button(drop,value='100%',uvalue='DR1') dr2=widget_button(drop,value='75%',uvalue='DR2') dr3=widget_button(drop,value='50%',uvalue='DR3') dr4=widget_button(drop,value='30%',uvalue='DR4') dr5=widget_button(drop,value='25%',uvalue='DR5') dr6=widget_button(drop,value='20%',uvalue='DR6') dr7=widget_button(drop,value='15%',uvalue='DR7') dr8=widget_button(drop,value='10%',uvalue='DR8') dalsi=widget_button(base1,value='NEXT',uvalue='NEXT') end 'NEXT':begin obrazek=aktual widget_control,base1,/destroy base1=widget_base(ibase,/column) drop1=widget_button(base1,value='ROTATE',/menu) d0=widget_button(drop1,value='0°',uvalue='D0') d1=widget_button(drop1,value='90°',uvalue='D1') d2=widget_button(drop1,value='180°',uvalue='D2') d3=widget_button(drop1,value='270°',uvalue='D3') dalsi=widget_button(base1,value='NEXT',uvalue='NEXT2') end 'NEXT2':begin obrazek=aktual s2=size(obrazek) widget_control,base1,/destroy base1=widget_base(ibase,/column) slider=widget_slider(base1,title='ROTATE',uvalue='ROTATE', $ value=0,min=-20,max=20,/suppress_value) slidlab=widget_label(base1,value='0') hline=widget_slider(base1,title='Horizontal line',uvalue='HLINE', $ value=0,min=0,max=s2(2)) vline=widget_slider(base1,title='Vertical line',uvalue='VLINE', $ value=0,min=0,max=s2(1)) poslabel=widget_label(base1,value=' ',xsize=150) kontrola=widget_button(base1,value='CONTROL',uvalue='KONTROLA') ;pozice dalsi=widget_button(base1,value='SAVE',uvalue='SAVE') xpos=0 ypos=0 ukazpozici=1 end 'OBR':begin if ukazpozici eq 1 then begin position=strcompress('('+string(event.x)+','+string(event.y)+')',/remove_all) widget_control,poslabel,set_value=position endif end 'KONTROLA':begin kontbase=widget_base() kontbase2=widget_base(kontbase,/column) kont1=cw_field(kontbase2,title='y position of 1st profile') kont2=cw_field(kontbase2,title='y position of 2nd profile') kontbut=widget_button(kontbase2,value='SHOW PROFILES',uvalue='SHOW') widget_control,kontbase,/realize xmanager,'kont',kontbase end 'HLINE':begin widget_control,draw,get_value=okno & wset,okno s2=size(aktual) device,set_graphics=6 arrow,0,ypos,s2(1),ypos,hsize=0,color=!D.N_colors-1 widget_control,hline,get_value=hodnota arrow,0,hodnota,s2(1),hodnota,hsize=0,color=!D.N_colors-1 device,set_graphics=3 ypos=hodnota end 'VLINE':begin widget_control,draw,get_value=okno & wset,okno s2=size(aktual) device,set_graphics=6 arrow,xpos,0,xpos,s2(2),hsize=0,color=!D.N_colors-1 widget_control,vline,get_value=hodnota arrow,hodnota,0,hodnota,s2(2),hsize=0,color=!D.N_colors-1 device,set_graphics=3 xpos=hodnota end 'D0':begin obrazek2=obrazek s2=size(obrazek2) widget_control,draw,/destroy draw=widget_draw(drawbase,xsize=s2(1),ysize=s2(2),x_scroll_size=500,y_scroll_size=500,$ /motion_events,uvalue='OBR') widget_control,draw,get_value=okno & wset,okno tvscl,obrazek2 aktual=obrazek2 end 'D1':begin obrazek2=rotate(obrazek,1) s2=size(obrazek2) widget_control,draw,/destroy draw=widget_draw(drawbase,xsize=s2(1),ysize=s2(2),x_scroll_size=500,y_scroll_size=500,$ /motion_events,uvalue='OBR') widget_control,draw,get_value=okno & wset,okno tvscl,obrazek2 aktual=obrazek2 end 'D2':begin obrazek2=rotate(obrazek,2) s2=size(obrazek2) widget_control,draw,/destroy draw=widget_draw(drawbase,xsize=s2(1),ysize=s2(2),x_scroll_size=500,y_scroll_size=500,$ /motion_events,uvalue='OBR') widget_control,draw,get_value=okno & wset,okno tvscl,obrazek2 aktual=obrazek2 end 'D3':begin obrazek2=rotate(obrazek,3) s2=size(obrazek2) widget_control,draw,/destroy draw=widget_draw(drawbase,xsize=s2(1),ysize=s2(2),x_scroll_size=500,y_scroll_size=500,$ /motion_events,uvalue='OBR') widget_control,draw,get_value=okno & wset,okno tvscl,obrazek2 aktual=obrazek2 end 'DR1':begin widget_control,draw,/destroy s2=size(obrazek) draw=widget_draw(drawbase,xsize=s2(1),ysize=s2(2),x_scroll_size=500,y_scroll_size=500,$ /motion_events,uvalue='OBR') widget_control,draw,get_value=okno & wset,okno tvscl,obrazek aktual=obrazek end 'DR2':begin s=size(obrazek) obrazek2=congrid(obrazek,s(1)*0.75,s(2)*0.75) s2=size(obrazek2) widget_control,draw,/destroy draw=widget_draw(drawbase,xsize=s2(1),ysize=s2(2),x_scroll_size=500,y_scroll_size=500,$ /motion_events,uvalue='OBR') widget_control,draw,get_value=okno & wset,okno tvscl,obrazek2 aktual=obrazek2 end 'DR3':begin s=size(obrazek) obrazek2=congrid(obrazek,s(1)*0.5,s(2)*0.5) s2=size(obrazek2) widget_control,draw,/destroy draw=widget_draw(drawbase,xsize=s2(1),ysize=s2(2),x_scroll_size=500,y_scroll_size=500,$ /motion_events,uvalue='OBR') widget_control,draw,get_value=okno & wset,okno tvscl,obrazek2 aktual=obrazek2 end 'DR4':begin s=size(obrazek) obrazek2=congrid(obrazek,s(1)*0.3,s(2)*0.3) s2=size(obrazek2) widget_control,draw,/destroy draw=widget_draw(drawbase,xsize=s2(1),ysize=s2(2),x_scroll_size=500,y_scroll_size=500,$ /motion_events,uvalue='OBR') widget_control,draw,get_value=okno & wset,okno tvscl,obrazek2 aktual=obrazek2 end 'DR5':begin s=size(obrazek) obrazek2=congrid(obrazek,s(1)*0.25,s(2)*0.25) s2=size(obrazek2) widget_control,draw,/destroy draw=widget_draw(drawbase,xsize=s2(1),ysize=s2(2),x_scroll_size=500,y_scroll_size=500,$ /motion_events,uvalue='OBR') widget_control,draw,get_value=okno & wset,okno tvscl,obrazek2 aktual=obrazek2 end 'DR6':begin s=size(obrazek) obrazek2=congrid(obrazek,s(1)*0.2,s(2)*0.2) s2=size(obrazek2) widget_control,draw,/destroy draw=widget_draw(drawbase,xsize=s2(1),ysize=s2(2),x_scroll_size=500,y_scroll_size=500,$ /motion_events,uvalue='OBR') widget_control,draw,get_value=okno & wset,okno tvscl,obrazek2 aktual=obrazek2 end 'DR7':begin s=size(obrazek) obrazek2=congrid(obrazek,s(1)*0.15,s(2)*0.15) s2=size(obrazek2) widget_control,draw,/destroy draw=widget_draw(drawbase,xsize=s2(1),ysize=s2(2),x_scroll_size=500,y_scroll_size=500,$ /motion_events,uvalue='OBR') widget_control,draw,get_value=okno & wset,okno tvscl,obrazek2 aktual=obrazek2 end 'DR8':begin s=size(obrazek) obrazek2=congrid(obrazek,s(1)*0.1,s(2)*0.1) s2=size(obrazek2) widget_control,draw,/destroy draw=widget_draw(drawbase,xsize=s2(1),ysize=s2(2),x_scroll_size=500,y_scroll_size=500,$ /motion_events,uvalue='OBR') widget_control,draw,get_value=okno & wset,okno tvscl,obrazek2 aktual=obrazek2 end 'ROTATE':begin widget_control,slider,get_value=hodnota & hodnota=fix(hodnota(0))/10.0 if hodnota lt 0 then strhodnota=strmid(strcompress(string(hodnota),/remove_all),0,4) $ else strhodnota=strmid(strcompress(string(hodnota),/remove_all),0,3) widget_control,slidlab,set_value=strhodnota obrazek2=rot(obrazek,hodnota,/interp) s2=size(obrazek2) widget_control,draw,/destroy draw=widget_draw(drawbase,xsize=s2(1),ysize=s2(2),x_scroll_size=500,y_scroll_size=500,$ /motion_events,uvalue='OBR') widget_control,draw,get_value=okno & wset,okno tvscl,obrazek2 aktual=obrazek2 s2=size(aktual) device,set_graphics=6 arrow,0,ypos,s2(1),ypos,hsize=0,color=!D.N_colors-1 device,set_graphics=3 device,set_graphics=6 arrow,xpos,0,xpos,s2(2),hsize=0,color=!D.N_colors-1 device,set_graphics=3 end 'SAVE':begin savebase=widget_base(/column) savelabel=widget_label(savebase,value='The image will be saved as name.fts') savefield=cw_field(savebase,title='name') savebutton=widget_button(savebase,value='SAVE',uvalue='OK') widget_control,savebase,/realize xmanager,'save',savebase end 'QUIT':begin widget_control,event.top,/destroy end endcase end pro foto1 COMMON blok,base,ibase base=widget_base(mbar=bar) ibase=widget_base(base,/row,xsize=800,ysize=600) fmenu=widget_button(bar,value='FILE',/menu) f1=widget_button(fmenu,value='LOAD IMAGE',uvalue='LOAD') f3=widget_button(fmenu,value='QUIT',uvalue='QUIT') widget_control,base,/realize xmanager,'foto1',base end