#include <aligner.h>
Inheritance diagram for EMAN::RT3DGridAligner:
Public Member Functions | |
virtual EMData * | align (EMData *this_img, EMData *to_img, const string &cmp_name="ccc.tomo", const Dict &cmp_params=Dict()) 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.grid" |
Definition at line 860 of file aligner.h.
|
See Aligner comments for more details.
Implements EMAN::Aligner. Definition at line 869 of file aligner.h. References align(). 00870 { 00871 return align(this_img, to_img, "ccc.tomo", Dict()); 00872 }
|
|
See Aligner comments for more details.
Implements EMAN::Aligner. Definition at line 1594 of file aligner.cpp. References EMAN::EMData::process(), EMAN::EMData::set_attr(), t, and xform_align_nbest(). 01595 { 01596 01597 vector<Dict> alis = xform_align_nbest(this_img,to,1,cmp_name,cmp_params); 01598 01599 Dict t; 01600 Transform* tr = (Transform*) alis[0]["xform.align3d"]; 01601 t["transform"] = tr; 01602 EMData* soln = this_img->process("xform",t); 01603 soln->set_attr("xform.align3d",tr); 01604 delete tr; tr = 0; 01605 01606 return soln; 01607 01608 }
|
|
Implements EMAN::Aligner. Definition at line 884 of file aligner.h. 00885 { 00886 return "3D rotational and translational alignment using specified ranges and maximum shifts"; 00887 }
|
|
Get the Aligner's name. Each Aligner is identified by a unique name.
Implements EMAN::Aligner. Definition at line 879 of file aligner.h. 00880 {
00881 return NAME;
00882 }
|
|
Implements EMAN::Aligner. Definition at line 894 of file aligner.h. References EMAN::TypeDict::put(). 00895 { 00896 TypeDict d; 00897 d.put("daz", EMObject::FLOAT,"The angle increment in the azimuth direction. Default is 10"); 00898 d.put("laz", EMObject::FLOAT,"Lower bound for the azimuth direction. Default it 0"); 00899 d.put("uaz", EMObject::FLOAT,"Upper bound for the azimuth direction. Default it 179.9"); 00900 d.put("dphi", EMObject::FLOAT,"The angle increment in the phi direction. Default is 10"); 00901 d.put("lphi", EMObject::FLOAT,"Lower bound for the phi direction. Default it 0"); 00902 d.put("uphi", EMObject::FLOAT,"Upper bound for the phi direction. Default it 359.9"); 00903 d.put("dalt", EMObject::FLOAT,"The angle increment in the altitude direction. Default is 10"); 00904 d.put("lalt", EMObject::FLOAT,"Lower bound for the altitude direction. Default it 0"); 00905 d.put("ualt", EMObject::FLOAT,"Upper bound for the altitude direction. Default it 359.9"); 00906 d.put("dotrans", EMObject::BOOL,"Do a translational search. Default is True(1)"); 00907 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."); 00908 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."); 00909 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."); 00910 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"); 00911 d.put("verbose", EMObject::BOOL,"Turn this on to have useful information printed to standard out."); 00912 return d; 00913 }
|
|
Definition at line 889 of file aligner.h. 00890 { 00891 return new RT3DGridAligner(); 00892 }
|
|
See Aligner comments for more details.
Reimplemented from EMAN::Aligner. Definition at line 1610 of file aligner.cpp. References EMAN::EMData::calc_ccf(), EMAN::EMData::calc_max_location_wrap(), EMAN::EMData::cmp(), copy(), EMAN::EMData::do_fft(), EMAN::Dict::end(), EMAN::EMData::get_attr(), EMAN::EMData::get_ndim(), EMAN::Dict::has_key(), ImageDimensionException, InvalidParameterException, phi, EMAN::EMData::process(), EMAN::Dict::set_default(), EMAN::Transform::set_trans(), and t. Referenced by align(). 01610 { 01611 01612 if ( this_img->get_ndim() != 3 || to->get_ndim() != 3 ) { 01613 throw ImageDimensionException("This aligner only works for 3D images"); 01614 } 01615 01616 int searchx = 0; 01617 int searchy = 0; 01618 int searchz = 0; 01619 01620 bool dotrans = params.set_default("dotrans",1); 01621 if (params.has_key("search")) { 01622 vector<string> check; 01623 check.push_back("searchx"); 01624 check.push_back("searchy"); 01625 check.push_back("searchz"); 01626 for(vector<string>::const_iterator cit = check.begin(); cit != check.end(); ++cit) { 01627 if (params.has_key(*cit)) throw InvalidParameterException("The search parameter is mutually exclusive of the searchx, searchy, and searchz parameters"); 01628 } 01629 int search = params["search"]; 01630 searchx = search; 01631 searchy = search; 01632 searchz = search; 01633 } else { 01634 searchx = params.set_default("searchx",3); 01635 searchy = params.set_default("searchy",3); 01636 searchz = params.set_default("searchz",3); 01637 } 01638 01639 float lalt = params.set_default("lalt",0.0f); 01640 float laz = params.set_default("laz",0.0f); 01641 float lphi = params.set_default("lphi",0.0f); 01642 float ualt = params.set_default("ualt",179.9f); // I am using 179.9 rather than 180 to avoid resampling 01643 float uphi = params.set_default("uphi",359.9f); // I am using 359.9 rather than 180 to avoid resampling 0 = 360 (for perodic functions) 01644 float uaz = params.set_default("uaz",359.9f); // I am using 359.9 rather than 180 to avoid resampling 0 = 360 (for perodic functions) 01645 float dalt = params.set_default("dalt",10.f); 01646 float daz = params.set_default("daz",10.f); 01647 float dphi = params.set_default("dphi",10.f); 01648 bool verbose = params.set_default("verbose",false); 01649 01650 //in case we arre aligning tomos 01651 Dict altered_cmp_params(cmp_params); 01652 if (cmp_name == "ccc.tomo") { 01653 altered_cmp_params.set_default("searchx", searchx); 01654 altered_cmp_params.set_default("searchy", searchy); 01655 altered_cmp_params.set_default("searchz", searchz); 01656 altered_cmp_params.set_default("norm", true); 01657 } 01658 01659 vector<Dict> solns; 01660 if (nsoln == 0) return solns; // What was the user thinking? 01661 for (unsigned int i = 0; i < nsoln; ++i ) { 01662 Dict d; 01663 d["score"] = 1.e24; 01664 Transform t; // identity by default 01665 d["xform.align3d"] = &t; // deep copy is going on here 01666 solns.push_back(d); 01667 } 01668 01669 EMData * tofft = 0; 01670 if(dotrans || cmp_name == "ccc.tomo"){ 01671 tofft = to->do_fft(); 01672 } 01673 01674 Dict d; 01675 d["type"] = "eman"; // d is used in the loop below 01676 for ( float alt = lalt; alt <= ualt; alt += dalt) { 01677 // An optimization for the range of az is made at the top of the sphere 01678 // If you think about it, this is just a coarse way of making this approach slightly more efficient 01679 if (verbose) { 01680 cout << "Trying angle alt " << alt << " az " << laz << endl; 01681 } 01682 for ( float az = laz; az <= uaz; az += daz ){ 01683 for( float phi = lphi; phi <= uphi; phi += dphi ) { 01684 d["alt"] = alt; 01685 d["phi"] = phi; 01686 d["az"] = az; 01687 Transform t(d); 01688 EMData* transformed = this_img->process("xform",Dict("transform",&t)); 01689 01690 //need to do things a bit diffrent if we want to compare two tomos 01691 float best_score; 01692 if (cmp_name == "ccc.tomo") { 01693 best_score = transformed->cmp(cmp_name,tofft,altered_cmp_params); 01694 t.set_trans(-(float)transformed->get_attr("tx"), -(float)transformed->get_attr("ty"), -(float)transformed->get_attr("tz")); 01695 } else { 01696 if(dotrans){ 01697 EMData* ccf = transformed->calc_ccf(tofft); 01698 IntPoint point = ccf->calc_max_location_wrap(searchx,searchy,searchz); 01699 t.set_trans((float)-point[0], (float)-point[1], (float)-point[2]); 01700 transformed = this_img->process("xform",Dict("transform",&t)); 01701 delete ccf; ccf =0; 01702 } 01703 best_score = transformed->cmp(cmp_name,to,cmp_params); 01704 } 01705 delete transformed; transformed =0; 01706 01707 unsigned int j = 0; 01708 for ( vector<Dict>::iterator it = solns.begin(); it != solns.end(); ++it, ++j ) { 01709 if ( (float)(*it)["score"] > best_score ) { // Note greater than - EMAN2 preferes minimums as a matter of policy 01710 vector<Dict>::reverse_iterator rit = solns.rbegin(); 01711 copy(rit+1,solns.rend()-j,rit); 01712 Dict& d = (*it); 01713 d["score"] = best_score; 01714 d["xform.align3d"] = &t; 01715 break; 01716 } 01717 } 01718 } 01719 } 01720 } 01721 01722 if(tofft) {delete tofft; tofft = 0;} 01723 return solns; 01724 01725 }
|
|
Definition at line 68 of file aligner.cpp. |