EMAN2
Public Member Functions | Static Public Member Functions | Static Public Attributes | Private Member Functions | List of all members
EMAN::EvenOrientationGenerator Class Reference

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. More...

#include <symmetry.h>

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

Public Member Functions

 EvenOrientationGenerator ()
 
virtual ~EvenOrientationGenerator ()
 
virtual string get_name () const
 Return "even". More...
 
virtual string get_desc () const
 Get a description. More...
 
virtual TypeDict get_param_types () const
 Get a dictionary containing the permissable parameters of this class. More...
 
virtual vector< Transformgen_orientations (const Symmetry3D *const sym) const
 Generate even distributed orientations in the asymmetric unit of the symmetry. More...
 
- Public Member Functions inherited from EMAN::OrientationGenerator
 OrientationGenerator ()
 
virtual ~OrientationGenerator ()
 
bool add_orientation (vector< Transform > &v, const float &az, const float &alt) const
 This functions adds one or more Transform objects to the vector v, depending on the parameters stored in the dictionary (which the inheriting class may include by initializing the typedict in get_param_types by calling. More...
 
float get_optimal_delta (const Symmetry3D *const sym, const int &n) const
 This function gets the optimal value of the delta (or angular spacing) of the orientations based on a desired total number of orientations (n). More...
 
- Public Member Functions inherited from EMAN::FactoryBase
 FactoryBase ()
 
virtual ~FactoryBase ()
 
Dict get_params () const
 get a copy of the parameters of this class More...
 
void set_params (const Dict &new_params)
 Set new parameters. More...
 
void set_param (const string key, const EMObject val)
 
void insert_params (const Dict &new_params)
 Insert parameters. More...
 
Dict copy_relevant_params (const FactoryBase *const that) const
 

Static Public Member Functions

static OrientationGeneratorNEW ()
 Factory support function NEW. More...
 

Static Public Attributes

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

Private Member Functions

 EvenOrientationGenerator (const EvenOrientationGenerator &)
 Disallow copy construction. More...
 
EvenOrientationGeneratoroperator= (const EvenOrientationGenerator &)
 Disallow assignment. More...
 
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. More...
 

Additional Inherited Members

- Protected Member Functions inherited from EMAN::OrientationGenerator
void get_az_max (const Symmetry3D *const sym, const float &altmax, const bool inc_mirror, const float &alt_iterator, const float &h, bool &d_odd_mirror_flag, float &azmax_adjusted) const
 
- Protected Attributes inherited from EMAN::FactoryBase
Dict params
 This is the dictionary the stores the parameters of the object. More...
 

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 1299 of file symmetry.h.

Constructor & Destructor Documentation

◆ EvenOrientationGenerator() [1/2]

EMAN::EvenOrientationGenerator::EvenOrientationGenerator ( )
inline

Definition at line 1302 of file symmetry.h.

1302{}

Referenced by NEW().

◆ ~EvenOrientationGenerator()

virtual EMAN::EvenOrientationGenerator::~EvenOrientationGenerator ( )
inlinevirtual

Definition at line 1303 of file symmetry.h.

1303{}

◆ EvenOrientationGenerator() [2/2]

EMAN::EvenOrientationGenerator::EvenOrientationGenerator ( const EvenOrientationGenerator )
private

Disallow copy construction.

Member Function Documentation

◆ gen_orientations()

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

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

Parameters
symthe 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 634 of file symmetry.cpp.

635{
636 float delta = params.set_default("delta", 0.0f);
637 int n = params.set_default("n", 0);
638
639 if ( delta <= 0 && n <= 0 ) throw InvalidParameterException("Error, you must specify a positive non-zero delta or n");
640 if ( delta > 0 && n > 0 ) throw InvalidParameterException("Error, the delta and the n arguments are mutually exzclusive");
641
642 if ( n > 0 ) {
643 delta = get_optimal_delta(sym,n);
644 }
645
646 bool inc_mirror = params.set_default("inc_mirror",false);
647 Dict delimiters = sym->get_delimiters(inc_mirror);
648 float altmax = delimiters["alt_max"];
649 float azmax = delimiters["az_max"];
650
651 float altmin = 0.0f;
652 // If it's a h symmetry then the alt iterator starts at very close
653 // to the altmax... the object is a h symmetry then it knows its alt_min...
654 if (sym->is_h_sym()) altmin = delimiters["alt_min"];
655
656 vector<Transform> ret;
657
658 for (float alt = altmin; alt <= altmax; alt += delta) {
659 float detaz;
660 int lt;
661 if ((0.0f == alt)||(180.0f == alt)) detaz = 360.0f;
662 else detaz = delta/(float)sin(alt*EMConsts::deg2rad);
663// bool d_odd_mirror_flag = false;
664// get_az_max(sym,altmax, inc_mirror,alt, lt,d_odd_mirror_flag, detaz);
665
666 float az = 0.0;
667 while (az<azmax) {
668 if (sym->is_platonic_sym()) {
669 if ( sym->is_in_asym_unit(alt, az, inc_mirror) ) add_orientation(ret,az+sym->get_az_alignment_offset(),alt);
670 } else add_orientation(ret,az,alt);
671 if ( sym->is_h_sym() && inc_mirror && alt != altmin ) {
672 add_orientation(ret, az, 2.0f*altmin-alt);
673 }
674 az += detaz;
675 }
676 }
677
678 return ret;
679}
Dict is a dictionary to store <string, EMObject> pair.
Definition: emobject.h:385
type set_default(const string &key, type val)
Default setting behavior This can be achieved using a template - d.woolford Jan 2008 (before there wa...
Definition: emobject.h:569
static const double deg2rad
Definition: emobject.h:78
Dict params
This is the dictionary the stores the parameters of the object.
Definition: emobject.h:953
bool add_orientation(vector< Transform > &v, const float &az, const float &alt) const
This functions adds one or more Transform objects to the vector v, depending on the parameters stored...
Definition: symmetry.cpp:273
float get_optimal_delta(const Symmetry3D *const sym, const int &n) const
This function gets the optimal value of the delta (or angular spacing) of the orientations based on a...
Definition: symmetry.cpp:236
virtual bool is_h_sym() const
A function that is used to determine if this is a Helical symmetry object This function is only virtu...
Definition: symmetry.h:100
virtual bool is_platonic_sym() const
A function that is used to determine if this is a platonic symmetry object This function is only virt...
Definition: symmetry.h:94
virtual bool is_in_asym_unit(const float &altitude, const float &azimuth, const bool inc_mirror) const =0
A function to be used when generating orientations over portion of the unit sphere defined by paramet...
virtual Dict get_delimiters(const bool inc_mirror=false) const =0
Every Symmetry3D object must return a dictionary containing the delimiters that define its asymmetric...
virtual float get_az_alignment_offset() const
This functionality is only relevant to platonic symmetries.
Definition: symmetry.h:86
#define InvalidParameterException(desc)
Definition: exception.h:361

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().

◆ get_desc()

virtual string EMAN::EvenOrientationGenerator::get_desc ( ) const
inlinevirtual

Get a description.

Returns
a clear desciption of this class

Implements EMAN::FactoryBase.

Definition at line 1322 of file symmetry.h.

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

◆ get_name()

virtual string EMAN::EvenOrientationGenerator::get_name ( ) const
inlinevirtual

Return "even".

Returns
the unique name of this class

Implements EMAN::FactoryBase.

Definition at line 1317 of file symmetry.h.

1317{ return NAME; }
static const string NAME
The name of this class - used to access it from factories etc. Should be "icos".
Definition: symmetry.h:1344

References NAME.

◆ get_orientations_tally()

int EvenOrientationGenerator::get_orientations_tally ( const Symmetry3D *const  sym,
const float &  delta 
) const
privatevirtual

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

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

Implements EMAN::OrientationGenerator.

Definition at line 591 of file symmetry.cpp.

592{
593 bool inc_mirror = params.set_default("inc_mirror",false);
594 Dict delimiters = sym->get_delimiters(inc_mirror);
595 float altmax = delimiters["alt_max"];
596 float azmax = delimiters["az_max"];
597
598 float altmin = 0.0f;
599 // #If it's a h symmetry then the alt iterator starts at very close
600 // #to the altmax... the object is a h symmetry then it knows its alt_min...
601 if (sym->is_h_sym()) altmin = delimiters["alt_min"];
602
603 int tally = 0;
604
605 for (float alt = altmin; alt <= altmax; alt += delta) {
606 float detaz;
607 int lt;
608 if ((0.0f == alt)||(180.0f == alt)) {
609 detaz = 360.0f;
610 lt = 1;
611 } else {
612 detaz = delta/(float)sin(alt*EMConsts::deg2rad);
613 lt = int(azmax/detaz)-1;
614 if (lt < 1) lt = 1;
615 detaz = azmax/(float)lt;
616 }
617// bool d_odd_mirror_flag = false;
618// get_az_max(sym,altmax, inc_mirror,alt, lt,d_odd_mirror_flag, detaz);
619 for (int i = 0; i < lt; i++) {
620 float az = (float)i*detaz;
621 if (sym->is_platonic_sym()) {
622 if ( sym->is_in_asym_unit(alt, az,inc_mirror) == false ) continue;
623 }
624 tally++;
625 if ( sym->is_h_sym() && inc_mirror && alt != altmin ) {
626 tally++;
627 }
628 }
629 }
630
631 return tally;
632}

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().

◆ get_param_types()

virtual TypeDict EMAN::EvenOrientationGenerator::get_param_types ( ) const
inlinevirtual

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 1328 of file symmetry.h.

1329 {
1331 d.put("delta", EMObject::FLOAT, "The angular separation of orientations in degrees. This option is mutually exclusively of the n argument.");
1332 d.put("inc_mirror", EMObject::BOOL, "Indicates whether or not to include the mirror portion of the asymmetric unit. Default is false.");
1333 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.");
1334 return d;
1335 }
virtual TypeDict get_param_types() const
Definition: symmetry.h:1011

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

◆ NEW()

static OrientationGenerator * EMAN::EvenOrientationGenerator::NEW ( )
inlinestatic

Factory support function NEW.

Returns
a newly instantiated class of this type

Definition at line 1308 of file symmetry.h.

1309 {
1310 return new EvenOrientationGenerator();
1311 }

References EvenOrientationGenerator().

◆ operator=()

EvenOrientationGenerator & EMAN::EvenOrientationGenerator::operator= ( const EvenOrientationGenerator )
private

Disallow assignment.

Member Data Documentation

◆ NAME

const string EvenOrientationGenerator::NAME = "even"
static

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

Definition at line 1344 of file symmetry.h.

Referenced by get_name().


The documentation for this class was generated from the following files: