#include <symmetry.h>
Inheritance diagram for EMAN::SaffOrientationGenerator:


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< Transform > | gen_orientations (const Symmetry3D *const sym) const |
| Generate Saff orientations in the asymmetric unit of the symmetry. | |
Static Public Member Functions | |
| OrientationGenerator * | NEW () |
| Factory support function NEW. | |
Static Public Attributes | |
| 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. | |
| SaffOrientationGenerator & | operator= (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. | |
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
Definition at line 1233 of file symmetry.h.
|
|
Definition at line 1236 of file symmetry.h. 01236 {}
|
|
|
Definition at line 1237 of file symmetry.h. 01237 {}
|
|
|
Disallow copy construction.
|
|
|
Generate Saff orientations in the asymmetric unit of the symmetry.
Implements EMAN::OrientationGenerator. Definition at line 659 of file symmetry.cpp. References EMAN::OrientationGenerator::add_orientation(), 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::Dict::set_default(), and sqrt(). 00660 {
00661 float delta = params.set_default("delta", 0.0f);
00662 int n = params.set_default("n", 0);
00663
00664 if ( delta <= 0 && n <= 0 ) throw InvalidParameterException("Error, you must specify a positive non-zero delta or n");
00665 if ( delta > 0 && n > 0 ) throw InvalidParameterException("Error, the delta and the n arguments are mutually exclusive");
00666
00667 if ( n > 0 ) {
00668 delta = get_optimal_delta(sym,n);
00669 }
00670
00671 // if ( sym->is_platonic_sym() ) return gen_platonic_orientations(sym, delta);
00672
00673 bool inc_mirror = params.set_default("inc_mirror",false);
00674 Dict delimiters = sym->get_delimiters(inc_mirror);
00675 float altmax = delimiters["alt_max"];
00676 float azmax = delimiters["az_max"];
00677
00678 float altmin = 0.0f;
00679 // #If it's a h symmetry then the alt iterator starts at very close
00680 // #to the altmax... the object is a h symmetry then it knows its alt_min...
00681 if (sym->is_h_sym()){
00682 altmin = delimiters["alt_min"];
00683 if (inc_mirror) {
00684 altmin -= (float) sym->get_params()["equator_range"];
00685 }
00686 }
00687
00688 float Deltaz = (float)(cos(altmax*EMConsts::deg2rad)-cos(altmin*EMConsts::deg2rad));
00689 float s = delta*M_PI/180.0f;
00690 float NFactor = 3.6f/s;
00691 float wedgeFactor = fabs( Deltaz*(azmax)/720.0f) ;
00692 int NumPoints = static_cast<int> (NFactor*NFactor*wedgeFactor);
00693
00694 vector<Transform> ret;
00695
00696 if (!sym->is_h_sym()) add_orientation(ret,0,0);
00697 float az = 0.0f;
00698 float dz = (float)cos(altmin*EMConsts::deg2rad);
00699 for(int i = 1; i < NumPoints; ++i ){
00700 float z = dz + Deltaz* (float)i/ float(NumPoints-1);
00701 float r= sqrt(1.0f-z*z);
00702 az = fmod(az + delta/r,azmax);
00703 float alt = (float)(acos(z)*EMConsts::rad2deg);
00704 if (sym->is_platonic_sym()) {
00705 if ( sym->is_in_asym_unit(alt,az,inc_mirror) == false ) continue;
00706 else {
00707 az += sym->get_az_alignment_offset(); // Align to the symmetry axes
00708 }
00709 }
00710 add_orientation(ret,az,alt);
00711 }
00712
00713 return ret;
00714 }
|
|
|
Get a description.
Implements EMAN::FactoryBase. Definition at line 1255 of file symmetry.h. 01255 { return "Generate quasi-evenly distributed orientations within an asymmetric unit using a spiraling method attributed to Saff"; }
|
|
|
Return "saff".
Implements EMAN::FactoryBase. Definition at line 1250 of file symmetry.h. 01250 { return NAME; }
|
|
||||||||||||
|
This function returns how many orientations will be generated for a given delta (angular spacing) It does this by simulated gen_orientations.
Implements EMAN::OrientationGenerator. Definition at line 618 of file symmetry.cpp. References 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::Dict::set_default(), and sqrt(). 00619 {
00620 bool inc_mirror = params.set_default("inc_mirror",false);
00621 Dict delimiters = sym->get_delimiters(inc_mirror);
00622 float altmax = delimiters["alt_max"];
00623 float azmax = delimiters["az_max"];
00624
00625 float altmin = 0.0f;
00626 // #If it's a h symmetry then the alt iterator starts at very close
00627 // #to the altmax... the object is a h symmetry then it knows its alt_min...
00628 if (sym->is_h_sym()){
00629 altmin = delimiters["alt_min"];
00630 if (inc_mirror) {
00631 altmin -= (float) sym->get_params()["equator_range"];
00632 }
00633 }
00634
00635 float Deltaz = (float)(cos(altmax*EMConsts::deg2rad)-cos(altmin*EMConsts::deg2rad));
00636 float s = delta*M_PI/180.0f;
00637 float NFactor = 3.6f/s;
00638 float wedgeFactor = fabs( Deltaz*(azmax)/720.0f) ;
00639 int NumPoints = static_cast<int> (NFactor*NFactor*wedgeFactor);
00640
00641 int tally = 0;
00642 if (!sym->is_h_sym()) ++tally;
00643 float az = 0.0f;
00644 float dz = (float)cos(altmin*EMConsts::deg2rad);
00645 for(int i = 1; i < NumPoints; ++i ){
00646 float z = dz + Deltaz* (float)i/ float(NumPoints-1);
00647 float r= sqrt(1.0f-z*z);
00648 az = fmod(az + delta/r,azmax);
00649 float alt = (float)(acos(z)*EMConsts::rad2deg);
00650 if (sym->is_platonic_sym()) {
00651 if ( sym->is_in_asym_unit(alt,az,inc_mirror) == false ) continue;
00652 }
00653 tally++;
00654 }
00655
00656 return tally;
00657 }
|
|
|
Get a dictionary containing the permissable parameters of this class.
Reimplemented from EMAN::OrientationGenerator. Definition at line 1261 of file symmetry.h. References EMAN::TypeDict::put(). 01262 {
01263 TypeDict d = OrientationGenerator::get_param_types();
01264 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.");
01265 d.put("inc_mirror", EMObject::BOOL, "Indicates whether or not to include the mirror portion of the asymmetric unit. Default is false.");
01266 d.put("delta", EMObject::FLOAT, "The angular separation of orientations in degrees. This option is mutually exclusively of the n argument.");
01267 return d;
01268 }
|
|
|
Factory support function NEW.
Definition at line 1242 of file symmetry.h. 01243 {
01244 return new SaffOrientationGenerator();
01245 }
|
|
|
Disallow assignment.
|
|
|
The name of this class - used to access it from factories etc. Should be "icos".
Definition at line 47 of file symmetry.cpp. |
1.3.9.1