#include <symmetry.h>
Inheritance diagram for EMAN::OrientationGenerator:
Public Member Functions | |
OrientationGenerator () | |
virtual | ~OrientationGenerator () |
virtual vector< Transform > | gen_orientations (const Symmetry3D *const sym) const =0 |
generate orientations given some symmetry type | |
virtual TypeDict | get_param_types () const |
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. | |
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). | |
virtual int | get_orientations_tally (const Symmetry3D *const sym, const float &delta) const =0 |
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. | |
Protected Member Functions | |
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 |
Private Member Functions | |
OrientationGenerator (const OrientationGenerator &) | |
Disallow copy construction. | |
OrientationGenerator & | operator= (const OrientationGenerator &) |
Disallow assignment. |
It inherits from a factory base, making it amenable to incorporation in EMAN2 style factories. Objects that inherit from this class must write a gen_orientations function, in addition to fulfilling the responsibilities of the FactoryBase class
Definition at line 999 of file symmetry.h.
|
Definition at line 1002 of file symmetry.h. 01002 {};
|
|
Definition at line 1003 of file symmetry.h. 01003 {};
|
|
Disallow copy construction.
|
|
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.
TypeDict d = OrientationGenerator::get_param_types(); to initialize. If phitoo is no zero, this cause extra orientations to be included in phi (in steps of phitoo). If random_phi is true, the phi of the Transform object is randomized. This function is for internal convenience of child classes.
Definition at line 269 of file symmetry.cpp. References EMAN::Util::get_frand(), InvalidValueException, phi, EMAN::Dict::set_default(), t, and v. Referenced by EMAN::OptimumOrientationGenerator::gen_orientations(), EMAN::SaffOrientationGenerator::gen_orientations(), EMAN::EvenOrientationGenerator::gen_orientations(), and EMAN::EmanOrientationGenerator::gen_orientations(). 00270 { 00271 bool randphi = params.set_default("random_phi",false); 00272 float phi = 0.0f; 00273 if (randphi) phi = Util::get_frand(0.0f,359.99999f); 00274 float phitoo = params.set_default("phitoo",0.0f); 00275 if ( phitoo < 0 ) throw InvalidValueException(phitoo, "Error, if you specify phitoo is must be positive"); 00276 Dict d; 00277 d["type"] = "eman"; 00278 d["az"] = az; 00279 d["alt"] = alt; 00280 d["phi"] = phi; 00281 Transform t(d); 00282 v.push_back(t); 00283 if ( phitoo != 0 ) { 00284 if (phitoo < 0) return false; 00285 else { 00286 for ( float p = phitoo; p <= 360.0f-phitoo; p+= phitoo ) 00287 { 00288 d["phi"] = fmod(phi+p,360); 00289 Transform t(d); 00290 v.push_back(t); 00291 } 00292 } 00293 } 00294 return true; 00295 }
|
|
generate orientations given some symmetry type
Implemented in EMAN::EmanOrientationGenerator, EMAN::RandomOrientationGenerator, EMAN::EvenOrientationGenerator, EMAN::SaffOrientationGenerator, and EMAN::OptimumOrientationGenerator. Referenced by EMAN::OptimumOrientationGenerator::gen_orientations(), and EMAN::Symmetry3D::gen_orientations(). |
|
Definition at line 183 of file symmetry.cpp. References EMAN::Symmetry3D::get_nsym(), EMAN::Symmetry3D::is_c_sym(), EMAN::Symmetry3D::is_d_sym(), EMAN::Symmetry3D::is_platonic_sym(), and EMAN::Symmetry3D::is_tet_sym(). Referenced by EMAN::EmanOrientationGenerator::gen_orientations(), and EMAN::EmanOrientationGenerator::get_orientations_tally(). 00184 { 00185 00186 if ( sym->is_d_sym() && alt_iterator == altmax && ( (sym->get_nsym())/2 % 2 == 1 )) { 00187 if (inc_mirror) { 00188 azmax_adjusted /= 4.0f; 00189 d_odd_mirror_flag = true; 00190 } 00191 else azmax_adjusted /= 2.0f; 00192 } 00193 else if (sym->is_d_sym() && alt_iterator == altmax && ( (sym->get_nsym())/2 % 2 == 0 ) && inc_mirror) { 00194 azmax_adjusted /= 2.0f; 00195 } 00196 // if this is odd c symmetry, and we're at the equator, and we're excluding the mirror then 00197 // half the equator is redundant (it is the mirror of the other half) 00198 else if (sym->is_c_sym() && !inc_mirror && alt_iterator == altmax && (sym->get_nsym() % 2 == 1 ) ){ 00199 azmax_adjusted /= 2.0f; 00200 } 00201 // at the azimuthal boundary in c symmetry and tetrahedral symmetry we have come 00202 // full circle, we must not include it 00203 else if (sym->is_c_sym() || sym->is_tet_sym() ) { 00204 azmax_adjusted -= h/4.0f; 00205 } 00206 // If we're including the mirror then in d and icos and oct symmetry the azimuthal 00207 // boundary represents coming full circle, so must be careful to exclude it 00208 else if (inc_mirror && ( sym->is_d_sym() || sym->is_platonic_sym() ) ) { 00209 azmax_adjusted -= h/4.0f; 00210 } 00211 // else do nothing - this means that we're including the great arc traversing 00212 // the full range of permissable altitude angles at azmax. 00213 // This happens in d symmetry, and in the icos and oct symmetries, when the mirror 00214 // portion of the asymmetric unit is being excluded 00215 00216 }
|
|
This function gets the optimal value of the delta (or angular spacing) of the orientations based on a desired total number of orientations (n). It does this using a bifurcation strategy, calling get_orientations_tally (which must be supplied by the child class) using the next best guess etc. The solution may not exist (simply because the orientation generation strategy does not contain it), so a best guess may be returned. The inheriting class must supply the get_orientations_tally function, which returns the number of orientations generated (an int), for a given delta.
Definition at line 232 of file symmetry.cpp. References get_orientations_tally(). Referenced by EMAN::OptimumOrientationGenerator::gen_orientations(), EMAN::SaffOrientationGenerator::gen_orientations(), EMAN::EvenOrientationGenerator::gen_orientations(), and EMAN::EmanOrientationGenerator::gen_orientations(). 00233 { 00234 00235 // float delta_soln = 360.0f/sym->get_max_csym(); 00236 float delta_soln = 180.0f; 00237 float delta_upper_bound = delta_soln; 00238 float delta_lower_bound = 0.0f; 00239 00240 int prev_tally = -1; 00241 // This is an example of a divide and conquer approach, the possible values of delta are searched 00242 // like a binary tree 00243 00244 bool soln_found = false; 00245 00246 while ( soln_found == false ) { 00247 int tally = get_orientations_tally(sym,delta_soln); 00248 if ( tally == n ) soln_found = true; 00249 else if ( (delta_upper_bound - delta_lower_bound) < 0.0001 ) { 00250 // If this is the case, the requested number of projections is practically infeasible 00251 // in which case just return the nearest guess 00252 soln_found = true; 00253 delta_soln = (delta_upper_bound+delta_lower_bound)/2.0f; 00254 } 00255 else if (tally < n) { 00256 delta_upper_bound = delta_soln; 00257 delta_soln = delta_soln - (delta_soln-delta_lower_bound)/2.0f; 00258 } 00259 else /* tally > n*/{ 00260 delta_lower_bound = delta_soln; 00261 delta_soln = delta_soln + (delta_upper_bound-delta_soln)/2.0f; 00262 } 00263 prev_tally = tally; 00264 } 00265 00266 return delta_soln; 00267 }
|
|
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.
Implemented in EMAN::EmanOrientationGenerator, EMAN::RandomOrientationGenerator, EMAN::EvenOrientationGenerator, EMAN::SaffOrientationGenerator, and EMAN::OptimumOrientationGenerator. Referenced by get_optimal_delta(), and EMAN::OptimumOrientationGenerator::get_orientations_tally(). |
|
Implements EMAN::FactoryBase. Reimplemented in EMAN::EmanOrientationGenerator, EMAN::RandomOrientationGenerator, EMAN::EvenOrientationGenerator, EMAN::SaffOrientationGenerator, and EMAN::OptimumOrientationGenerator. Definition at line 1011 of file symmetry.h. References EMAN::TypeDict::put(). 01012 { 01013 TypeDict d; 01014 d.put("phitoo", EMObject::FLOAT, "Specifying a non zero value for this argument will cause phi rotations to be included. The value specified is the angular spacing of the phi rotations in degrees. The default for this value is 0, causing no extra phi rotations to be included."); 01015 d.put("random_phi", EMObject::BOOL, "Causes the orientations to have a random phi. This occurs before the phitoo parameter is considered."); 01016 return d; 01017 }
|
|
Disallow assignment.
|