pro prvni_event,event COMMON profily,profil1,profil2 COMMON baze2,prvnilab,prvnidraw,prvnibut,prvni1,prvni COMMON pozice,pozice1,pozice2 COMMON kolik,pocet2 COMMON data,kliny,obrazek COMMON uloz,cesta COMMON uloz2,obrazek2 COMMON novy,prvniposlab ;COMMON velikost,s1,s2 widget_control,event.id,get_uvalue=uvalue case uvalue of 'CLICK1':begin coord=round(convert_coord(event.x,event.y,/device,/to_data)) widget_control,prvniposlab,set_value=strcompress('('+string(coord(0))+','+string(coord(1))+')',/remove_all) if (event.press eq 1) then begin iks=coord(0) index=where(pozice1 eq 0) pozice1(index(0))=iks print,iks endif end 'CLICK2':begin coord=round(convert_coord(event.x,event.y,/device,/to_data)) widget_control,prvniposlab,set_value=strcompress('('+string(coord(0))+','+string(coord(1))+')',/remove_all) if (event.press eq 1) then begin pocet2=pocet2+1 index=where(pozice1 eq 0) pocet1=index(0) iks=coord(0) index=where(pozice2 eq 0) pozice2(index(0))=iks print,iks if pocet2 eq pocet1 then begin widget_control,prvni1,/destroy posun=round(float(total(pozice1-pozice2))/pocet1) print,'shift = ',posun if posun gt 0 then begin ;posun doprava (zvetseni obrazku) s=size(obrazek) ;duvod - posledni cara v obrazku by se dostala posunem doleva ;obrazek2=bytarr(s(1)+posun,s(2)) obrazek2=lonarr(s(1)+posun,s(2)) obrazek2(posun:*,*)=obrazek endif else begin ;posun doleva obrazek2=shift(obrazek,posun) endelse s=size(obrazek2) prvni1=widget_base(prvni,/column) prvnilab=widget_label(prvni1,value='Shifted image') prvnidraw=widget_draw(prvni1,xsize=s(1),ysize=s(2),x_scroll_size=400,y_scroll_size=400) prvnibut=widget_button(prvni1,value='SAVE',uvalue='SAVE') widget_control,prvnidraw,get_value=okno & wset,okno tvscl,obrazek2 endif endif end 'NEXT':begin widget_control,prvnilab,set_value='2nd profile' widget_control,prvnibut,/destroy widget_control,prvnidraw,set_uvalue='CLICK2' widget_control,prvniposlab,set_value='position' widget_control,prvnidraw,get_value=okno & wset,okno plot,smooth(profil2,2),pos=[0,0,1,1],xstyle=4,ystyle=4 pocet2=0 print,'--------------' end 'SAVE':begin ;widget_control,prvnidraw,get_value=okno & wset,okno strput,cesta,'_s.ft',strlen(cesta)-4 cesta=cesta+'ts' writefits,cesta,obrazek2 ;tvrd() widget_control,event.top,/destroy ;**************************************************** end endcase end pro foto2_event,event COMMON inner1,base2,kliknuti1,kliknuti2 COMMON data,kliny,obrazek COMMON profily,profil1,profil2 COMMON baze1,ibase,base,f2 COMMON baze2,prvnilab,prvnidraw,prvnibut,prvni1,prvni COMMON pozice,pozice1,pozice2 COMMON uloz,cesta COMMON pozice2,pos1,pos2 COMMON novy,prvniposlab ;COMMON velikost,s1,s2 widget_control,event.id,get_uvalue=uvalue case uvalue of 'LOAD1':begin widget_control,ibase,/destroy cestaklin=pickfile() pripona=strmid(cestaklin,strlen(cestaklin)-3,3) if pripona eq 'fts' then kliny=readfits(cestaklin) if pripona eq 'tif' then kliny=read_tiff(cestaklin,/unsigned) ;kliny=read_tiff(pickfile(filter='*.tif'),/unsigned) s1=size(kliny) ibase=widget_base(base,/row) base1=widget_base(ibase,/column) lab1=widget_label(base1,value='WEDGES') draw1=widget_draw(base1,xsize=s1(1),ysize=s1(2),x_scroll_size=400,$ y_scroll_size=400,/button_events,uvalue='OBR1',/motion_events) pos1=widget_label(base1,value=' ',xsize=150) base2=widget_base(ibase) widget_control,draw1,get_value=okno & wset,okno tvscl,kliny widget_control,f2,sensitive=1 end 'LOAD2':begin widget_control,base2,/destroy 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) s2=size(obrazek) base2=widget_base(ibase,/column) lab2=widget_label(base2,value='IMAGE') draw2=widget_draw(base2,xsize=s2(1),ysize=s2(2),x_scroll_size=400,$ y_scroll_size=400,/button_events,uvalue='OBR2',/motion_events) pos2=widget_label(base2,value=' ',xsize=150) shiftbut=widget_button(base2,value='COMPUTE SHIFT',uvalue='SHIFT') widget_control,draw2,get_value=okno & wset,okno tvscl,obrazek kliknuti1=0 & kliknuti2=0 end 'OBR1':begin position=strcompress('('+string(event.x)+','+string(event.y)+')',/remove_all) widget_control,pos1,set_value=position if (event.press eq 1) then begin s=size(kliny) profil1=make_array(s(1),value=0) for i=-5,5 do profil1=profil1+float(kliny(*,event.y+i)) profil1=profil1/11 kliknuti1=1 endif end 'OBR2':begin position=strcompress('('+string(event.x)+','+string(event.y)+')',/remove_all) widget_control,pos2,set_value=position if (event.press eq 1) then begin s=size(obrazek) profil2=make_array(s(1),value=0) for i=-5,5 do profil2=profil2+float(obrazek(*,event.y+i)) profil2=profil2/11 kliknuti2=1 endif end 'SHIFT':begin if (kliknuti1 ne 0) and (kliknuti2 ne 0) then begin prvni=widget_base() prvni1=widget_base(prvni,/column) prvnilab=widget_label(prvni1,value='1st profile') prvnidraw=widget_draw(prvni1,xsize=600,ysize=400,/button_event,uvalue='CLICK1',/motion_events) prvniposlab=widget_label(prvni1,value='position',xsize=150) prvnibut=widget_button(prvni1,value='Next profile',uvalue='NEXT') widget_control,prvni,/realize widget_control,prvnidraw,get_value=okno & wset,okno plot,smooth(profil1,2),pos=[0,0,1,1],xstyle=4,ystyle=4 pozice1=make_array(10,value=0) pozice2=make_array(10,value=0) xmanager,'prvni',prvni endif else begin chyba=widget_base() chlab=widget_label(chyba,value='You are supposed to take profiles by clicking in images') widget_control,chyba,/realize endelse end 'QUIT':begin widget_control,event.top,/destroy end endcase end pro foto2 COMMON baze1,ibase,base,f2 base=widget_base(mbar=bar,xsize=850,ysize=500) ibase=widget_base(base) fmenu=widget_button(bar,value='FILE',/menu) f1=widget_button(fmenu,value='LOAD WEDGES ',uvalue='LOAD1') f2=widget_button(fmenu,value='LOAD IMAGE',uvalue='LOAD2') f3=widget_button(fmenu,value='QUIT',uvalue='QUIT') widget_control,base,/realize widget_control,f2,sensitive=0 xmanager,'foto2',base end