; SOURCE: align.tom ; ; PURPOSE: Applies alignment parameters to images for a single or ; double tilt series. ; Scales output images by specified size factor. x21 = 2 ; For single tilt: 1, double tilt: 2 x20 = 1 ; Aligned image scale factor (1 = original size) ; ----------------------- Input files ------------------------------- FR G [rot]rotated/rot_*** ; Tilted image file template FR G [sel001]sel001 ; First series selection doc file FR G [cca1]cca002 ; First series alignment doc file FR G [sel002]sel002 ; Second series selection doc file FR G [cca2]ccb002 ; Second series alignment doc file FR G [sel003]sel003 ; Combined series selection doc file FR G [c3c202]c3c202 ; Second series alignment doc file (for double tilt) ; ---------------------- Output files ---------------------------------- FR G [output]aligned/rdb_*** ; Aligned image files template ; ----------------- END BATCH HEADER ------------------------------------ ; First series UD 1, x55 ; Get current image number [sel001] ; Select file for single tilt (input) FI x50,x51 ; Find current image size [rot]x55 ; Image file (input) (2,12) ; x,y size of image x52=x50*x20 ; Scaled x size x53=x51*x20 ; Scaled y size UD N x30 ; Number of images in first series [sel001] DO LB1 x11=1,x30 ; Loop over all images images in first series UD IC x11, x55 ; Get current image number [sel001] ; Select file for single tilt (input) UD IC,x55,x61,x62,x63,x64,x65 ; Get alignment parameters for this image [cca1] ; Alignment doc file (input) VM echo " Image: {***x55} Rotated:{%f6.1%x63} Scale: {%f3.1%x61} X&Y shift: {%f6.1%x64}, {%f6.1%x65}" IF (x20 .NE. 1.0) THEN RT SQ ; Rotate and shift [rot]x55 ; Image file (input) _1 ; Image file (output) x63,x61 ; Angle & scale x64,x65 ; Shifts IP ; Interpolate _1 ; Image file (input) [output]x55 ; Rotated image file (output) (x52,x53) ELSE RT SQ ; Rotate and shift [rot]x55 ; Image file (input) [output]x55 ; Rotated image file (output) x63,x61 ; Angle & scale x64,x65 ; Shifts ENDIF LB1 UD ICE ; Close doc file [cca1] ; Alignment input doc file UD ICE ; Close doc file [sel001] ; Select file for single tilt, first series DE ; Cleanup temp file _1 IF (x21.LT.2) THEN EN ; Stop if single tilt ENDIF ; Second series ----------------------------------------------------- UD N x30 ; Number of images in second series [sel002] UD IC x11, x55 ; Get current image number [sel002] ; Select file for single tilt, first series FI x50,x51 [rot]x55 ; Image file (input) (2,12) ; X,Y size of image x52=x50*x20 ; Scaled x size x53=x51*x20 ; Scaled y size DO LB2 x11=1,x30 ; Loop over images in second series UD IC x11, x55 ; Get current image number [sel002] ; Select file for single tilt, second series UD IC,x55,x61,x62,x63,x64,x65 ; Get alignment parameters for this image [cca2] ; Alignment doc file (input) VM echo " Image: {***x55} Rotated:{%f6.1%x63} Scale: {%f3.1%x61} X&Y shift: {%f6.1%x64}, {%f6.1%x65}" IF (x20 .NE. 1.0) THEN RT SQ ; Rotate and shift [rot]x55 ; Image file (input) _1 ; Image file (output) x63,x61 ; Angle & scale x64,x65 ; Shifts IP ; Interpolate _1 ; Image file (input) [output]x55 ; Rotated image file (output) (x52,x53) ELSE RT SQ ; Rotate and shift [rot]x55 ; Image file (input) [output]x55 ; Rotated image file (output) x63,x61 ; Angle & scale x64,x65 ; Shifts ENDIF LB2 UD ICE ; Close doc file [cca2] ; Alignment input doc file UD ICE ; Close doc file [sel002] ; Select file for single tilt, first series DE ; Cleanup temp file _1 EN