EMAN::SaffOrientationGenerator Class Reference

Saff orientation generator - based on the work of Saff and Kuijlaars, 1997 E.B. More...

#include <symmetry.h>

Inheritance diagram for EMAN::SaffOrientationGenerator:

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

Collaboration graph
[legend]
List of all members.

Public Member Functions

 SaffOrientationGenerator ()
virtual ~SaffOrientationGenerator ()
virtual string get_name () const
 Return "saff".
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 Saff 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 = "saff"
 The name of this class - used to access it from factories etc. Should be "icos".

Private Member Functions

 SaffOrientationGenerator (const SaffOrientationGenerator &)
 Disallow copy construction.
SaffOrientationGeneratoroperator= (const SaffOrientationGenerator &)
 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

Saff orientation generator - based on the work of Saff and Kuijlaars, 1997 E.B.

Saff and A.B.J. Kuijlaars, Distributing many points on a sphere, Mathematical Intelligencer 19 (1997), pp. 5–11. This is a spiral based approach

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

Definition at line 1230 of file symmetry.h.


Constructor & Destructor Documentation

EMAN::SaffOrientationGenerator::SaffOrientationGenerator (  )  [inline]

Definition at line 1233 of file symmetry.h.

Referenced by NEW().

01233 {}

virtual EMAN::SaffOrientationGenerator::~SaffOrientationGenerator (  )  [inline, virtual]

Definition at line 1234 of file symmetry.h.

01234 {}

EMAN::SaffOrientationGenerator::SaffOrientationGenerator ( const SaffOrientationGenerator  )  [private]

Disallow copy construction.


Member Function Documentation

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

Generate Saff 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 639 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(), EMAN::FactoryBase::get_params(), InvalidParameterException, EMAN::Symmetry3D::is_h_sym(), EMAN::Symmetry3D::is_in_asym_unit(), EMAN::Symmetry3D::is_platonic_sym(), EMAN::FactoryBase::params, EMAN::EMConsts::rad2deg, EMAN::Dict::set_default(), and sqrt().

00640 {
00641         float delta = params.set_default("delta", 0.0f);
00642         int n = params.set_default("n", 0);
00643 
00644         if ( delta <= 0 && n <= 0 ) throw InvalidParameterException("Error, you must specify a positive non-zero delta or n");
00645         if ( delta > 0 && n > 0 ) throw InvalidParameterException("Error, the delta and the n arguments are mutually exclusive");
00646 
00647         if ( n > 0 ) {
00648                 delta = get_optimal_delta(sym,n);
00649         }
00650 
00651 //      if ( sym->is_platonic_sym() ) return gen_platonic_orientations(sym, delta);
00652 
00653         bool inc_mirror = params.set_default("inc_mirror",false);
00654         Dict delimiters = sym->get_delimiters(inc_mirror);
00655         float altmax = delimiters["alt_max"];
00656         float azmax = delimiters["az_max"];
00657 
00658         float altmin = 0.0f;
00659         // #If it's a h symmetry then the alt iterator starts at very close
00660         // #to the altmax... the object is a h symmetry then it knows its alt_min...
00661         if (sym->is_h_sym()){
00662                 altmin = delimiters["alt_min"];
00663                 if (inc_mirror) {
00664                         altmin -= (float) sym->get_params()["equator_range"];
00665                 }
00666         }
00667 
00668         float Deltaz = (float)(cos(altmax*EMConsts::deg2rad)-cos(altmin*EMConsts::deg2rad));
00669         float s = delta*M_PI/180.0f;
00670         float NFactor = 3.6f/s;
00671         float wedgeFactor = fabs( Deltaz*(azmax)/720.0f) ;
00672         int NumPoints   =  static_cast<int> (NFactor*NFactor*wedgeFactor);
00673 
00674         vector<Transform> ret;
00675 
00676         if (!sym->is_h_sym()) add_orientation(ret,0,0);
00677         float az = 0.0f;
00678         float dz = (float)cos(altmin*EMConsts::deg2rad);
00679         for(int i = 1; i < NumPoints; ++i ){
00680                 float z = dz + Deltaz* (float)i/ float(NumPoints-1);
00681                 float r= sqrt(1.0f-z*z);
00682                 az = fmod(az + delta/r,azmax);
00683                 float alt = (float)(acos(z)*EMConsts::rad2deg);
00684                 if (sym->is_platonic_sym()) {
00685                         if ( sym->is_in_asym_unit(alt,az,inc_mirror) == false ) continue;
00686                         else {
00687                                 az += sym->get_az_alignment_offset(); // Align to the symmetry axes
00688                         }
00689                 }
00690                 add_orientation(ret,az,alt);
00691         }
00692 
00693         return ret;
00694 }

virtual string EMAN::SaffOrientationGenerator::get_desc (  )  const [inline, virtual]

Get a description.

Returns:
a clear desciption of this class

Implements EMAN::FactoryBase.

Definition at line 1252 of file symmetry.h.

01252 { return "Generate quasi-evenly distributed orientations within an asymmetric unit using a spiraling method attributed to Saff"; }

virtual string EMAN::SaffOrientationGenerator::get_name (  )  const [inline, virtual]

Return "saff".

Returns:
the unique name of this class

Implements EMAN::FactoryBase.

Definition at line 1247 of file symmetry.h.

References NAME.

01247 { return NAME; }

int SaffOrientationGenerator::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 598 of file symmetry.cpp.

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

00599 {
00600         bool inc_mirror = params.set_default("inc_mirror",false);
00601         Dict delimiters = sym->get_delimiters(inc_mirror);
00602         float altmax = delimiters["alt_max"];
00603         float azmax = delimiters["az_max"];
00604 
00605         float altmin = 0.0f;
00606         // #If it's a h symmetry then the alt iterator starts at very close
00607         // #to the altmax... the object is a h symmetry then it knows its alt_min...
00608         if (sym->is_h_sym()){
00609                 altmin = delimiters["alt_min"];
00610                 if (inc_mirror) {
00611                         altmin -= (float) sym->get_params()["equator_range"];
00612                 }
00613         }
00614 
00615         float Deltaz = (float)(cos(altmax*EMConsts::deg2rad)-cos(altmin*EMConsts::deg2rad));
00616         float s = delta*M_PI/180.0f;
00617         float NFactor = 3.6f/s;
00618         float wedgeFactor = fabs( Deltaz*(azmax)/720.0f) ;
00619         int NumPoints   =  static_cast<int> (NFactor*NFactor*wedgeFactor);
00620 
00621         int tally = 0;
00622         if (!sym->is_h_sym()) ++tally;
00623         float az = 0.0f;
00624         float dz = (float)cos(altmin*EMConsts::deg2rad);
00625         for(int i = 1; i < NumPoints; ++i ){
00626                 float z = dz + Deltaz* (float)i/ float(NumPoints-1);
00627                 float r= sqrt(1.0f-z*z);
00628                 az = fmod(az + delta/r,azmax);
00629                 float alt = (float)(acos(z)*EMConsts::rad2deg);
00630                 if (sym->is_platonic_sym()) {
00631                         if ( sym->is_in_asym_unit(alt,az,inc_mirror) == false ) continue;
00632                 }
00633                 tally++;
00634         }
00635 
00636         return tally;
00637 }

virtual TypeDict EMAN::SaffOrientationGenerator::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 1258 of file symmetry.h.

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

01259                 {
01260                         TypeDict d = OrientationGenerator::get_param_types();
01261                         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.");
01262                         d.put("inc_mirror", EMObject::BOOL, "Indicates whether or not to include the mirror portion of the asymmetric unit. Default is false.");
01263                         d.put("delta", EMObject::FLOAT, "The angular separation of orientations in degrees. This option is mutually exclusively of the n argument.");
01264                         return d;
01265                 }

static OrientationGenerator* EMAN::SaffOrientationGenerator::NEW (  )  [inline, static]

Factory support function NEW.

Returns:
a newly instantiated class of this type

Definition at line 1239 of file symmetry.h.

References SaffOrientationGenerator().

01240                 {
01241                         return new SaffOrientationGenerator();
01242                 }

SaffOrientationGenerator& EMAN::SaffOrientationGenerator::operator= ( const SaffOrientationGenerator  )  [private]

Disallow assignment.


Member Data Documentation

const string SaffOrientationGenerator::NAME = "saff" [static]

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

Definition at line 1274 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:18:21 2010 for EMAN2 by  doxygen 1.4.7