#include <symmetry.h>
Inheritance diagram for EMAN::RandomOrientationGenerator:
Public Member Functions | |
RandomOrientationGenerator () | |
virtual | ~RandomOrientationGenerator () |
virtual string | get_name () const |
Return "random". | |
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< Transform > | gen_orientations (const Symmetry3D *const sym) const |
Generate random orientations in the asymmetric unit of the symmetry. | |
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 should general do this by simulating the function gen_orientations. | |
Static Public Member Functions | |
static OrientationGenerator * | NEW () |
Factory support function NEW. | |
Static Public Attributes | |
static const string | NAME = "rand" |
The name of this class - used to access it from factories etc. | |
Private Member Functions | |
RandomOrientationGenerator (const RandomOrientationGenerator &) | |
Disallow copy construction. | |
RandomOrientationGenerator & | operator= (const RandomOrientationGenerator &) |
Disallow assignment. |
For points distributed in the unit sphere, just use the CSym type with nysm = 1. (i.e. c1 symmetry)
Definition at line 1099 of file symmetry.h.
|
Definition at line 1102 of file symmetry.h. Referenced by NEW().
|
|
Definition at line 1103 of file symmetry.h.
|
|
Disallow copy construction.
|
|
Generate random orientations in the asymmetric unit of the symmetry.
Implements EMAN::OrientationGenerator. Definition at line 453 of file symmetry.cpp. References EMAN::Util::get_frand(), EMAN::Symmetry3D::get_nsym(), InvalidParameterException, EMAN::Symmetry3D::is_c_sym(), EMAN::Symmetry3D::is_in_asym_unit(), EMAN::FactoryBase::params, phi, EMAN::EMConsts::rad2deg, EMAN::Symmetry3D::reduce(), EMAN::Dict::set_default(), t, x, and y. 00454 { 00455 int n = params.set_default("n", 0); 00456 00457 if ( n <= 0 ) throw InvalidParameterException("You must specify a positive, non zero n for the Random Orientation Generator"); 00458 00459 bool phitoo = params.set_default("phitoo", false); 00460 bool inc_mirror = params.set_default("inc_mirror", false); 00461 00462 vector<Transform> ret; 00463 00464 int i = 0; 00465 Dict d("type","eman"); 00466 while ( i < n ){ 00467 float u1 = Util::get_frand(-1.0f,1.0f); 00468 float u2 = Util::get_frand(-1.0f,1.0f); 00469 float s = u1*u1 + u2*u2; 00470 if ( s > 1.0f ) continue; 00471 float alpha = 2.0f*sqrtf(1.0f-s); 00472 float x = alpha * u1; 00473 float y = alpha * u2; 00474 float z = 2.0f*s-1.0f; 00475 00476 float altitude = (float)EMConsts::rad2deg*acos(z); 00477 float azimuth = (float)EMConsts::rad2deg*atan2(y,x); 00478 00479 float phi = 0.0f; 00480 if ( phitoo ) phi = Util::get_frand(0.0f,359.9999f); 00481 00482 d["az"] = azimuth; d["phi"] = phi; d["alt"] = altitude; 00483 Transform t(d); 00484 00485 if ( !(sym->is_c_sym() && sym->get_nsym() == 1)) t = sym->reduce(t); //reduce doesn't make sense for C1 symmetry 00486 00487 if ( !sym->is_in_asym_unit(altitude,azimuth,inc_mirror) ){ 00488 // is_in_asym_unit has returned the wrong value! 00489 // FIXME 00490 // cout << "warning, there is an unresolved issue - email D Woolford" << endl; 00491 } 00492 ret.push_back(t); 00493 i++; 00494 } 00495 return ret; 00496 }
|
|
Get a description.
Implements EMAN::FactoryBase. Definition at line 1121 of file symmetry.h.
|
|
Return "random".
Implements EMAN::FactoryBase. Definition at line 1116 of file symmetry.h. References NAME. 01116 { return NAME; }
|
|
This function returns how many orientations will be generated for a given delta (angular spacing) It should general do this by simulating the function gen_orientations.
Implements EMAN::OrientationGenerator. Definition at line 1145 of file symmetry.h.
|
|
Get a dictionary containing the permissable parameters of this class.
Reimplemented from EMAN::OrientationGenerator. Definition at line 1127 of file symmetry.h. References EMAN::EMObject::BOOL, EMAN::EMObject::INT, and EMAN::TypeDict::put(). 01128 { 01129 TypeDict d; 01130 d.put("n", EMObject::INT, "The number of orientations to generate."); 01131 d.put("inc_mirror", EMObject::BOOL, "Indicates whether or not to include the mirror portion of the asymmetric unit. Default is false."); 01132 d.put("phitoo", EMObject::BOOL, "Makes phi random as well"); 01133 return d; 01134 }
|
|
Factory support function NEW.
Definition at line 1108 of file symmetry.h. References RandomOrientationGenerator(). 01109 { 01110 return new RandomOrientationGenerator(); 01111 }
|
|
Disallow assignment.
|
|
The name of this class - used to access it from factories etc.
Definition at line 1143 of file symmetry.h. Referenced by EMAN::OptimumOrientationGenerator::gen_orientations(), and get_name(). |