#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 934 of file symmetry.h.
|
Definition at line 937 of file symmetry.h. 00937 {};
|
|
Definition at line 938 of file symmetry.h. 00938 {};
|
|
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 263 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(). 00264 { 00265 bool randphi = params.set_default("random_phi",false); 00266 float phi = 0.0f; 00267 if (randphi) phi = Util::get_frand(0.0f,359.99999f); 00268 float phitoo = params.set_default("phitoo",0.0f); 00269 if ( phitoo < 0 ) throw InvalidValueException(phitoo, "Error, if you specify phitoo is must be positive"); 00270 Dict d; 00271 d["type"] = "eman"; 00272 d["az"] = az; 00273 d["alt"] = alt; 00274 d["phi"] = phi; 00275 Transform t(d); 00276 v.push_back(t); 00277 if ( phitoo != 0 ) { 00278 if (phitoo < 0) return false; 00279 else { 00280 for ( float p = phitoo; p <= 360.0f-phitoo; p+= phitoo ) 00281 { 00282 d["phi"] = fmod(phi+p,360); 00283 Transform t(d); 00284 v.push_back(t); 00285 } 00286 } 00287 } 00288 return true; 00289 }
|
|
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 177 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(). 00178 { 00179 00180 if ( sym->is_d_sym() && alt_iterator == altmax && ( (sym->get_nsym())/2 % 2 == 1 )) { 00181 if (inc_mirror) { 00182 azmax_adjusted /= 4.0f; 00183 d_odd_mirror_flag = true; 00184 } 00185 else azmax_adjusted /= 2.0f; 00186 } 00187 else if (sym->is_d_sym() && alt_iterator == altmax && ( (sym->get_nsym())/2 % 2 == 0 ) && inc_mirror) { 00188 azmax_adjusted /= 2.0f; 00189 } 00190 // if this is odd c symmetry, and we're at the equator, and we're excluding the mirror then 00191 // half the equator is redundant (it is the mirror of the other half) 00192 else if (sym->is_c_sym() && !inc_mirror && alt_iterator == altmax && (sym->get_nsym() % 2 == 1 ) ){ 00193 azmax_adjusted /= 2.0f; 00194 } 00195 // at the azimuthal boundary in c symmetry and tetrahedral symmetry we have come 00196 // full circle, we must not include it 00197 else if (sym->is_c_sym() || sym->is_tet_sym() ) { 00198 azmax_adjusted -= h/4.0f; 00199 } 00200 // If we're including the mirror then in d and icos and oct symmetry the azimuthal 00201 // boundary represents coming full circle, so must be careful to exclude it 00202 else if (inc_mirror && ( sym->is_d_sym() || sym->is_platonic_sym() ) ) { 00203 azmax_adjusted -= h/4.0f; 00204 } 00205 // else do nothing - this means that we're including the great arc traversing 00206 // the full range of permissable altitude angles at azmax. 00207 // This happens in d symmetry, and in the icos and oct symmetries, when the mirror 00208 // portion of the asymmetric unit is being excluded 00209 00210 }
|
|
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 226 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(). 00227 { 00228 00229 // float delta_soln = 360.0f/sym->get_max_csym(); 00230 float delta_soln = 180.0f; 00231 float delta_upper_bound = delta_soln; 00232 float delta_lower_bound = 0.0f; 00233 00234 int prev_tally = -1; 00235 // This is an example of a divide and conquer approach, the possible values of delta are searched 00236 // like a binary tree 00237 00238 bool soln_found = false; 00239 00240 while ( soln_found == false ) { 00241 int tally = get_orientations_tally(sym,delta_soln); 00242 if ( tally == n ) soln_found = true; 00243 else if ( (delta_upper_bound - delta_lower_bound) < 0.0001 ) { 00244 // If this is the case, the requested number of projections is practically infeasible 00245 // in which case just return the nearest guess 00246 soln_found = true; 00247 delta_soln = (delta_upper_bound+delta_lower_bound)/2.0f; 00248 } 00249 else if (tally < n) { 00250 delta_upper_bound = delta_soln; 00251 delta_soln = delta_soln - (delta_soln-delta_lower_bound)/2.0f; 00252 } 00253 else /* tally > n*/{ 00254 delta_lower_bound = delta_soln; 00255 delta_soln = delta_soln + (delta_upper_bound-delta_soln)/2.0f; 00256 } 00257 prev_tally = tally; 00258 } 00259 00260 return delta_soln; 00261 }
|
|
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 946 of file symmetry.h. References EMAN::TypeDict::put(). 00947 { 00948 TypeDict d; 00949 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."); 00950 d.put("random_phi", EMObject::BOOL, "Causes the orientations to have a random phi. This occurs before the phitoo parameter is considered."); 00951 return d; 00952 }
|
|
Disallow assignment.
|