#include <aligner.h>
Inheritance diagram for EMAN::RT3DSymmetryAligner:
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 | |
static Aligner * | NEW () |
Static Public Attributes | |
static const string | NAME = "rotate_symmetry_3d" |
This aligner takes a map, which must be first aligned to the symmetry axis, and rotates it to it symmetric positions. This is used to check for pseudo symmetry (such as finding the tail of an icosahedral virus). A list of best matches (moving to a reference is produced. Alternativly, a rotated verison of the moving map is returned.
sym | The symmtery to use | |
verbose | Turn this on to have useful information printed to standard out |
Definition at line 1604 of file aligner.h.
EMData * RT3DSymmetryAligner::align | ( | EMData * | this_img, | |
EMData * | to_img, | |||
const string & | cmp_name = "ccc.tomo" , |
|||
const Dict & | cmp_params = Dict() | |||
) | const [virtual] |
See Aligner comments for more details.
Implements EMAN::Aligner.
Definition at line 2632 of file aligner.cpp.
References EMAN::EMData::process(), EMAN::EMData::set_attr(), and xform_align_nbest().
Referenced by align().
02633 { 02634 02635 vector<Dict> alis = xform_align_nbest(this_img,to,1,cmp_name,cmp_params); 02636 02637 Transform* tr = (Transform*) alis[0]["xform.align3d"]; 02638 EMData* soln = this_img->process("xform",Dict("transform",tr)); 02639 soln->set_attr("xform.align3d",tr); 02640 delete tr; tr = 0; 02641 02642 return soln; 02643 02644 }
virtual string EMAN::RT3DSymmetryAligner::get_desc | ( | ) | const [inline, virtual] |
virtual string EMAN::RT3DSymmetryAligner::get_name | ( | ) | const [inline, virtual] |
virtual TypeDict EMAN::RT3DSymmetryAligner::get_param_types | ( | ) | const [inline, virtual] |
Implements EMAN::Aligner.
Definition at line 1638 of file aligner.h.
References EMAN::EMObject::BOOL, EMAN::EMObject::FLOAT, EMAN::TypeDict::put(), and EMAN::EMObject::TRANSFORM.
01639 { 01640 TypeDict d; 01641 d.put("sym", EMObject::FLOAT,"The symmetry. Default is icos"); 01642 d.put("transform", EMObject::TRANSFORM,"The transform to move to symmetry axis"); 01643 d.put("verbose", EMObject::BOOL,"Turn this on to have useful information printed to standard out."); 01644 return d; 01645 }
static Aligner* EMAN::RT3DSymmetryAligner::NEW | ( | ) | [inline, static] |
vector< Dict > RT3DSymmetryAligner::xform_align_nbest | ( | EMData * | this_img, | |
EMData * | to_img, | |||
const unsigned int | nsoln, | |||
const string & | cmp_name, | |||
const Dict & | cmp_params | |||
) | const [virtual] |
See Aligner comments for more details.
Reimplemented from EMAN::Aligner.
Definition at line 2646 of file aligner.cpp.
References copy(), EMAN::Symmetry3D::get_symmetries(), EMAN::Dict::has_key(), EMAN::Aligner::params, EMAN::EMData::process(), EMAN::Dict::set_default(), and t.
Referenced by align().
02647 { 02648 02649 bool verbose = params.set_default("verbose",false); 02650 Transform* ixform; 02651 if (params.has_key("transform") ) { 02652 ixform = params["transform"]; 02653 }else{ 02654 ixform = new Transform(); // is the identity 02655 } 02656 02657 //Initialize a soln dict 02658 vector<Dict> solns; 02659 if (nsoln == 0) return solns; // What was the user thinking? 02660 for (unsigned int i = 0; i < nsoln; ++i ) { 02661 Dict d; 02662 d["score"] = 1.e24; 02663 Transform t; // identity by default 02664 d["xform.align3d"] = &t; // deep copy is going on here 02665 solns.push_back(d); 02666 } 02667 02668 #ifdef EMAN2_USING_CUDA 02669 if(EMData::usecuda == 1) { 02670 cout << "Using CUDA for 3D sym alignment" << endl; 02671 if(!this_img->getcudarwdata()) this_img->copy_to_cudaro(); 02672 if(!to->getcudarwdata()) to->copy_to_cuda(); 02673 } 02674 #endif 02675 02676 //Generate symmetry related orientations 02677 vector<Transform> syms = Symmetry3D::get_symmetries((string)params.set_default("sym","icos")); 02678 Cmp* c = Factory <Cmp>::get(cmp_name, cmp_params); 02679 02680 float score = 0.0f; 02681 for ( vector<Transform>::const_iterator symit = syms.begin(); symit != syms.end(); ++symit ) { 02682 //Here move to sym position and compute the score 02683 Transform sympos = (*symit)*(*ixform); 02684 EMData* transformed = this_img->process("xform",Dict("transform", &sympos)); 02685 score = c->cmp(transformed,to); 02686 delete transformed; transformed = 0; 02687 02688 if (verbose) { 02689 Dict rots = sympos.get_rotation("eman"); 02690 cout <<"Score is: " << score << " az " << float(rots["az"]) << " alt " << float(rots["alt"]) << " phi " << float(rots["phi"]) << endl; 02691 } 02692 02693 unsigned int j = 0; 02694 for ( vector<Dict>::iterator it = solns.begin(); it != solns.end(); ++it, ++j ) { 02695 if ( (float)(*it)["score"] > score ) { // Note greater than - EMAN2 preferes minimums as a matter of policy 02696 vector<Dict>::reverse_iterator rit = solns.rbegin(); 02697 copy(rit+1,solns.rend()-j,rit); 02698 Dict& d = (*it); 02699 d["score"] = score; 02700 d["xform.align3d"] = &sympos; // deep copy is going on here 02701 break; 02702 } 02703 } 02704 } 02705 02706 if (c != 0) delete c; 02707 02708 return solns; 02709 }
const string RT3DSymmetryAligner::NAME = "rotate_symmetry_3d" [static] |