#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 | |
Aligner * | NEW () |
Static Public Attributes | |
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 1499 of file aligner.cpp. References EMAN::EMData::process(), EMAN::EMData::set_attr(), t, and xform_align_nbest(). 01500 { 01501 01502 vector<Dict> alis = xform_align_nbest(this_img,to,1,cmp_name,cmp_params); 01503 01504 Dict t; 01505 Transform* tr = (Transform*) alis[0]["xform.align3d"]; 01506 t["transform"] = tr; 01507 EMData* soln = this_img->process("xform",t); 01508 soln->set_attr("xform.align3d",tr); 01509 delete tr; tr = 0; 01510 01511 return soln; 01512 01513 }
|
|
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. 00745 {
00746 return NAME;
00747 }
|
|
Implements EMAN::Aligner. Definition at line 759 of file aligner.h. References EMAN::TypeDict::put(). 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. 00755 { 00756 return new RT3DSphereAligner(); 00757 }
|
|
See Aligner comments for more details.
Reimplemented from EMAN::Aligner. Definition at line 1515 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, phi, EMAN::EMData::process(), EMAN::Dict::set_default(), and t. Referenced by align(). 01515 { 01516 01517 if ( this_img->get_ndim() != 3 || to->get_ndim() != 3 ) { 01518 throw ImageDimensionException("This aligner only works for 3D images"); 01519 } 01520 01521 int searchx = 0; 01522 int searchy = 0; 01523 int searchz = 0; 01524 01525 if (params.has_key("search")) { 01526 vector<string> check; 01527 check.push_back("searchx"); 01528 check.push_back("searchy"); 01529 check.push_back("searchz"); 01530 for(vector<string>::const_iterator cit = check.begin(); cit != check.end(); ++cit) { 01531 if (params.has_key(*cit)) throw InvalidParameterException("The search parameter is mutually exclusive of the searchx, searchy, and searchz parameters"); 01532 } 01533 int search = params["search"]; 01534 searchx = search; 01535 searchy = search; 01536 searchz = search; 01537 } else { 01538 searchx = params.set_default("searchx",3); 01539 searchy = params.set_default("searchy",3); 01540 searchz = params.set_default("searchz",3); 01541 } 01542 01543 float rphi = params.set_default("rphi",180.f); 01544 float dphi = params.set_default("dphi",10.f); 01545 float threshold = params.set_default("threshold",0.f); 01546 if (threshold < 0.0f) throw InvalidParameterException("The threshold parameter must be greater than or equal to zero"); 01547 bool verbose = params.set_default("verbose",false); 01548 01549 vector<Dict> solns; 01550 if (nsoln == 0) return solns; // What was the user thinking? 01551 for (unsigned int i = 0; i < nsoln; ++i ) { 01552 Dict d; 01553 d["score"] = 1.e24; 01554 Transform t; // identity by default 01555 d["xform.align3d"] = &t; // deep copy is going on here 01556 solns.push_back(d); 01557 } 01558 01559 Dict d; 01560 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 01561 if ( params.has_key("delta") && params.has_key("n") ) { 01562 throw InvalidParameterException("The delta and n parameters are mutually exclusive in the RT3DSphereAligner aligner"); 01563 } else if ( params.has_key("n") ) { 01564 d["n"] = params["n"]; 01565 } else { 01566 // If they didn't specify either then grab the default delta - if they did supply delta we're still safe doing this 01567 d["delta"] = params.set_default("delta",10.f); 01568 } 01569 01570 Symmetry3D* sym = Factory<Symmetry3D>::get((string)params.set_default("sym","c1")); 01571 vector<Transform> transforms = sym->gen_orientations((string)params.set_default("orientgen","eman"),d); 01572 01573 float verbose_alt = -1.0f;; 01574 for(vector<Transform>::const_iterator trans_it = transforms.begin(); trans_it != transforms.end(); trans_it++) { 01575 Dict params = trans_it->get_params("eman"); 01576 float az = params["az"]; 01577 if (verbose) { 01578 float alt = params["alt"]; 01579 if ( alt != verbose_alt ) { 01580 verbose_alt = alt; 01581 cout << "Trying angle " << alt << endl; 01582 } 01583 } 01584 for( float phi = -rphi-az; phi <= rphi-az; phi += dphi ) { 01585 params["phi"] = phi; 01586 Transform t(params); 01587 EMData* transformed = this_img->process("xform",Dict("transform",&t)); 01588 EMData* ccf = transformed->calc_ccf(to); 01589 IntPoint point = ccf->calc_max_location_wrap(searchx,searchy,searchz); 01590 Dict altered_cmp_params(cmp_params); 01591 if (cmp_name == "dot.tomo") { 01592 altered_cmp_params["ccf"] = ccf; 01593 altered_cmp_params["tx"] = point[0]; 01594 altered_cmp_params["ty"] = point[1]; 01595 altered_cmp_params["tz"] = point[2]; 01596 } 01597 01598 float best_score = transformed->cmp(cmp_name,to,altered_cmp_params); 01599 delete transformed; transformed =0; 01600 delete ccf; ccf =0; 01601 01602 unsigned int j = 0; 01603 for ( vector<Dict>::iterator it = solns.begin(); it != solns.end(); ++it, ++j ) { 01604 if ( (float)(*it)["score"] > best_score ) { // Note greater than - EMAN2 preferes minimums as a matter of policy 01605 vector<Dict>::reverse_iterator rit = solns.rbegin(); 01606 copy(rit+1,solns.rend()-j,rit); 01607 Dict& d = (*it); 01608 d["score"] = best_score; 01609 d["xform.align3d"] = &t; // deep copy is going on here 01610 break; 01611 } 01612 } 01613 01614 } 01615 } 01616 delete sym; sym = 0; 01617 return solns; 01618 01619 }
|
|
Definition at line 65 of file aligner.cpp. |