Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

EMAN::EvenOrientationGenerator Class Reference

Sparx even orientation generator - see util_sparx.cpp - Util::even_angles(. More...

#include <symmetry.h>

Inheritance diagram for EMAN::EvenOrientationGenerator:

Inheritance graph
[legend]
Collaboration diagram for EMAN::EvenOrientationGenerator:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 EvenOrientationGenerator ()
virtual ~EvenOrientationGenerator ()
virtual string get_name () const
 Return "even".
virtual string get_desc () const
 Get a description.
virtual TypeDict get_param_types () const
 Get a dictionary containing the permissable parameters of this class.
virtual vector< Transformgen_orientations (const Symmetry3D *const sym) const
 Generate even distributed orientations in the asymmetric unit of the symmetry.

Static Public Member Functions

static OrientationGeneratorNEW ()
 Factory support function NEW.

Static Public Attributes

static const string NAME = "even"
 The name of this class - used to access it from factories etc. Should be "icos".

Private Member Functions

 EvenOrientationGenerator (const EvenOrientationGenerator &)
 Disallow copy construction.
EvenOrientationGeneratoroperator= (const EvenOrientationGenerator &)
 Disallow assignment.
virtual int get_orientations_tally (const Symmetry3D *const sym, const float &delta) const
 This function returns how many orientations will be generated for a given delta (angular spacing) It does this by simulated gen_orientations.

Detailed Description

Sparx even orientation generator - see util_sparx.cpp - Util::even_angles(.

..) This orientation generator is based on work presented in Penczek et al., 1994 P.A. Penczek, R.A. Grassucci and J. Frank, The ribosome at improved resolution: new techniques for merging and orientation refinement in 3D cryo-electron microscopy of biological particles, Ultramicroscopy 53 (1994).

This is a proportional approach very similar to the eman approach - the differences between these two approaches is mostly visible near altitude=0

Author:
David Woolford (ported directly from Sparx utilities.py, which is written by Pawel Penczek)
Date:
March 2008

Definition at line 1164 of file symmetry.h.


Constructor & Destructor Documentation

EMAN::EvenOrientationGenerator::EvenOrientationGenerator  )  [inline]
 

Definition at line 1167 of file symmetry.h.

Referenced by NEW().

01167 {}

virtual EMAN::EvenOrientationGenerator::~EvenOrientationGenerator  )  [inline, virtual]
 

Definition at line 1168 of file symmetry.h.

01168 {}

EMAN::EvenOrientationGenerator::EvenOrientationGenerator const EvenOrientationGenerator  )  [private]
 

Disallow copy construction.


Member Function Documentation

vector< Transform > EvenOrientationGenerator::gen_orientations const Symmetry3D *const   sym  )  const [virtual]
 

Generate even distributed orientations in the asymmetric unit of the symmetry.

Parameters:
sym the symmetry which defines the interesting asymmetric unit
Returns:
a vector of Transform objects containing the set of evenly distributed orientations

Implements EMAN::OrientationGenerator.

Definition at line 541 of file symmetry.cpp.

References EMAN::OrientationGenerator::add_orientation(), EMAN::EMConsts::deg2rad, EMAN::Symmetry3D::get_az_alignment_offset(), EMAN::Symmetry3D::get_delimiters(), EMAN::OrientationGenerator::get_optimal_delta(), InvalidParameterException, EMAN::Symmetry3D::is_h_sym(), EMAN::Symmetry3D::is_in_asym_unit(), EMAN::Symmetry3D::is_platonic_sym(), EMAN::FactoryBase::params, and EMAN::Dict::set_default().

00542 {
00543         float delta = params.set_default("delta", 0.0f);
00544         int n = params.set_default("n", 0);
00545 
00546         if ( delta <= 0 && n <= 0 ) throw InvalidParameterException("Error, you must specify a positive non-zero delta or n");
00547         if ( delta > 0 && n > 0 ) throw InvalidParameterException("Error, the delta and the n arguments are mutually exzclusive");
00548 
00549         if ( n > 0 ) {
00550                 delta = get_optimal_delta(sym,n);
00551         }
00552 
00553         bool inc_mirror = params.set_default("inc_mirror",false);
00554         Dict delimiters = sym->get_delimiters(inc_mirror);
00555         float altmax = delimiters["alt_max"];
00556         float azmax = delimiters["az_max"];
00557 
00558         float altmin = 0.0f;
00559         // If it's a h symmetry then the alt iterator starts at very close
00560         // to the altmax... the object is a h symmetry then it knows its alt_min...
00561         if (sym->is_h_sym()) altmin = delimiters["alt_min"];
00562 
00563         vector<Transform> ret;
00564 
00565         for (float alt = altmin; alt <= altmax; alt += delta) {
00566                 float detaz;
00567                 int lt;
00568                 if ((0.0f == alt)||(180.0f == alt)) {
00569                         detaz = 360.0f;
00570                         lt = 1;
00571                 } else {
00572                         detaz = delta/(float)sin(alt*EMConsts::deg2rad);
00573                         lt = int(azmax/detaz)-1;
00574                         if (lt < 1) lt = 1;
00575                         detaz = azmax/(float)lt;
00576                 }
00577 //              bool d_odd_mirror_flag = false;
00578 //              get_az_max(sym,altmax, inc_mirror,alt, lt,d_odd_mirror_flag, detaz);
00579 
00580                 for (int i = 0; i < lt; i++) {
00581                         float az = (float)i*detaz;
00582                         if (sym->is_platonic_sym()) {
00583                                 if ( sym->is_in_asym_unit(alt, az,inc_mirror) == false ) continue;
00584                                 else {
00585                                         az += sym->get_az_alignment_offset(); // Align to the symmetry axes
00586                                 }
00587                         }
00588                         add_orientation(ret,az,alt);
00589                         if ( sym->is_h_sym() && inc_mirror && alt != altmin ) {
00590                                 add_orientation(ret,az,2.0f*altmin-alt);
00591                         }
00592                 }
00593         }
00594 
00595         return ret;
00596 }

virtual string EMAN::EvenOrientationGenerator::get_desc  )  const [inline, virtual]
 

Get a description.

Returns:
a clear desciption of this class

Implements EMAN::FactoryBase.

Definition at line 1187 of file symmetry.h.

01187 { return "Generate quasi-evenly distributed orientations within an asymmetric unit using Penczek's (94) approach"; }

virtual string EMAN::EvenOrientationGenerator::get_name  )  const [inline, virtual]
 

Return "even".

Returns:
the unique name of this class

Implements EMAN::FactoryBase.

Definition at line 1182 of file symmetry.h.

References NAME.

01182 { return NAME; }

int EvenOrientationGenerator::get_orientations_tally const Symmetry3D *const   sym,
const float &  delta
const [private, virtual]
 

This function returns how many orientations will be generated for a given delta (angular spacing) It does this by simulated gen_orientations.

Parameters:
sym the symmetry which defines the interesting asymmetric unit
delta the desired angular spacing of the orientations
Returns:
the number of orientations that will be generated using these parameters

Implements EMAN::OrientationGenerator.

Definition at line 498 of file symmetry.cpp.

References EMAN::EMConsts::deg2rad, EMAN::Symmetry3D::get_delimiters(), EMAN::Symmetry3D::is_h_sym(), EMAN::Symmetry3D::is_in_asym_unit(), EMAN::Symmetry3D::is_platonic_sym(), EMAN::FactoryBase::params, and EMAN::Dict::set_default().

00499 {
00500         bool inc_mirror = params.set_default("inc_mirror",false);
00501         Dict delimiters = sym->get_delimiters(inc_mirror);
00502         float altmax = delimiters["alt_max"];
00503         float azmax = delimiters["az_max"];
00504 
00505         float altmin = 0.0f;
00506         // #If it's a h symmetry then the alt iterator starts at very close
00507         // #to the altmax... the object is a h symmetry then it knows its alt_min...
00508         if (sym->is_h_sym()) altmin = delimiters["alt_min"];
00509 
00510         int tally = 0;
00511 
00512         for (float alt = altmin; alt <= altmax; alt += delta) {
00513                 float detaz;
00514                 int lt;
00515                 if ((0.0f == alt)||(180.0f == alt)) {
00516                         detaz = 360.0f;
00517                         lt = 1;
00518                 } else {
00519                         detaz = delta/(float)sin(alt*EMConsts::deg2rad);
00520                         lt = int(azmax/detaz)-1;
00521                         if (lt < 1) lt = 1;
00522                         detaz = azmax/(float)lt;
00523                 }
00524 //              bool d_odd_mirror_flag = false;
00525 //              get_az_max(sym,altmax, inc_mirror,alt, lt,d_odd_mirror_flag, detaz);
00526                 for (int i = 0; i < lt; i++) {
00527                         float az = (float)i*detaz;
00528                         if (sym->is_platonic_sym()) {
00529                                 if ( sym->is_in_asym_unit(alt, az,inc_mirror) == false ) continue;
00530                         }
00531                         tally++;
00532                         if ( sym->is_h_sym() && inc_mirror && alt != altmin ) {
00533                                 tally++;
00534                         }
00535                 }
00536         }
00537 
00538         return tally;
00539 }

virtual TypeDict EMAN::EvenOrientationGenerator::get_param_types  )  const [inline, virtual]
 

Get a dictionary containing the permissable parameters of this class.

Returns:
a dictionary containing the permissable parameters of this class parameters are explained in the dictionary itself

Reimplemented from EMAN::OrientationGenerator.

Definition at line 1193 of file symmetry.h.

References EMAN::EMObject::BOOL, EMAN::EMObject::FLOAT, EMAN::OrientationGenerator::get_param_types(), EMAN::EMObject::INT, and EMAN::TypeDict::put().

01194                 {
01195                         TypeDict d = OrientationGenerator::get_param_types();
01196                         d.put("delta", EMObject::FLOAT, "The angular separation of orientations in degrees. This option is mutually exclusively of the n argument.");
01197                         d.put("inc_mirror", EMObject::BOOL, "Indicates whether or not to include the mirror portion of the asymmetric unit. Default is false.");
01198                         d.put("n", EMObject::INT, "The number of orientations to generate. This option is mutually exclusively of the delta argument.Will attempt to get as close to the number specified as possible.");
01199                         return d;
01200                 }

static OrientationGenerator* EMAN::EvenOrientationGenerator::NEW  )  [inline, static]
 

Factory support function NEW.

Returns:
a newly instantiated class of this type

Definition at line 1173 of file symmetry.h.

References EvenOrientationGenerator().

01174                 {
01175                         return new EvenOrientationGenerator();
01176                 }

EvenOrientationGenerator& EMAN::EvenOrientationGenerator::operator= const EvenOrientationGenerator  )  [private]
 

Disallow assignment.


Member Data Documentation

const string EvenOrientationGenerator::NAME = "even" [static]
 

The name of this class - used to access it from factories etc. Should be "icos".

Definition at line 1209 of file symmetry.h.

Referenced by get_name().


The documentation for this class was generated from the following files:
Generated on Tue May 25 17:38:28 2010 for EMAN2 by  doxygen 1.4.4