Differences between revisions 5 and 15 (spanning 10 versions)
Revision 5 as of 2009-03-28 16:07:19
Size: 791
Comment:
Revision 15 as of 2009-04-16 17:13:32
Size: 4472
Comment:
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
<<TableOfContents>>

= Quickly make a projection =
Line 16: Line 20:

== If you have CUDA enabled ==

Although use of the GPU will eventually become automatic, currently you can only make use of the CUDA accelerated projector by explicitly specifying ''cuda_standard'' when calling project. For example

{{{#!python
a = test_image_3d(1)
proj = a.project("cuda_standard",Transform())
}}}

This can be up to 100x faster.

= Generating projections in an asymmetric unit =

EMAN2 has the concept of a[[http://blake.bcm.edu/eman2/doxygen_html/classEMAN_1_1Symmetry3D.html| Symmetry3D]] object and an[[http://blake.bcm.edu/eman2/doxygen_html/classEMAN_1_1OrientationGenerator.html| Orientation Generation ]] object. These two objections can be used interchangeably for generating orientations in an asymmetric unit. Using the Symmetry3D object is the most common way of generating projections (the first method, below).

== Using a Symmetry3D object ==

First get a list of Transform objects
{{{#!python
sym = Symmetries.get("c3") # works for all symmetries, e.g. "tet", "d8" etc
orients = sym.gen_orientations("eman",{"delta":3})
}}}

Then iterate through the list of tranforms (''orients'') and make the projections

{{{#!python
a = test_image_3d(1)
data = [a.project("standard",t) for t in orients]
display(data)
}}}

Note the EMAN2 is sophisticated enough to exclude or include the mirror portion of the asymmetric unit (by default it is off). To turn it on use syntax like this:

{{{#!python
orients = sym.gen_orientations("eman",{"delta":3,"inc_mirror":True}) # include mirror portion of the asymmetric unit
}}}

Also, you can have the Symmetry3D object try to generate a specific number of projections using this syntax:

{{{#!python
orients = sym.gen_orientations("eman",{"n":101}) # Generate 101 orientations
}}}

However the return number maybe slightly fewer or slightly greater than the requested number, depending on the orientation generation strategy used (see below for different strategies).

== Using an Orientation Generator object ==

Using an Orientation Generator object for generating projections in the asymmetric unit is less favoured than using a Symmetry3D, but it may be more convenient in some situations. To generate orientations over the asymmetric unit using this approach use this syntax:

{{{#!python
og = OrientGens.get("eman",{"delta":3,"inc_mirror":True})
sym = Symmetries.get("d7")
orients = og.gen_orientations(sym)
}}}

And then iterate through '''orients''' to generate the projections (as above).


In total there are five orientation generation methodologies. For the purpose of single particle reconstruction it is recommended that people use the '''eman''' strategy, which is more or less that strategy used in EMAN1. The method used by Sparx is available (but not maintained), it is called '''even'''. Also the Saff ('''saff''') method is available (which is a
spiralling method), a randomized optimization ('''opt''') scheme is available which works well for C1 symmetries only. Finally it is possible to generate random orientations inside asymmetric units ('''rand'''), but note that the random orientation generator can currently not exclude the mirror portion of the asymmetric unit.

{{{#!python
ogs = OrientGens.get("saff",{"delta":3,"inc_mirror":True})
oge = OrientGens.get("even",{"delta":3,"inc_mirror":True})
ogo = OrientGens.get("opt",{"delta":3,"inc_mirror":True})
ogr = OrientGens.get("rand",{"n":100}) # rand works only with n, and can not exclude the mirror portion
}}}

Also note that the '''rand''' orientation generator does not work with the "delta" argument.

Quickly make a projection

To make a projection you must have your 3D model loaded into python, and you must be able to define your projection direction as a Transform object. See Using the EMAN2 Transform class and the Transform turorial page for more information on the Transform object. Also, for more information on Euler angles see the Sparx wiki page.

   1 # get a test model
   2 a = test_image_3d(1)
   3 # alternatively load yours from disk
   4 a = EMData("mymodel.mrc")
   5 # make a projection along the z axis
   6 proj = a.project("standard",Transform())
   7 # Another way of making a projection..
   8 t = Transform({"type":"eman","alt":15})
   9 proj2 = a.project("standard",t) 
  10 display([proj,proj2])

If you have CUDA enabled

Although use of the GPU will eventually become automatic, currently you can only make use of the CUDA accelerated projector by explicitly specifying cuda_standard when calling project. For example

   1 a = test_image_3d(1)
   2 proj = a.project("cuda_standard",Transform())

This can be up to 100x faster.

Generating projections in an asymmetric unit

EMAN2 has the concept of aSymmetry3D object and anOrientation Generation object. These two objections can be used interchangeably for generating orientations in an asymmetric unit. Using the Symmetry3D object is the most common way of generating projections (the first method, below).

Using a Symmetry3D object

First get a list of Transform objects

   1 sym = Symmetries.get("c3") # works for all symmetries, e.g. "tet", "d8" etc
   2 orients = sym.gen_orientations("eman",{"delta":3})

Then iterate through the list of tranforms (orients) and make the projections

   1 a = test_image_3d(1)
   2 data = [a.project("standard",t) for t in orients]
   3 display(data)

Note the EMAN2 is sophisticated enough to exclude or include the mirror portion of the asymmetric unit (by default it is off). To turn it on use syntax like this:

   1 orients = sym.gen_orientations("eman",{"delta":3,"inc_mirror":True}) # include mirror portion of the asymmetric unit

Also, you can have the Symmetry3D object try to generate a specific number of projections using this syntax:

   1 orients = sym.gen_orientations("eman",{"n":101}) # Generate 101 orientations

However the return number maybe slightly fewer or slightly greater than the requested number, depending on the orientation generation strategy used (see below for different strategies).

Using an Orientation Generator object

Using an Orientation Generator object for generating projections in the asymmetric unit is less favoured than using a Symmetry3D, but it may be more convenient in some situations. To generate orientations over the asymmetric unit using this approach use this syntax:

   1 og = OrientGens.get("eman",{"delta":3,"inc_mirror":True})
   2 sym = Symmetries.get("d7")
   3 orients = og.gen_orientations(sym)

And then iterate through orients to generate the projections (as above).

In total there are five orientation generation methodologies. For the purpose of single particle reconstruction it is recommended that people use the eman strategy, which is more or less that strategy used in EMAN1. The method used by Sparx is available (but not maintained), it is called even. Also the Saff (saff) method is available (which is a spiralling method), a randomized optimization (opt) scheme is available which works well for C1 symmetries only. Finally it is possible to generate random orientations inside asymmetric units (rand), but note that the random orientation generator can currently not exclude the mirror portion of the asymmetric unit.

   1 ogs = OrientGens.get("saff",{"delta":3,"inc_mirror":True})
   2 oge = OrientGens.get("even",{"delta":3,"inc_mirror":True})
   3 ogo = OrientGens.get("opt",{"delta":3,"inc_mirror":True})
   4 ogr = OrientGens.get("rand",{"n":100}) # rand works only with n, and can not exclude the mirror portion

Also note that the rand orientation generator does not work with the "delta" argument.

EMAN2/Tutorials/make_a_projection (last edited 2022-02-18 00:31:06 by TunayDurmaz)