; rctcenl: ; ; reads all angles from the label of the tilt images ; (currently 2 questions just dummied out) ;procedure to center the tilted images directly by cross-correlation ;with the untilted ones ;three rounds of cross-correlation are done ;;author:m.radermacher ;converted to new spider d.bubeck 7/2/97 ;-------------------------------------------------------------------- ; ;create blank file: bl scr997 32,32 n 0 ; get input data: fi ?windowed original tilted input image names? ;----------------------------------------------------p1 fi ?aligned untilted input image name (must exist)? ;----------------------------------------------------p2 x30=x1 x31=x2 rr x10 ?first key in selection doc-file? ;----------------------------------------------------p3 rr x11 ?last key in selection doc-file? ;----------------------------------------------------p4 fi ?lookup output files? ;----------------------------------------------------p5 rr x50 ?mask radius? ;----------------------------------------------------p6 fr ?tilted centered output files? ;----------------------------------------------------p7 x32=x30/2+1 x33=x31/2+1 ;---------------------------------------------------- ; cross correlate tilted images with untilted to center them ;-------------------------------------------------- fr ?selection doc-file? ;----------------------------------------------------<8> fr ?output shift docfile? ;----------------------------------------------------<9> fr ?output lookup montage? ;----------------------------------------------------<10> 10 rr x25 ?low pass radius? ;----------------------------------------------------<11> rr x26 ?high pass radius? ;----------------------------------------------------<12> do lb3 i=x10,x11 x94=x0 ud x0,x86 <8> if(x86.ne.1.)goto lb3 fi x20,x21 <1>x94 15,16 ;--------------------tilt angle parameters, x20 phi,x21 theta if(x21.eq.0) goto lb5 x62=x21 x63=cos(x62) x64=x30/x63 x65=((x64-x31)/2+1) x66=1 x87=2.6 ;------------------------------------------------tilted ;------strech the tilted one ip <1>x94 scr000 x64,x30 wi scr000 scr001 x30,x31 x65,x66 ;----------------mask the tilted streched ma scr001 mmf001 x50 g a x32,x33 x87 ;---------------------------------------------------untilted ;-----rotate, mask, low-pass and high-pass the untilted ; rt <2>x94 scr001 x20 ; ma scr001 scr999 x50 g a x32,x33 x87 ; ft ic scr999 _1 ff _1 _2 (3) x25 ff _2 _3 (4) x26 ft _3 scr999 ;------------------------------------------------cross-correlation ;------------first time cc mmf001 scr999 ccf001 x51=(x30/2-x50)+2 ;(distance for edge exclusion) ; ; find peak of the cross-correlation ;wi ;ccf001 ;cct1lx94 ;(32,32) ;(49,49) pk c x40,x41 ccf001 (3,0) (12.,12.) y (2.) x51 x40=x40*x63 ; sh f <1>x94 scr002 -x40,-x41 ; ; second time ;------------------------------------------redo the work with the shifted unt. ;------strech the new tilted one ip scr002 scr000 x64,x30 wi scr000 scr001 x30,x31 x65,x66 ;----------------mask the new tilted streched ma scr001 mmf001 x50 g a x32,x33 x87 ;--------------cross-correlation cc mmf001 scr999 ccf001 x51=(x30/2-x50)+2 ;(distance for edge exclusion) ; ; find peak of the cross-correlation ;wi ;ccf001 ;cct2lx94 ;(32,32) ;(49,49) pk c x90,x91 ccf001 (3,0) (12.,12.) y (2.) x51 x90=x90*x63 ; shift the original image by the combined vector ; x84=x90+x40 x85=x91+x41 sh f <1>x94 scr002 -x84,-x85 ; ; ; third time ;------------------------------------------redo the work with the shifted unt. ;------strech the new tilted one ip scr002 scr000 x64,x30 wi scr000 scr001 x30,x31 x65,x66 ;----------------mask the new tilted streched ma scr001 mmf001 x50 g a x32,x33 x87 ;--------------cross-correlation cc mmf001 scr999 ccf001 x51=(x30/2-x50)+2 ;(distance for edge exclusion) ; ; find peak of the cross-correlation ;wi ;ccf001 ;cct3lx94 ;(32,32) ;(49,49) pk c x80,x81 ccf001 (3,0) (12.,12.) y (2.) x51 x80=x80*x63 ; shift the original image by the combined vector ; x84=x90+x40+x80 x85=x91+x41+x81 sh f <1>x94 <7>x94 -x84,-x85 ; ; ; save the shift parameter ; sd x0,x40,x41,x90,x91,x80,x81 <9> sd x0,x84,x85 <9> ; interpolate down x47=x30/x32+1 bc <7>x94 scr995 l (5,5) (1) ip scr995 scr998 (32) ; find dynamic range for display fs scr998 fi scr998 x71=x5+3*x6 x70=x5-3*x6 th scr998 <5>x94 c x71,x70 ; lb3 mn s <5> x10-x11 (10,1) (0) <10> if(x21.ne.0) goto lb6 lb5 ;******* image header empty ********** lb6 re