#include <aligner.h>
Inheritance diagram for EMAN::RT3DGridAligner:
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.grid" |
Definition at line 665 of file aligner.h.
|
See Aligner comments for more details.
Implements EMAN::Aligner. Definition at line 674 of file aligner.h. References align(). 00675 { 00676 return align(this_img, to_img, "dot.tomo", Dict()); 00677 }
|
|
See Aligner comments for more details.
Implements EMAN::Aligner. Definition at line 1379 of file aligner.cpp. References EMAN::EMData::process(), EMAN::EMData::set_attr(), t, and xform_align_nbest(). 01380 { 01381 01382 vector<Dict> alis = xform_align_nbest(this_img,to,1,cmp_name,cmp_params); 01383 01384 Dict t; 01385 Transform* tr = (Transform*) alis[0]["xform.align3d"]; 01386 t["transform"] = tr; 01387 EMData* soln = this_img->process("xform",t); 01388 soln->set_attr("xform.align3d",tr); 01389 delete tr; tr = 0; 01390 01391 return soln; 01392 01393 }
|
|
Implements EMAN::Aligner. Definition at line 689 of file aligner.h. 00690 { 00691 return "3D rotational and translational alignment using specified ranges and maximum shifts"; 00692 }
|
|
Get the Aligner's name. Each Aligner is identified by a unique name.
Implements EMAN::Aligner. Definition at line 684 of file aligner.h. 00685 {
00686 return NAME;
00687 }
|
|
Implements EMAN::Aligner. Definition at line 699 of file aligner.h. References EMAN::TypeDict::put(). 00700 { 00701 TypeDict d; 00702 d.put("daz", EMObject::FLOAT,"The angle increment in the azimuth direction. Default is 10"); 00703 d.put("raz", EMObject::FLOAT,"The range of angles to sample in the azimuth direction. Default is 360."); 00704 d.put("dphi", EMObject::FLOAT,"The angle increment in the phi direction. Default is 10."); 00705 d.put("rphi", EMObject::FLOAT,"The range of angles to sample in the phi direction. Default is 180."); 00706 d.put("dalt", EMObject::FLOAT,"The angle increment in the altitude direction. Default is 10."); 00707 d.put("ralt", EMObject::FLOAT,"The range of angles to sample in the altitude direction. Default is 180."); 00708 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."); 00709 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."); 00710 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."); 00711 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"); 00712 d.put("verbose", EMObject::BOOL,"Turn this on to have useful information printed to standard out."); 00713 return d; 00714 }
|
|
Definition at line 694 of file aligner.h. 00695 { 00696 return new RT3DGridAligner(); 00697 }
|
|
See Aligner comments for more details.
Reimplemented from EMAN::Aligner. Definition at line 1395 of file aligner.cpp. References EMAN::EMData::calc_ccf(), EMAN::EMData::calc_max_location_wrap(), EMAN::EMData::cmp(), copy(), EMAN::EMData::get_ndim(), EMAN::Dict::has_key(), ImageDimensionException, InvalidParameterException, phi, EMAN::EMData::process(), EMAN::Dict::set_default(), and t. Referenced by align(). 01395 { 01396 01397 if ( this_img->get_ndim() != 3 || to->get_ndim() != 3 ) { 01398 throw ImageDimensionException("This aligner only works for 3D images"); 01399 } 01400 01401 int searchx = 0; 01402 int searchy = 0; 01403 int searchz = 0; 01404 01405 if (params.has_key("search")) { 01406 vector<string> check; 01407 check.push_back("searchx"); 01408 check.push_back("searchy"); 01409 check.push_back("searchz"); 01410 for(vector<string>::const_iterator cit = check.begin(); cit != check.end(); ++cit) { 01411 if (params.has_key(*cit)) throw InvalidParameterException("The search parameter is mutually exclusive of the searchx, searchy, and searchz parameters"); 01412 } 01413 int search = params["search"]; 01414 searchx = search; 01415 searchy = search; 01416 searchz = search; 01417 } else { 01418 searchx = params.set_default("searchx",3); 01419 searchy = params.set_default("searchy",3); 01420 searchz = params.set_default("searchz",3); 01421 } 01422 01423 float ralt = params.set_default("ralt",180.f); 01424 float rphi = params.set_default("rphi",180.f); 01425 float raz = params.set_default("raz",180.f); 01426 float dalt = params.set_default("dalt",10.f); 01427 float daz = params.set_default("daz",10.f); 01428 float dphi = params.set_default("dphi",10.f); 01429 float threshold = params.set_default("threshold",0.f); 01430 if (threshold < 0.0f) throw InvalidParameterException("The threshold parameter must be greater than or equal to zero"); 01431 bool verbose = params.set_default("verbose",false); 01432 01433 vector<Dict> solns; 01434 if (nsoln == 0) return solns; // What was the user thinking? 01435 for (unsigned int i = 0; i < nsoln; ++i ) { 01436 Dict d; 01437 d["score"] = 1.e24; 01438 Transform t; // identity by default 01439 d["xform.align3d"] = &t; // deep copy is going on here 01440 solns.push_back(d); 01441 } 01442 Dict d; 01443 d["type"] = "eman"; // d is used in the loop below 01444 for ( float alt = 0.0f; alt <= ralt; alt += dalt) { 01445 // An optimization for the range of az is made at the top of the sphere 01446 // If you think about it, this is just a coarse way of making this approach slightly more efficient 01447 if (verbose) { 01448 cout << "Trying angle " << alt << endl; 01449 } 01450 01451 float begin_az = -raz; 01452 float end_az = raz; 01453 if (alt == 0.0f) { 01454 begin_az = 0.0f; 01455 end_az = 0.0f; 01456 } 01457 01458 for ( float az = begin_az; az <= end_az; az += daz ){ 01459 for( float phi = -rphi-az; phi <= rphi-az; phi += dphi ) { 01460 d["alt"] = alt; 01461 d["phi"] = phi; 01462 d["az"] = az; 01463 Transform t(d); 01464 EMData* transformed = this_img->process("xform",Dict("transform",&t)); 01465 EMData* ccf = transformed->calc_ccf(to); 01466 01467 IntPoint point = ccf->calc_max_location_wrap(searchx,searchy,searchz); 01468 Dict altered_cmp_params(cmp_params); 01469 if (cmp_name == "dot.tomo") { 01470 altered_cmp_params["ccf"] = ccf; 01471 altered_cmp_params["tx"] = point[0]; 01472 altered_cmp_params["ty"] = point[1]; 01473 altered_cmp_params["tz"] = point[2]; 01474 } 01475 01476 float best_score = transformed->cmp(cmp_name,to,altered_cmp_params); 01477 delete transformed; transformed =0; 01478 delete ccf; ccf = 0; 01479 01480 unsigned int j = 0; 01481 for ( vector<Dict>::iterator it = solns.begin(); it != solns.end(); ++it, ++j ) { 01482 if ( (float)(*it)["score"] > best_score ) { // Note greater than - EMAN2 preferes minimums as a matter of policy 01483 vector<Dict>::reverse_iterator rit = solns.rbegin(); 01484 copy(rit+1,solns.rend()-j,rit); 01485 Dict& d = (*it); 01486 d["score"] = best_score; 01487 d["xform.align3d"] = &t; 01488 break; 01489 } 01490 } 01491 } 01492 } 01493 } 01494 01495 return solns; 01496 01497 }
|
|
Definition at line 64 of file aligner.cpp. |