Differences between revisions 9 and 11 (spanning 2 versions)
Revision 9 as of 2010-01-08 21:29:05
Size: 2340
Editor: penczek
Comment:
Revision 11 as of 2013-07-01 13:12:38
Size: 2440
Editor: localhost
Comment: converted to 1.6 markup
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]].
Line 15: Line 15:
 t = ima.get_attr(xform)
 d = t.get_params("2D")
 return d["alpha"],d["tx"],d["ty"],d["mirror"],d["scale"]
 . t = ima.get_attr(xform)
 . d = t.get_params("2D")
 . return d[ "alpha" ],  d[ "tx" ],  d[ "ty" ],  d[ "mirror" ],  d[ "scale" ]
Line 24: Line 24:
 t = Transform({"type":"2D","alpha":p[0],"tx":p[1],"ty":p[2],"mirror":p[3],"scale":p[4]})
 ima.set_attr(xform, t)
 . t = Transform({"type":"2D","alpha":p[0],"tx":p[1],"ty":p[2],"mirror":p[3],"scale":p[4]})
 . ima.set_attr(xform, t)
Line 32: Line 32:
 t = ima.get_attr(xform)
 d = t.get_params("spider")
 return d["phi"],d["theta"],d["psi"],d["tx"],d["ty"],d["tz"],d["mirror"],d["scale"]
 . t = ima.get_attr(xform)
 . d = t.get_params("spider")
 . return d[ "phi" ],  d[ "theta" ],  d[ "psi" ],  d[ "tx" ],  d[ "ty" ],  d[ "tz" ],  d[ "mirror" ],  d[ "scale" ]
Line 41: Line 41:
 t = Transform({"type":"spider","phi":p[0],"theta":p[1],"psi":p[2],"tx":p[3],"ty":p[4],"tz":p[5],"mirror":p[6],"scale":p[7]})
 ima.set_attr(xform, t)
 . t = Transform({"type":"spider","phi":p[0],"theta":p[1],"psi":p[2],"tx":p[3],"ty":p[4],"tz":p[5],"mirror":p[6],"scale":p[7]})
 . ima.set_attr(xform, t)
Line 49: Line 49:
 t = ima.get_attr(xform)
 d = t.get_params("spider")
 return d["phi"],d["theta"],d["psi"],-d["tx"],-d["ty"]
 . t = ima.get_attr(xform)
 . d = t.get_params("spider")
 . return d[ "phi" ],  d[ "theta" ],  d[ "psi" ],  -d[ "tx" ],  -d[ "ty" ]
Line 58: Line 58:
 t = Transform({"type":"spider","phi":p[0],"theta":p[1],"psi":p[2]})
 t.set_trans(Vec2f(-p[3], -p[4]))
 ima.set_attr(xform, t)
 . t = Transform({"type":"spider","phi":p[0],"theta":p[1],"psi":p[2]})
 . t.set_trans(Vec2f(-p[3], -p[4]))
 . ima.set_attr(xform, t)

Name

Transform Class

Usage

Examples

All angles are in degrees

def get_params2D(ima, xform = "xform.align2d"):

  • """
    • retrieve 2D alignment parameters from the header alpha tx ty mirror scale
    """
  • t = ima.get_attr(xform)
  • d = t.get_params("2D")
  • return d[ "alpha" ], d[ "tx" ], d[ "ty" ], d[ "mirror" ], d[ "scale" ]

def set_params2D(ima, p, xform = "xform.align2d"):

  • """
    • set 2D alignment parameters in the header alpha tx ty mirror scale
    """
  • t = Transform({"type":"2D","alpha":p[0],"tx":p[1],"ty":p[2],"mirror":p[3],"scale":p[4]})
  • ima.set_attr(xform, t)

def get_params3D(ima, xform = "xform.align3d"):

  • """
    • retrieve 3D alignment parameters from the header phi theta psi tx ty tz mirror scale
    """
  • t = ima.get_attr(xform)
  • d = t.get_params("spider")
  • return d[ "phi" ], d[ "theta" ], d[ "psi" ], d[ "tx" ], d[ "ty" ], d[ "tz" ], d[ "mirror" ], d[ "scale" ]

def set_params3D(ima, p, xform = "xform.align3d"):

  • """
    • set 3D alignment parameters in the header phi theta psi tx ty tz mirror scale
    """
  • t = Transform({"type":"spider","phi":p[0],"theta":p[1],"psi":p[2],"tx":p[3],"ty":p[4],"tz":p[5],"mirror":p[6],"scale":p[7]})
  • ima.set_attr(xform, t)

def get_params_proj(ima, xform = "xform.projection"):

  • """
    • retrieve projection alignment parameters from the header phi theta psi s2x s2y
    """
  • t = ima.get_attr(xform)
  • d = t.get_params("spider")
  • return d[ "phi" ], d[ "theta" ], d[ "psi" ], -d[ "tx" ], -d[ "ty" ]

def set_params_proj(ima, p, xform = "xform.projection"):

  • """
    • set projection alignment parameters in the header phi theta psi s2x s2y
    """
  • t = Transform({"type":"spider","phi":p[0],"theta":p[1],"psi":p[2]})
  • t.set_trans(Vec2f(-p[3], -p[4]))
  • ima.set_attr(xform, t)

Notes:

  • a) We could have used EMAN, IMAGIC, SPIN, QUATERNION, SGIROT, MRC, XYZ, MATRIX instead of the SPIDER of EULER_SPIDER above.

Description

Purpose: to apply rotation/shift/scaling operations for 2D or 3D images via a variety of methods.

Author

P.A. Penczek

Maintainer

P. R. Baldwin

Keywords

category 1
FUNDAMENTALS

Files

libEM

See also

Maturity

Infancy

Bugs

transformClass (last edited 2013-07-01 13:12:38 by localhost)