2980
Comment:

2976

Deletions are marked like this.  Additions are marked like this. 
Line 19:  Line 19: 
{{{`((x'),(y'),(z'))=[[cos psi cos theta cos phi  sin psi sin phi,cos psi cos theta sin phi + sin psi cos phi, cos psi sin theta],[sin psi cos theta cos phi  cos psi sin phi,sin psi cos theta sin phi + cos psi cos phi,sin psi cos theta cos],[sin theta cos phi,sin theta sin phi,cos theta]]((x),(y),(z))`}}}  {{{`((x'),(y'),(z'))=[[cos psi cos theta cos phi  sin psi sin phi,cos psi cos theta sin phi + sin psi cos phi, cos psi sin theta],[sin psi cos theta cos phi  cos psi sin phi,sin psi cos theta sin phi + cos psi cos phi,sin psi sin theta],[sin theta cos phi,sin theta sin phi,cos theta]]((x),(y),(z))`}}} 
Euler angles
Internally, SPARX shares with EMAN2 basic functionality of rotations/shifts/change of scale of multidimensional objects as provided by the [:transformClass:] Transform Class.
In practice it means that one can use the following conventions of Euler angles: SPIDER, EMAN, IMAGIC, SPIN, QUATERNION, SGIROT, MRC, XYZ, and MATRIX. However, SPARX system relies on SPIDER convention, which means that whenever user is prompted to provide Euler angles or when the system prints values of Euler angles, they are always in SPIDER convention. Also, much of the code uses internally Euler angles in SPIDER convention.
The explanation of various conventions and details of implementation are given in:
Baldwin, P.R., Penczek, P.A.: The transform class in SPARX and EMAN2. J. Struct. Biol., 157, pp.250261, 2007.
In what follows we focus on SPIDER convention. Traditionally in EM the direction of propagation of the electron beam is thought to coincide with z axis, which in addition uniquely specifies xy as the plane in which the data is collected. Thus, it is convenient to express the rotations with respect to the z axis. By using a ZYZ convention (rotation around the z axis, followed by a rotation around y, and another around z), one benefits from the fact that the description bears a simple relation to the description of a point on a sphere; that is to say, we can think of the decomposition as the description of a point on the sphere (the first two Eulerian angles YZ) and a final inplane rotation (the final ZEulerian angle). We denote three respective Euler angles as phi `(phi)`, theta `(theta)`, psi `(psi)` and the corresponding rotation in matrix notation as a product of three matrices:
`R_Z(psi) R_Y(theta) R_Z(phi)=`
`((x'),(y'),(z'))=[[cos psi,sin psi, 0],[sin psi,cos psi,0],[0,0,1]] [[cos theta,0,sin theta],[0,1,0],[sin theta,0,cos theta]] [[cos phi,sin phi, 0],[sin phi,cos phi,0],[0,0,1]]((x),(y),(z))`
or as one `3x3` rotation matrix:
`((x'),(y'),(z'))=[[cos psi cos theta cos phi  sin psi sin phi,cos psi cos theta sin phi + sin psi cos phi, cos psi sin theta],[sin psi cos theta cos phi  cos psi sin phi,sin psi cos theta sin phi + cos psi cos phi,sin psi sin theta],[sin theta cos phi,sin theta sin phi,cos theta]]((x),(y),(z))`
This is called a ZYZ convention since the matrices appear in the order from right to left as clockwise rotations around z, y, and z, respectively. By “clockwise rotation around z", we mean that, when viewed along the positive axis, the rotation of the object looks clockwise. Recall that it is the matrix at the rightmost end that is applied first. So one might write a 3DEM rotation as `(phi, theta, psi)`, where `phi` is applied first, `theta` second and `psi` lastly.