#include <aligner.h>
Inheritance diagram for EMAN::RotateTranslateAligner:
Public Member Functions | |
virtual EMData * | align (EMData *this_img, EMData *to_img, const string &cmp_name="dot", const Dict &cmp_params=Dict()) const |
To align 'this_img' with another image passed in through its parameters. | |
virtual EMData * | align (EMData *this_img, EMData *to_img) const |
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_translate" |
maxshift | Maximum translation in pixels | |
nozero | Zero translation not permitted (useful for CCD images) | |
rfp_mode | Either 0,1 or 2. A temporary flag for testing the rotational foot print |
Definition at line 410 of file aligner.h.
virtual EMData* EMAN::RotateTranslateAligner::align | ( | EMData * | this_img, | |
EMData * | to_img | |||
) | const [inline, virtual] |
Implements EMAN::Aligner.
Definition at line 416 of file aligner.h.
References align().
00417 { 00418 return align(this_img, to_img, "sqeuclidean", Dict()); 00419 }
EMData * RotateTranslateAligner::align | ( | EMData * | this_img, | |
EMData * | to_img, | |||
const string & | cmp_name = "dot" , |
|||
const Dict & | cmp_params = Dict() | |||
) | const [virtual] |
To align 'this_img' with another image passed in through its parameters.
The alignment uses a user-given comparison method to compare the two images. If none is given, a default one is used.
this_img | The image to be compared. | |
to_img | 'this_img" is aligned with 'to_img'. | |
cmp_name | The comparison method to compare the two images. | |
cmp_params | The parameter dictionary for comparison method. |
Implements EMAN::Aligner.
Definition at line 688 of file aligner.cpp.
References EMAN::EMData::align(), EMAN::RotationalAligner::align_180_ambiguous(), EMAN::EMData::cmp(), cmp1(), cmp2(), EMAN::EMData::copy(), EMAN::EMData::get_attr(), EMAN::Transform::get_rotation(), EMAN::Aligner::params, EMAN::EMData::process_inplace(), EMAN::EMData::set_attr(), EMAN::Dict::set_default(), and t.
Referenced by align().
00690 { 00691 00692 #ifdef EMAN2_USING_CUDA 00693 if(EMData::usecuda == 1) { 00694 //if(!this_img->getcudarwdata()) this_img->copy_to_cuda(); 00695 //if(!to->getcudarwdata()) to->copy_to_cuda(); 00696 } 00697 #endif 00698 00699 // Get the 180 degree ambiguously rotationally aligned and its 180 degree rotation counterpart 00700 int rfp_mode = params.set_default("rfp_mode",0); 00701 EMData *rot_align = RotationalAligner::align_180_ambiguous(this_img,to,rfp_mode); 00702 Transform * tmp = rot_align->get_attr("xform.align2d"); 00703 Dict rot = tmp->get_rotation("2d"); 00704 float rotate_angle_solution = rot["alpha"]; 00705 delete tmp; 00706 00707 EMData *rot_align_180 = rot_align->copy(); 00708 rot_align_180->process_inplace("math.rotate.180"); 00709 00710 Dict trans_params; 00711 trans_params["intonly"] = 0; 00712 trans_params["maxshift"] = params.set_default("maxshift", -1); 00713 trans_params["useflcf"]=params.set_default("useflcf",0); 00714 00715 // Do the first case translational alignment 00716 trans_params["nozero"] = params.set_default("nozero",false); 00717 EMData* rot_trans = rot_align->align("translational", to, trans_params, cmp_name, cmp_params); 00718 if( rot_align ) { // Clean up 00719 delete rot_align; 00720 rot_align = 0; 00721 } 00722 00723 // Do the second case translational alignment 00724 EMData* rot_180_trans = rot_align_180->align("translational", to, trans_params, cmp_name, cmp_params); 00725 if( rot_align_180 ) { // Clean up 00726 delete rot_align_180; 00727 rot_align_180 = 0; 00728 } 00729 00730 // Finally decide on the result 00731 float cmp1 = rot_trans->cmp(cmp_name, to, cmp_params); 00732 float cmp2 = rot_180_trans->cmp(cmp_name, to, cmp_params); 00733 00734 EMData *result = 0; 00735 if (cmp1 < cmp2) { // Assumes smaller is better - thus all comparitors should support "smaller is better" 00736 if( rot_180_trans ) { 00737 delete rot_180_trans; 00738 rot_180_trans = 0; 00739 } 00740 result = rot_trans; 00741 } 00742 else { 00743 if( rot_trans ) { 00744 delete rot_trans; 00745 rot_trans = 0; 00746 } 00747 result = rot_180_trans; 00748 rotate_angle_solution -= 180.f; 00749 } 00750 00751 Transform* t = result->get_attr("xform.align2d"); 00752 t->set_rotation(Dict("type","2d","alpha",rotate_angle_solution)); 00753 result->set_attr("xform.align2d",t); 00754 delete t; 00755 00756 return result; 00757 }
virtual string EMAN::RotateTranslateAligner::get_desc | ( | ) | const [inline, virtual] |
Implements EMAN::Aligner.
Definition at line 426 of file aligner.h.
00427 { 00428 return "Performs rotational alignment and follows this with translational alignment."; 00429 }
virtual string EMAN::RotateTranslateAligner::get_name | ( | ) | const [inline, virtual] |
virtual TypeDict EMAN::RotateTranslateAligner::get_param_types | ( | ) | const [inline, virtual] |
Implements EMAN::Aligner.
Definition at line 436 of file aligner.h.
References EMAN::EMObject::INT, and EMAN::TypeDict::put().
00437 { 00438 TypeDict d; 00439 //d.put("usedot", EMObject::INT); 00440 d.put("maxshift", EMObject::INT, "Maximum translation in pixels"); 00441 d.put("nozero", EMObject::INT,"Zero translation not permitted (useful for CCD images)"); 00442 d.put("rfp_mode", EMObject::INT,"Either 0,1 or 2. A temporary flag for testing the rotational foot print"); 00443 d.put("useflcf", EMObject::INT,"Use Fast Local Correlation Function rather than CCF for translational alignment"); 00444 return d; 00445 }
static Aligner* EMAN::RotateTranslateAligner::NEW | ( | ) | [inline, static] |
const string RotateTranslateAligner::NAME = "rotate_translate" [static] |