1703
Comment:

2561

Deletions are marked like this.  Additions are marked like this. 
Line 3:  Line 3: 
Line 6:  Line 7: 
. Here are some examples of creating a Transform3D object. Much more will be added later.  . Here are some examples of creating a Transform3D object. Much more here: [http://blake.bcm.edu/emanwiki/Eman2TransformInPython]. 
Line 8:  Line 9: 
Line 9:  Line 11: 
RA=Transform3D(0,0,25); # Default is the ZXZ convention RA=Transform3D(EULER_SPIDER,0,0,25); # This is the typical ZYZ convention RA=Transform3D(m11,m12,m13,m21,m22,m23,m31,m32,m33) # create the transformation by entering components 
. RA=Transform3D(0,0,25); # Default is the ZXZ convention . RA=Transform3D(EULER_SPIDER,0,0,25); # This is the typical ZYZ convention . RA=Transform3D(m11,m12,m13,m21,m22,m23,m31,m32,m33) # create the transformation by entering . components 
Line 14:  Line 17: 
RA = Transform3D(); # this creates the 3D identity matrix RA.set_rotation(0,0,25); # creates a matrix that will rotate 2D images by 25 degrees RA.set_posttrans(Vec3f(1,0,0)); # the matrix will now also shift 1 pixel in the xdirection RA.set_scale(1); # Occaisionally one will wish to rescale. 
. RA = Transform3D(); # this creates the 3D identity matrix . RA.set_rotation(0,0,25); # creates a matrix that will rotate 2D images by 25 degrees . RA.set_posttrans(Vec3f(1,0,0)); # the matrix will now also shift 1 pixel in the xdirection . RA.set_scale(1); # Occaisionally one will wish to rescale. . The following code will multiple (combine) two sets of Eulerian angles: . a=even_angles(2.,symmetry='d4',method="P",phiEqpsi = "Zero") . R2 = Transform3D(EULER_SPIDER,90.,0.,0.) . for i in xrange(len(a)): . R1 = Transform3D(EULER_SPIDER,a[i][0],a[i][1],a[i][2]) . R3=R1*R2 . compeuler = R3.get_rotation(EULER_SPIDER) . compphi = compeuler["phi"] ; compphi = (compphi +360.0)%360.0 . comptheta = compeuler["theta"]; comptheta = (comptheta+360.0)%360.0 . comppsi = compeuler["psi"]; comppsi = (comppsi +360.0)%360.0 . print a[i] . print compphi,comptheta,comppsi 
Line 19:  Line 43: 
a) We could have used EMAN, IMAGIC, SPIN, QUATERNION, SGIROT, MRC, XYZ, MATRIX instead of the SPIDER of EULER_SPIDER above. b) There is also a set_rotation via a dictionary object, which we will explain at length soon. c) The first two lines of the second block of commands, could have been written as the second line of the first block of commands. d) There are corresponding "get" calls to extract the information from the matrices. SPARX has some of its own, that are wrappers for these get calls. More later. 
. a) We could have used EMAN, IMAGIC, SPIN, QUATERNION, SGIROT, MRC, XYZ, MATRIX instead of the SPIDER of EULER_SPIDER above. . b) There is also a set_rotation via a dictionary object, which we will explain at length soon. . c) The first two lines of the second block of commands, could have been written as the second line of the first block of commands. This command sets RA to a rotation that rotates a 2D image by 25 degrees around the Zaxis. . d) There are corresponding "get" calls to extract the information from the transformation matrices. SPARX has some of its own, that are wrappers for these get calls. More later. 
Line 36:  Line 61: 
Line 39:  Line 65: 
Name
Transform Class
Usage
Examples
Here are some examples of creating a Transform3D object. Much more here: [http://blake.bcm.edu/emanwiki/Eman2TransformInPython].
All angles are in degrees
Creating just rotations:
 RA=Transform3D(0,0,25); # Default is the ZXZ convention
 RA=Transform3D(EULER_SPIDER,0,0,25); # This is the typical ZYZ convention
 RA=Transform3D(m11,m12,m13,m21,m22,m23,m31,m32,m33) # create the transformation by entering
 components
Creating more complicated transformations using set :
 RA = Transform3D(); # this creates the 3D identity matrix
 RA.set_rotation(0,0,25); # creates a matrix that will rotate 2D images by 25 degrees
 RA.set_posttrans(Vec3f(1,0,0)); # the matrix will now also shift 1 pixel in the xdirection
 RA.set_scale(1); # Occaisionally one will wish to rescale.
The following code will multiple (combine) two sets of Eulerian angles:
 a=even_angles(2.,symmetry='d4',method="P",phiEqpsi = "Zero")
 R2 = Transform3D(EULER_SPIDER,90.,0.,0.)
 for i in xrange(len(a)):
 R1 = Transform3D(EULER_SPIDER,a[i][0],a[i][1],a[i][2])
 R3=R1*R2
 compeuler = R3.get_rotation(EULER_SPIDER)
 compphi = compeuler["phi"] ; compphi = (compphi +360.0)%360.0
 comptheta = compeuler["theta"]; comptheta = (comptheta+360.0)%360.0
 comppsi = compeuler["psi"]; comppsi = (comppsi +360.0)%360.0
 print a[i]
 print compphi,comptheta,comppsi
Notes:
 a) We could have used EMAN, IMAGIC, SPIN, QUATERNION, SGIROT, MRC, XYZ, MATRIX instead of the SPIDER of EULER_SPIDER above.
 b) There is also a set_rotation via a dictionary object, which we will explain at length soon.
 c) The first two lines of the second block of commands, could have been written as the second line of the first block of commands. This command sets RA to a rotation that rotates a 2D image by 25 degrees around the Zaxis.
 d) There are corresponding "get" calls to extract the information from the transformation matrices. SPARX has some of its own, that are wrappers for these get calls. More later.
Description
Purpose: to apply rotation/shift/scaling operations for 2D or 3D images via a variety of methods.
Author
P. R. Baldwin
Maintainer
P. R. Baldwin
Keywords
 category 1
 FUNDAMENTALS
Files
libEM
See also
Maturity
Infancy