#include <aligner.h>
Inheritance diagram for EMAN::RT3DSphereAligner:
Public Member Functions | |
virtual EMData * | align (EMData *this_img, EMData *to_img, const string &cmp_name, const Dict &cmp_params) const |
See Aligner comments for more details. | |
virtual EMData * | align (EMData *this_img, EMData *to_img) const |
See Aligner comments for more details. | |
virtual vector< Dict > | xform_align_nbest (EMData *this_img, EMData *to_img, const unsigned int nsoln, const string &cmp_name, const Dict &cmp_params) const |
See Aligner comments for more details. | |
virtual string | get_name () const |
Get the Aligner's name. | |
virtual string | get_desc () const |
virtual TypeDict | get_param_types () const |
Static Public Member Functions | |
static Aligner * | NEW () |
Static Public Attributes | |
static const string | NAME = "rt.3d.sphere" |
can also make use of different OrientationGenerators (random, for example) 160-180% more efficient than the RT3DGridAligner
Definition at line 725 of file aligner.h.
|
See Aligner comments for more details.
Implements EMAN::Aligner. Definition at line 734 of file aligner.h. References align(). 00735 { 00736 return align(this_img, to_img, "sqeuclidean", Dict()); 00737 }
|
|
See Aligner comments for more details.
Implements EMAN::Aligner. Definition at line 1507 of file aligner.cpp. References EMAN::EMData::process(), EMAN::EMData::set_attr(), t, and xform_align_nbest(). Referenced by align(). 01508 { 01509 01510 vector<Dict> alis = xform_align_nbest(this_img,to,1,cmp_name,cmp_params); 01511 01512 Dict t; 01513 Transform* tr = (Transform*) alis[0]["xform.align3d"]; 01514 t["transform"] = tr; 01515 EMData* soln = this_img->process("xform",t); 01516 soln->set_attr("xform.align3d",tr); 01517 delete tr; tr = 0; 01518 01519 return soln; 01520 01521 }
|
|
Implements EMAN::Aligner. Definition at line 749 of file aligner.h. 00750 { 00751 return "3D rotational and translational alignment using spherical sampling. Can reduce the search space if symmetry is supplied"; 00752 }
|
|
Get the Aligner's name. Each Aligner is identified by a unique name.
Implements EMAN::Aligner. Definition at line 744 of file aligner.h. References NAME. 00745 { 00746 return NAME; 00747 }
|
|
Implements EMAN::Aligner. Definition at line 759 of file aligner.h. References EMAN::EMObject::BOOL, EMAN::EMObject::FLOAT, EMAN::EMObject::INT, EMAN::TypeDict::put(), and EMAN::EMObject::STRING. 00760 { 00761 TypeDict d; 00762 d.put("sym", EMObject::STRING,"The symmtery to use as the basis of the spherical sampling. Default is c1 (asymmetry)."); 00763 d.put("orientgen", EMObject::STRING,"Advanced. The orientation generation strategy. Default is eman"); 00764 d.put("delta", EMObject::FLOAT,"Angle the separates points on the sphere. This is exclusive of the \'n\' paramater. Default is 10"); 00765 d.put("n", EMObject::INT,"An alternative to the delta argument, this is the number of points you want generated on the sphere. Default is OFF"); 00766 d.put("dphi", EMObject::FLOAT,"The angle increment in the phi direction. Default is 10."); 00767 d.put("rphi", EMObject::FLOAT,"The range of angles to sample in the phi direction. Default is 180."); 00768 d.put("search", EMObject::INT,"The maximum length of the detectable translational shift - if you supply this parameter you can not supply the maxshiftx, maxshifty or maxshiftz parameters. Each approach is mutually exclusive."); 00769 d.put("searchx", EMObject::INT,"The maximum length of the detectable translational shift in the x direction- if you supply this parameter you can not supply the maxshift parameters. Default is 3."); 00770 d.put("searchy", EMObject::INT,"The maximum length of the detectable translational shift in the y direction- if you supply this parameter you can not supply the maxshift parameters. Default is 3."); 00771 d.put("searchz", EMObject::INT,"The maximum length of the detectable translational shift in the z direction- if you supply this parameter you can not supply the maxshift parameters. Default is 3"); 00772 d.put("verbose", EMObject::BOOL,"Turn this on to have useful information printed to standard out."); 00773 return d; 00774 }
|
|
Definition at line 754 of file aligner.h.
|
|
See Aligner comments for more details.
Reimplemented from EMAN::Aligner. Definition at line 1523 of file aligner.cpp. References EMAN::EMData::calc_ccf(), EMAN::EMData::calc_max_location_wrap(), EMAN::EMData::cmp(), copy(), EMAN::Symmetry3D::gen_orientations(), EMAN::Factory< T >::get(), EMAN::EMData::get_ndim(), EMAN::Dict::has_key(), ImageDimensionException, InvalidParameterException, EMAN::Aligner::params, phi, EMAN::EMData::process(), EMAN::Dict::set_default(), and t. Referenced by align(). 01523 { 01524 01525 if ( this_img->get_ndim() != 3 || to->get_ndim() != 3 ) { 01526 throw ImageDimensionException("This aligner only works for 3D images"); 01527 } 01528 01529 int searchx = 0; 01530 int searchy = 0; 01531 int searchz = 0; 01532 01533 if (params.has_key("search")) { 01534 vector<string> check; 01535 check.push_back("searchx"); 01536 check.push_back("searchy"); 01537 check.push_back("searchz"); 01538 for(vector<string>::const_iterator cit = check.begin(); cit != check.end(); ++cit) { 01539 if (params.has_key(*cit)) throw InvalidParameterException("The search parameter is mutually exclusive of the searchx, searchy, and searchz parameters"); 01540 } 01541 int search = params["search"]; 01542 searchx = search; 01543 searchy = search; 01544 searchz = search; 01545 } else { 01546 searchx = params.set_default("searchx",3); 01547 searchy = params.set_default("searchy",3); 01548 searchz = params.set_default("searchz",3); 01549 } 01550 01551 float rphi = params.set_default("rphi",180.f); 01552 float dphi = params.set_default("dphi",10.f); 01553 float threshold = params.set_default("threshold",0.f); 01554 if (threshold < 0.0f) throw InvalidParameterException("The threshold parameter must be greater than or equal to zero"); 01555 bool verbose = params.set_default("verbose",false); 01556 01557 vector<Dict> solns; 01558 if (nsoln == 0) return solns; // What was the user thinking? 01559 for (unsigned int i = 0; i < nsoln; ++i ) { 01560 Dict d; 01561 d["score"] = 1.e24; 01562 Transform t; // identity by default 01563 d["xform.align3d"] = &t; // deep copy is going on here 01564 solns.push_back(d); 01565 } 01566 01567 Dict d; 01568 d["inc_mirror"] = true; // This should probably always be true for 3D case. If it ever changes we might have to make inc_mirror a parameter 01569 if ( params.has_key("delta") && params.has_key("n") ) { 01570 throw InvalidParameterException("The delta and n parameters are mutually exclusive in the RT3DSphereAligner aligner"); 01571 } else if ( params.has_key("n") ) { 01572 d["n"] = params["n"]; 01573 } else { 01574 // If they didn't specify either then grab the default delta - if they did supply delta we're still safe doing this 01575 d["delta"] = params.set_default("delta",10.f); 01576 } 01577 01578 Symmetry3D* sym = Factory<Symmetry3D>::get((string)params.set_default("sym","c1")); 01579 vector<Transform> transforms = sym->gen_orientations((string)params.set_default("orientgen","eman"),d); 01580 01581 float verbose_alt = -1.0f;; 01582 for(vector<Transform>::const_iterator trans_it = transforms.begin(); trans_it != transforms.end(); trans_it++) { 01583 Dict params = trans_it->get_params("eman"); 01584 float az = params["az"]; 01585 if (verbose) { 01586 float alt = params["alt"]; 01587 if ( alt != verbose_alt ) { 01588 verbose_alt = alt; 01589 cout << "Trying angle " << alt << endl; 01590 } 01591 } 01592 for( float phi = -rphi-az; phi <= rphi-az; phi += dphi ) { 01593 params["phi"] = phi; 01594 Transform t(params); 01595 EMData* transformed = this_img->process("xform",Dict("transform",&t)); 01596 EMData* ccf = transformed->calc_ccf(to); 01597 IntPoint point = ccf->calc_max_location_wrap(searchx,searchy,searchz); 01598 Dict altered_cmp_params(cmp_params); 01599 if (cmp_name == "dot.tomo") { 01600 altered_cmp_params["ccf"] = ccf; 01601 altered_cmp_params["tx"] = point[0]; 01602 altered_cmp_params["ty"] = point[1]; 01603 altered_cmp_params["tz"] = point[2]; 01604 } 01605 01606 float best_score = transformed->cmp(cmp_name,to,altered_cmp_params); 01607 delete transformed; transformed =0; 01608 delete ccf; ccf =0; 01609 01610 unsigned int j = 0; 01611 for ( vector<Dict>::iterator it = solns.begin(); it != solns.end(); ++it, ++j ) { 01612 if ( (float)(*it)["score"] > best_score ) { // Note greater than - EMAN2 preferes minimums as a matter of policy 01613 vector<Dict>::reverse_iterator rit = solns.rbegin(); 01614 copy(rit+1,solns.rend()-j,rit); 01615 Dict& d = (*it); 01616 d["score"] = best_score; 01617 d["xform.align3d"] = &t; // deep copy is going on here 01618 break; 01619 } 01620 } 01621 01622 } 01623 } 01624 delete sym; sym = 0; 01625 return solns; 01626 01627 }
|
|
Definition at line 776 of file aligner.h. Referenced by get_name(). |