HOME GUIDE OPERATIONS DOCS ERRORS FORMATS INSTALL NEW TIPS WEB SITES

AP MD - Alignment Program - 3D projection alignment.

(07/09/97)

PURPOSE

Calculate distances between projections in polar coordinates. Determine the three Eulerian angles. This operation forms the main part of the 3D Projection Alignment Method (see the example appended below). Note: this command has been superseded by AP MQ command.

SEE ALSO

VO EA [Even Angles docfile]
VO MD [angular docfile from AP MD]
AP CA [classification alignment]
AP MQ [3D proejction alignment]
AP RA [rotational alignment]
AP SA [shift alignment]
AP SR [shift and rotational alignment]

USAGE

.OPERATION: AP MD

.ENTER TEMPLATE FOR 2-D REFERENCE PROJECTIONS NAME : REF***
[Give the template name of the existing file series of 2D reference projections.]

.ENTER FILE NUMBERS: 1-5266
[Enter file numbers of the series of 2D projections.]

.FIRST AND LAST RING: 5,15
[Only rings with radii in the range 5-15 will be analyzed.]

.SKIP: 1
[If skip=0 or 1, then every ring between 5 and 15 will be taken; for skip=2, every second ring; etc.]

.SCRATCH FILE EXISTS (Y/N/W)?: N
[If the answer is W, all the reference projections will be read and stored in the file 'scratch.file' (created in the directory from which the program was started; make sure that there is enough disk space!!). If the answer is Y, it is assumed that the file 'scratch.file' already exists in the directory from which the program was started. Still, the second question (FILE NUMBERS) must be answered correctly. If the answer is N, the program will proceed without creating 'scratch.file'. If, however, 'scratch.file' does not fit into the memory, it will be created as in option W. More than one program can use the same scratch.file. The file scratch.file is not deleted after the program is completed and can be used in subsequent runs.]

.ENTER TEMPLATE FOR 2-D EXPERIMENTAL PROJECTIONS NAME: DAT***
[Give the template name of the existing file series of 2D data projections.]

.ENTER FILE NUMBERS: 1-129
[Enter file numbers of the series of 2D projections.]

.DOCUMENT FILE NAME: APMD101
[This is the only output produced by this program. It contains 3 columns:

1.Number of the most similar reference projection.
When this number is larger than the number of reference projections, the most similar is the mirrored projection (see note 1).

2.Not-normalized correlation coefficient.
Can be used as a similarity measure.

3. Psi angle.
In-plane rotation angle determined.]

NOTES

  1. In 3D space the projection with the direction: (psi, theta, phi) has its mirrored (around X-axis) counterpart in the direction:
    (-psi, 180-theta, phi+180).
    To save time, the program takes this into account, and each data projection is compared with the reference projection and its mirrored version at the same time. Thus, only half of the total number of reference projections are required; namely, only those with 0<theta<90. If the best match was with the mirrored reference projection, then the number stored in the first column of the document file is equal to the number of corresponding mirrored reference projection increased by the largest reference projection number (see included batch program).

  2. Images need not have power-of-two dimensions.

  3. The reference projections (of the existing structure) can be created using VO EA and PJ 3Q commands. VO EA creates an angular document file with quasi-evenly spaced projection directions and PJ 3Q creates projections of the volume according to this doc file.

  4. The output document file created by AP MD can be converted to the angular document file using VO MD command. Please note that in this case the angular document file created by VO EA is required.

  5. The operation switches automatically between in-core and on-disk versions depending on the memory available. The scratch.file is created/required in either case.

  6. The operation is computationally intensive. The code is parallel.

  7. An example of the Spider batch program which can be used to produce an angular document file from the output document file of this command is included in the manual chapter for the command VO MD.

  8. Implemented by Paul Penczek

SUBROUTINES

DSFS, DSFS_P, NORMAS, ALRQ, ALPRBS, CROSRNG, CROSRMG, FRNG, PRB1D, FFTR_D, FFTC_D, ANGMR, LOG2_P

CALLER

UTIL4
The following example demonstrates how to apply parameters found 
(in-plane rotation and mirror operation) to the input images:

; x91 - number of images
x91=500
; x98 - number of reference images
x98=87
do lb1 i=1,x91
x21=x0
ud ic,x21,x51,x52,x53
apmd500
if(x51.le.x98) goto lb3
mr
avsx21
_1
Y
rt sq
_1
avtx21
x53
(0,0)
x51=x51-x98
x53=x53+180
if(x53.lt.360.0) goto lb2
x53=x53-360.0
goto lb2
lb3
rt sq
avsx21
avtx21
-x53
(0,0)
lb2
sd x21,x51,x52,x53
apmdcnv
lb1 
sd e
apmdcnv
en d

Example of the Spider batch program implementing 3D alignment of projections
procedure:

;b22.prj

MD
TR OFF
;  file info turned off
MD
VB OFF
MD
SET MEM
800
MD
SET MP
4
;
;  Procedures used:
;  Makesel
;  align3d
;
x78=1
; x51 - radius of the structure
x51=36
;  x52 - image size
x52=75
;  x58 - image center
x58=38
; x54 - first radius for APMD
x54=5
;  the CCF file is windowed to prevent too large shifts of projections.
;  Shift allowed is +-x55, input images are padded
x55=4
;
; ---------------------------------------------------------------; change globally the following directories:
;  /net/ithaca/usr4/malhotra/hcc7/nali/sar00 -  input projections "sar*****"
;  /net/ithaca/usr6/pawel/refi/  -  results and document files, 
;  /net/ithaca/usr6/pawel/refi/data/sar00   -  projections used for 3D
;  /net/ithaca/usr6/pawel/refi/cent/sac00   -  test projections used for projection matching
;.................................................
; X61 - number of projections
UD N,X61
/net/ithaca/usr4/malhotra/hcc7/seltotal5
;
;GOTO LB87
; prepare document files
@Makesel[X61]
/net/ithaca/usr6/pawel/refi/select
/net/ithaca/usr6/pawel/refi/selectodd
/net/ithaca/usr6/pawel/refi/selecteven
;
; copy all the projections
DO lb21 i=x78,X61
x22=x0
ud ic,x22,x23
/net/ithaca/usr4/malhotra/hcc7/seltotal5
CP
/net/ithaca/usr4/malhotra/hcc7/nali/sar00x23
_1
CP
_1
/net/ithaca/usr6/pawel/refi/data/sar00x22
CP
_1
/net/ithaca/usr6/pawel/refi/cent/sac00x22
LB21
UD ICE
/net/ithaca/usr4/malhotra/hcc7/seltotal5
LB87
; do 3D projection alignment
DO LB1 i=1,3
x76=x0
x86=x0+1
;
;  BELOW - particular sequence of angular steps, can be modified !!!
RR x41
2.0,2.0,2.0,2.0,2.0,1.5
;
; x61 - number of images
; x52 - image size
; x58 - image center
; x55 - allowed shift
; x51 - object radius
; x41 - theta step
@align3d[x61,x52,x58,x55,x51,x41]
/net/ithaca/usr6/pawel/refi/volx76
/net/ithaca/usr6/pawel/refi/data/sar*****
/net/ithaca/usr6/pawel/refi/cent/sac*****
/net/ithaca/usr6/pawel/refi/apmdx86
/net/ithaca/usr6/pawel/refi/anglesx86
/net/ithaca/usr6/pawel/refi/shiftsx86
/net/ithaca/usr6/pawel/refi/angvoea
/net/ithaca/usr6/pawel/refi/selvoea
; Calculate new, refined 3D structure using centered 
; projections  and the corrected angles from angular
; document file angles***. 
BP RP
/net/ithaca/usr6/pawel/refi/cent/sac*****
/net/ithaca/usr6/pawel/refi/refi/select
x51
/net/ithaca/usr6/pawel/refi/anglesx86
N
/net/ithaca/usr6/pawel/refi/tvolx86
(1.0E-6,0.0)
(100,0)
(-1,1.0)
(0.9997)
; center 3D
CG PH,x10,x11,x12,x21,x22,x23
/net/ithaca/usr6/pawel/refi/tvolx86
SH F
/net/ithaca/usr6/pawel/refi/tvolx86
/net/ithaca/usr6/pawel/refi/volx86
-x21,-x22
-x23
DE
/net/ithaca/usr6/pawel/refi/tvolx86
;
; get two additional volumes to assess the resolution
;.........................................................
BP RP
/net/ithaca/usr6/pawel/refi/cent/sac*****
/net/ithaca/usr6/pawel/refi/selecteven
x51
/net/ithaca/usr6/pawel/refi/anglesx86
N
/net/ithaca/usr6/pawel/refi/vol1x86
(1.0E-6,0.0)
(100,0)
(-1,1.0)
(0.9997)
BP RP
/net/ithaca/usr6/pawel/refi/cent/sac*****
/net/ithaca/usr6/pawel/refi/selectodd
x51
/net/ithaca/usr6/pawel/refi/anglesx86
N
/net/ithaca/usr6/pawel/refi/vol2x86
(1.0E-6,0.0)
(100,0)
(-1,1.0)
(0.9997)
; resolution
RF 3
/net/ithaca/usr6/pawel/refi/vol1x86
/net/ithaca/usr6/pawel/refi/vol2x86
(0.5)
(0.2,2.0)
C
(90.0)
(3)
/net/ithaca/usr6/pawel/refi/dresx86
LB1
EN
;
;  Procedures required:
; Makesel.prj
[x77]
; x77 - number of entries
FR
?Selection doc file?          
; <1>
FR
?Odd selection doc file?      
; <2>
FR
?Even selection doc file?     
; <3>
;
X78=1
; prepare document files
DO LB21 i=x78,x77
SD x0,x0
<1>
lb21
SD E
<1>
;
x21=-1
x22=0
DO lb22 i=x78,x77
IF(x21.gt.0.0) goto lb23
x22=x22+1
SD x22,x0
<3>
x21=-x21
GOTO lb22
LB23
SD x22,x0
<2>
x21=-x21
LB22 
SD E
<2>
SD E
<3>
;
RE
;
;align3d.prj
[x77,x52,x58,x59,x51,x41]
; x77 - number of input images 
; x52 - image size
; x58 - image center
; x59 - allowed shift
; x51 - object radius
; x41 - theta step
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
;.....................................................................
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 APMD?                      
; <4>  apmdx86
FR
?Angular doc file from APMD?                   
; <5>  anglesx86
FR
?Shifts doc file?                              
; <6>  shiftsx86
FR
?Temporary angular doc file for APMD?          
; <7>  angvoea
FR
?Temporary selection doc file for APMD?        
; <8>  selvoea
;.....................................................................
MD
TR OFF
; x53 - number of reference projections
VO EA,x53
x41
0,90.0
0,359.9
<7>
DO lb26 i=x78,x53
SD x0,x0
<8>
lb26
SD E
<8>
;
MS
_9@
X52,X52,X78
X53
; Use AP MD command to match original projections to the reference
; projections.
PJ 3Q
<1>
x51
<8>
<7>
_9@****
;
AP MD
_9@****
x78-x53
x54,x51
0
N
<3>
X78-X77
<4>
;
; Convert document file produced by AP MD to the angular document
; file. At this stage the projections not matching the structure well
; could be sorted out.
VO MD
<7>
<4>
<5>
;
MD
SET MP
2
; use crosscorrelation to center 2D images
; use already calculated projections as reference images
; calculate shifts,  x53 used there !
DO LB5 i=x78,x77
x21=x0
UD S,x21,x81,x82,x83
<4>
;
CP
<2>x21
_3
PD
_3
_1
x56,x56
B
(1,1)
; get corresponding projection, number is stored in apmd
if(x81.le.x53)  goto  LB61
;  theta>90
x81=x81-x53
MR
_9@0x81
_4
Y
RT SQ
_4
_5
x83
(0,0)
; it is assumed that reference projections have theta <=90
goto LB62
LB61
; theta<90 
RT SQ
_9@0x81
_5
x83
(0,0)
; it is assumed that reference projections have theta <=90
LB62
MA
_5
_4
x51
D
E
(0)
x58,x58
;
PD
_4
_2
x56,x56
N
(0.000E+00)
(1,1)
CC N
_1
_2
_1
;
de
_2
WI
_1
_2
x57,x57
x55,x55
PK x10,x11,x12,x13,x31,x32,x33
_2
(0)
SH F
_3
<3>x21
-x31,-x32
; store the shift parameters
SD x21,x31,x32,x33
<6>
LB5
SD E
<6>
; remove inline files
de
_1
de
_2
de
_3
de
_4
de
_5
de
_9@
; remove temporary files
de
<7>
de
<8>
;
MD
SET MP
4
;
RE

© Copyright Notice /       Enquiries: spider@wadsworth.org