#include <aligner.h>
Inheritance diagram for EMAN::RotateTranslateFlipAligner:
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 TypeDict | static_get_param_types () |
Static Public Attributes | |
static const string | NAME = "rotate_translate_flip" |
flip | ||
usedot | ||
maxshift | Maximum translation in pixels | |
rfp_mode | Either 0,1 or 2. A temporary flag for testing the rotational foot print |
Definition at line 431 of file aligner.h.
virtual EMData* EMAN::RotateTranslateFlipAligner::align | ( | EMData * | this_img, | |
EMData * | to_img | |||
) | const [inline, virtual] |
Implements EMAN::Aligner.
Definition at line 436 of file aligner.h.
References align().
00437 { 00438 return align(this_img, to_img, "sqeuclidean", Dict()); 00439 }
EMData * RotateTranslateFlipAligner::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 419 of file aligner.cpp.
References EMAN::EMData::align(), EMAN::EMData::cmp(), cmp1(), cmp2(), EMAN::EMData::get_attr(), EMAN::Aligner::params, EMAN::EMData::process(), EMAN::EMData::process_inplace(), EMAN::EMData::set_attr(), EMAN::Dict::set_default(), and t.
Referenced by align().
00421 { 00422 // Get the non flipped rotational, tranlsationally aligned image 00423 Dict rt_params("maxshift", params["maxshift"], "rfp_mode", params.set_default("rfp_mode",0),"useflcf",params.set_default("useflcf",0)); 00424 EMData *rot_trans_align = this_img->align("rotate_translate",to,rt_params,cmp_name, cmp_params); 00425 00426 // Do the same alignment, but using the flipped version of the image 00427 EMData *flipped = params.set_default("flip", (EMData *) 0); 00428 bool delete_flag = false; 00429 if (flipped == 0) { 00430 flipped = to->process("xform.flip", Dict("axis", "x")); 00431 delete_flag = true; 00432 } 00433 00434 EMData * rot_trans_align_flip = this_img->align("rotate_translate", flipped, rt_params, cmp_name, cmp_params); 00435 Transform* t = rot_trans_align_flip->get_attr("xform.align2d"); 00436 t->set_mirror(true); 00437 rot_trans_align_flip->set_attr("xform.align2d",t); 00438 delete t; 00439 00440 // Now finally decide on what is the best answer 00441 float cmp1 = rot_trans_align->cmp(cmp_name, to, cmp_params); 00442 float cmp2 = rot_trans_align_flip->cmp(cmp_name, flipped, cmp_params); 00443 00444 if (delete_flag){ 00445 if(flipped) { 00446 delete flipped; 00447 flipped = 0; 00448 } 00449 } 00450 00451 EMData *result = 0; 00452 if (cmp1 < cmp2 ) { 00453 00454 if( rot_trans_align_flip ) { 00455 delete rot_trans_align_flip; 00456 rot_trans_align_flip = 0; 00457 } 00458 result = rot_trans_align; 00459 } 00460 else { 00461 if( rot_trans_align ) { 00462 delete rot_trans_align; 00463 rot_trans_align = 0; 00464 } 00465 result = rot_trans_align_flip; 00466 result->process_inplace("xform.flip",Dict("axis","x")); 00467 } 00468 00469 return result; 00470 }
virtual string EMAN::RotateTranslateFlipAligner::get_desc | ( | ) | const [inline, virtual] |
Implements EMAN::Aligner.
Definition at line 446 of file aligner.h.
00447 { 00448 return " Does two 'rotate_translate' alignments, one to accommodate for possible handedness change. Decided which alignment is better using a comparitor and returns the aligned image as the solution"; 00449 }
virtual string EMAN::RotateTranslateFlipAligner::get_name | ( | ) | const [inline, virtual] |
virtual TypeDict EMAN::RotateTranslateFlipAligner::get_param_types | ( | ) | const [inline, virtual] |
Implements EMAN::Aligner.
Definition at line 456 of file aligner.h.
References static_get_param_types().
00457 { 00458 return static_get_param_types(); 00459 }
static Aligner* EMAN::RotateTranslateFlipAligner::NEW | ( | ) | [inline, static] |
static TypeDict EMAN::RotateTranslateFlipAligner::static_get_param_types | ( | ) | [inline, static] |
Definition at line 461 of file aligner.h.
References EMAN::EMObject::EMDATA, EMAN::EMObject::INT, and EMAN::TypeDict::put().
Referenced by get_param_types().
00461 { 00462 TypeDict d; 00463 00464 d.put("flip", EMObject::EMDATA); 00465 d.put("usedot", EMObject::INT); 00466 d.put("maxshift", EMObject::INT, "Maximum translation in pixels"); 00467 d.put("rfp_mode", EMObject::INT,"Either 0,1 or 2. A temporary flag for testing the rotational foot print"); 00468 d.put("useflcf", EMObject::INT,"Use Fast Local Correlation Function rather than CCF for translational alignment"); 00469 return d; 00470 }
const string RotateTranslateFlipAligner::NAME = "rotate_translate_flip" [static] |