|Deletions are marked like this.||Additions are marked like this.|
|Line 7:||Line 7:|
|. Here are some examples of creating a Transform3D object. Much more here: [:http://blake.bcm.edu/emanwiki/Eman2TransformInPython:].||. Here are some examples of creating a Transform3D object. Much more here: [http://blake.bcm.edu/emanwiki/Eman2TransformInPython].|
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
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 x-direction
- 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],a[i],a[i])
- 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
- 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 Z-axis.
- 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.
Purpose: to apply rotation/shift/scaling operations for 2D or 3D images via a variety of methods.
P. R. Baldwin
P. R. Baldwin
- category 1