#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 412 of file aligner.h.
virtual EMData* EMAN::RotateTranslateAligner::align | ( | EMData * | this_img, | |
EMData * | to_img | |||
) | const [inline, virtual] |
Implements EMAN::Aligner.
Definition at line 418 of file aligner.h.
References align().
00419 { 00420 return align(this_img, to_img, "sqeuclidean", Dict()); 00421 }
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 706 of file aligner.cpp.
References EMAN::EMData::align(), EMAN::RotationalAligner::align_180_ambiguous(), EMAN::EMData::cmp(), cmp1(), cmp2(), EMAN::EMData::get_attr(), EMAN::Transform::get_rotation(), EMAN::Aligner::params, EMAN::EMData::process(), EMAN::EMData::set_attr(), EMAN::Dict::set_default(), and t.
Referenced by align().
00708 { 00709 00710 #ifdef EMAN2_USING_CUDA 00711 if(EMData::usecuda == 1) { 00712 //if(!this_img->getcudarwdata()) this_img->copy_to_cuda(); 00713 //if(!to->getcudarwdata()) to->copy_to_cuda(); 00714 } 00715 #endif 00716 00717 // Get the 180 degree ambiguously rotationally aligned and its 180 degree rotation counterpart 00718 int zscore = params.set_default("zscore",0); 00719 int rfp_mode = params.set_default("rfp_mode",2); 00720 EMData *rot_align = RotationalAligner::align_180_ambiguous(this_img,to,rfp_mode,zscore); 00721 Transform * tmp = rot_align->get_attr("xform.align2d"); 00722 Dict rot = tmp->get_rotation("2d"); 00723 float rotate_angle_solution = rot["alpha"]; 00724 delete tmp; 00725 00726 EMData *rot_align_180 = rot_align->process("math.rotate.180"); 00727 00728 Dict trans_params; 00729 trans_params["intonly"] = 0; 00730 trans_params["maxshift"] = params.set_default("maxshift", -1); 00731 trans_params["useflcf"]=params.set_default("useflcf",0); 00732 00733 // Do the first case translational alignment 00734 trans_params["nozero"] = params.set_default("nozero",false); 00735 EMData* rot_trans = rot_align->align("translational", to, trans_params, cmp_name, cmp_params); 00736 if( rot_align ) { // Clean up 00737 delete rot_align; 00738 rot_align = 0; 00739 } 00740 00741 // Do the second case translational alignment 00742 EMData* rot_180_trans = rot_align_180->align("translational", to, trans_params, cmp_name, cmp_params); 00743 if( rot_align_180 ) { // Clean up 00744 delete rot_align_180; 00745 rot_align_180 = 0; 00746 } 00747 00748 // Finally decide on the result 00749 float cmp1 = rot_trans->cmp(cmp_name, to, cmp_params); 00750 float cmp2 = rot_180_trans->cmp(cmp_name, to, cmp_params); 00751 00752 EMData *result = 0; 00753 if (cmp1 < cmp2) { // All comparators are defined so default return is "smaller is better" 00754 if( rot_180_trans ) { 00755 delete rot_180_trans; 00756 rot_180_trans = 0; 00757 } 00758 result = rot_trans; 00759 } 00760 else { 00761 if( rot_trans ) { 00762 delete rot_trans; 00763 rot_trans = 0; 00764 } 00765 result = rot_180_trans; 00766 rotate_angle_solution -= 180.f; 00767 } 00768 00769 Transform* t = result->get_attr("xform.align2d"); 00770 t->set_rotation(Dict("type","2d","alpha",rotate_angle_solution)); 00771 result->set_attr("xform.align2d",t); 00772 delete t; 00773 00774 return result; 00775 }
virtual string EMAN::RotateTranslateAligner::get_desc | ( | ) | const [inline, virtual] |
Implements EMAN::Aligner.
Definition at line 428 of file aligner.h.
00429 { 00430 return "Performs rotational alignment and follows this with translational alignment."; 00431 }
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 438 of file aligner.h.
References EMAN::EMObject::INT, and EMAN::TypeDict::put().
00439 { 00440 TypeDict d; 00441 //d.put("usedot", EMObject::INT); 00442 d.put("maxshift", EMObject::INT, "Maximum translation in pixels"); 00443 d.put("nozero", EMObject::INT,"Zero translation not permitted (useful for CCD images)"); 00444 d.put("rfp_mode", EMObject::INT,"Either 0,1 or 2. A temporary flag for testing the rotational foot print"); 00445 d.put("useflcf", EMObject::INT,"Use Fast Local Correlation Function rather than CCF for translational alignment"); 00446 d.put("zscore", EMObject::INT,"Either 0 or 1. This option is passed directly to the rotational aligner (default=false)"); 00447 return d; 00448 }
static Aligner* EMAN::RotateTranslateAligner::NEW | ( | ) | [inline, static] |
const string RotateTranslateAligner::NAME = "rotate_translate" [static] |