[x77,x52,x58,x59,x51,x41,x42] ;Modified for 4-fold symmetry by M. Samso 8/27/99 ; x77 - number of input images ; x52 - image size ; x58 - image center ; x59 - allowed shift ; x51 - object radius ; x41 - theta step ; x42 -range of angular search x78=1.0 ; x54 - first radius for AP MD x54=5.0 ; x56 - double the size x56=2*x52 ; Shift allowed is +-x59, input images are padded x57=2*x59+1 x55=x52-x59+1 ; center of the windowed CCF is at x60=x59+1 ;..................................................................... ; inline buffer used: 1,2,3 and 9 as a stack ;..................................................................... FR ?Reference volume?<1> ; volx76 FR ?Input image series?<2> ; original data _7 FR ?Output image series?<3> ; prealigned data _8 FR ?apmd doc file from APRD?<4> ; apmdx86 FR ?Input angular doc file?<10> ; anglesx76 FR ?Output angular doc file?<5> ; anglesx86 FR ?Transformation doc file from the previous step?<6> ; transx76 FR ?New transformation doc file?<9> ; transx86 FR ?Temporary angular doc file for APRD?<7> ; angvoea FR ?Temporary selection doc file for APRD?<8> ; selvoea ;..................................................................... MD TR OFF ; x53 - number of reference projections VO EA,x53 x41 (0,90.0) (0,89.9) <7> DO LB26 i=x78,x53 SD x0,x0 <8> LB26 SD E <8> ; MS _9@ X52,X52,X78 X53 ; Use AP RD command to match original projections to the reference ; projections. PJ 3Q <1> x51 <8> <7> _9@***** ; AP RD _9@***** x78-x53 x54,x51 (0) <7> N <3> X78-X77 <10> x42 <4> ; ; use crosscorrelation to center 2D images ; use already calculated projections as reference images ; calculate shifts, x53 used there ! ;MD ;SET MP ;(4) ; x91 - average correlation coefficient x91=0.0 ; DO LB5 i=x78,x77 x21=x0 UD S,x21,x81,x82,x83 <4> ; Rotate the image RT SQ <3>x21 _1 x83 (0,0) ; ; get corresponding reference projection, ; number is stored in apmd (x81) x94=0 if(x81.gt.x53) then ; experimental image has to be mirrored x94=1 x81=x81-x53 MR _1 _2 Y PD _2 _3 x56,x56 N (0.000E+00) (1,1) ; else PD _1 _3 x56,x56 B (1,1) endif ; get angles ud ic,x81,x67,x68,x69 <7> sd x21,x67,x68,x69 <5> ; padd reference image pd _9@00x81 _2 x56,x56 N (0.000E+00) (1,1) ; calculate cross-correlation CC N _3 _2 _3 ; WI _3 _2 x57,x57 x55,x55 PK x10,x11,x12,x13,x31,x32,x33 _2 (0) ; when there was no peak found translation is (0,0) and peak value ; x33 is 0. In this case get a value at the origin of the CCF ; and store in in shift document file. This value is needed for ; sorting and calculation of the average correlation coeff. IF(x33.eq.0.0) then GP x33 _2 x60,x60 ENDIF ; get the average correlation coefficient. x91=x91+x33 ; x31=-x31 x32=-x32 ; combine rotation, mirror, and shift and use RT SQ if(x94.eq.1) then x31=-x31 endif ; combine with the previous transformation ; Format of the transformation parameters doc file is: ; angle, Sx, Sy, 0-1 flag for Y-mirror (0-no mirror; 1-mirror) ud ic,x21,x23,x24,x25,x29 <6> @combat[x23,x24,x25,x29,x83,x31,x32,x94,x61,x62,x63,x64] sd x21,x61,x62,x63,x64 <9> ; apply combined transformation to the original experimental image if(x64.eq.0) then rt sq <2>x21 <3>x21 x61 x62,x63 else rt sq <2>x21 _1 x61 x62,x63 mr _1 <3>x21 Y endif LB5 ; x91=x91/x77 SD -1,x91 <9> SD E <9> ud ice <6> sd e <5> ; remove inline files de _1 de _2 de _3 de _9@ ; remove temporary files ud ice <7> de <7> de <8> RE