#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 1296 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 2449 of file aligner.cpp.
References EMAN::EMData::process(), EMAN::EMData::set_attr(), and xform_align_nbest().
Referenced by align().
02450 { 02451 02452 vector<Dict> alis = xform_align_nbest(this_img,to,1,cmp_name,cmp_params); 02453 02454 Transform* tr = (Transform*) alis[0]["xform.align3d"]; 02455 EMData* soln = this_img->process("xform",Dict("transform",tr)); 02456 soln->set_attr("xform.align3d",tr); 02457 delete tr; tr = 0; 02458 02459 return soln; 02460 02461 }
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 1330 of file aligner.h.
References EMAN::EMObject::BOOL, EMAN::EMObject::FLOAT, and EMAN::TypeDict::put().
01331 { 01332 TypeDict d; 01333 d.put("sym", EMObject::FLOAT,"The symmetry. Default is icos"); 01334 d.put("verbose", EMObject::BOOL,"Turn this on to have useful information printed to standard out."); 01335 return d; 01336 }
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 2463 of file aligner.cpp.
References copy(), EMAN::Symmetry3D::get_symmetries(), EMAN::Aligner::params, EMAN::EMData::process(), EMAN::Dict::set_default(), and t.
Referenced by align().
02464 { 02465 02466 bool verbose = params.set_default("verbose",false); 02467 //Initialize a soln dict 02468 vector<Dict> solns; 02469 if (nsoln == 0) return solns; // What was the user thinking? 02470 for (unsigned int i = 0; i < nsoln; ++i ) { 02471 Dict d; 02472 d["score"] = 1.e24; 02473 Transform t; // identity by default 02474 d["xform.align3d"] = &t; // deep copy is going on here 02475 solns.push_back(d); 02476 } 02477 02478 #ifdef EMAN2_USING_CUDA 02479 if(EMData::usecuda == 1) { 02480 cout << "Using CUDA for 3D sym alignment" << endl; 02481 if(!this_img->getcudarwdata()) this_img->copy_to_cuda(); 02482 if(!to->getcudarwdata()) to->copy_to_cuda(); 02483 } 02484 #endif 02485 02486 //Genrate symmetry related orritenations 02487 vector<Transform> syms = Symmetry3D::get_symmetries((string)params.set_default("sym","icos")); 02488 Cmp* c = Factory <Cmp>::get(cmp_name, cmp_params); 02489 02490 float score = 0.0f; 02491 for ( vector<Transform>::const_iterator symit = syms.begin(); symit != syms.end(); ++symit ) { 02492 //Here move to sym position and compute the score 02493 Transform sympos = *symit; 02494 EMData* transformed = this_img->process("xform",Dict("transform", &sympos)); 02495 score = c->cmp(transformed,to); 02496 delete transformed; transformed = 0; 02497 02498 if (verbose) { 02499 Dict rots = sympos.get_rotation("eman"); 02500 cout <<"Score is: " << score << " az " << float(rots["az"]) << " alt " << float(rots["alt"]) << " phi " << float(rots["phi"]) << endl; 02501 } 02502 02503 unsigned int j = 0; 02504 for ( vector<Dict>::iterator it = solns.begin(); it != solns.end(); ++it, ++j ) { 02505 if ( (float)(*it)["score"] > score ) { // Note greater than - EMAN2 preferes minimums as a matter of policy 02506 vector<Dict>::reverse_iterator rit = solns.rbegin(); 02507 copy(rit+1,solns.rend()-j,rit); 02508 Dict& d = (*it); 02509 d["score"] = score; 02510 d["xform.align3d"] = &sympos; // deep copy is going on here 02511 break; 02512 } 02513 } 02514 } 02515 02516 //Free up resources (for an expensive opperation like this move data to and from device is a small % of time) 02517 #ifdef EMAN2_USING_CUDA 02518 this_img->ro_free(); 02519 this_img->rw_free(); 02520 to->rw_free(); 02521 #endif 02522 02523 return solns; 02524 }
const string RT3DSymmetryAligner::NAME = "rotate_symmetry_3d" [static] |