#include <aligner.h>
Inheritance diagram for EMAN::RotateTranslateFlipAlignerIterative:
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_iterative" |
flip | ||
r1 | inner ring | |
r2 | outer ring | |
maxiter | maximum number of alignment iterations | |
maxshift | Maximum translation in pixels |
Definition at line 919 of file aligner.h.
virtual EMData* EMAN::RotateTranslateFlipAlignerIterative::align | ( | EMData * | this_img, | |
EMData * | to_img | |||
) | const [inline, virtual] |
Implements EMAN::Aligner.
Definition at line 924 of file aligner.h.
References align().
00925 { 00926 return align(this_img, to_img, "sqeuclidean", Dict()); 00927 }
EMData * RotateTranslateFlipAlignerIterative::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 842 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().
00844 { 00845 // Get the non flipped rotational, tranlsationally aligned image 00846 Dict rt_params("maxshift", params["maxshift"],"r1",params.set_default("r1",-1),"r2",params.set_default("r2",-1)); 00847 EMData *rot_trans_align = this_img->align("rotate_translate_iterative",to,rt_params,cmp_name, cmp_params); 00848 00849 // Do the same alignment, but using the flipped version of the image 00850 EMData *flipped = params.set_default("flip", (EMData *) 0); 00851 bool delete_flag = false; 00852 if (flipped == 0) { 00853 flipped = to->process("xform.flip", Dict("axis", "x")); 00854 delete_flag = true; 00855 } 00856 00857 EMData * rot_trans_align_flip = this_img->align("rotate_translate_iterative", flipped, rt_params, cmp_name, cmp_params); 00858 Transform* t = rot_trans_align_flip->get_attr("xform.align2d"); 00859 t->set_mirror(true); 00860 rot_trans_align_flip->set_attr("xform.align2d",t); 00861 delete t; 00862 00863 // Now finally decide on what is the best answer 00864 float cmp1 = rot_trans_align->cmp(cmp_name, to, cmp_params); 00865 float cmp2 = rot_trans_align_flip->cmp(cmp_name, flipped, cmp_params); 00866 00867 if (delete_flag){ 00868 if(flipped) { 00869 delete flipped; 00870 flipped = 0; 00871 } 00872 } 00873 00874 EMData *result = 0; 00875 if (cmp1 < cmp2 ) { 00876 00877 if( rot_trans_align_flip ) { 00878 delete rot_trans_align_flip; 00879 rot_trans_align_flip = 0; 00880 } 00881 result = rot_trans_align; 00882 } 00883 else { 00884 if( rot_trans_align ) { 00885 delete rot_trans_align; 00886 rot_trans_align = 0; 00887 } 00888 result = rot_trans_align_flip; 00889 result->process_inplace("xform.flip",Dict("axis","x")); 00890 } 00891 00892 return result; 00893 }
virtual string EMAN::RotateTranslateFlipAlignerIterative::get_desc | ( | ) | const [inline, virtual] |
Implements EMAN::Aligner.
Definition at line 934 of file aligner.h.
00935 { 00936 return " Does two 'rotate_translate.iterative' alignments, one to accommodate for possible handedness change. Decided which alignment is better using a comparitor and returns the aligned image as the solution"; 00937 }
virtual string EMAN::RotateTranslateFlipAlignerIterative::get_name | ( | ) | const [inline, virtual] |
virtual TypeDict EMAN::RotateTranslateFlipAlignerIterative::get_param_types | ( | ) | const [inline, virtual] |
Implements EMAN::Aligner.
Definition at line 944 of file aligner.h.
References static_get_param_types().
00945 { 00946 return static_get_param_types(); 00947 }
static Aligner* EMAN::RotateTranslateFlipAlignerIterative::NEW | ( | ) | [inline, static] |
static TypeDict EMAN::RotateTranslateFlipAlignerIterative::static_get_param_types | ( | ) | [inline, static] |
Definition at line 949 of file aligner.h.
References EMAN::EMObject::EMDATA, EMAN::EMObject::INT, and EMAN::TypeDict::put().
Referenced by get_param_types().
00949 { 00950 TypeDict d; 00951 d.put("flip", EMObject::EMDATA); 00952 d.put("r1", EMObject::INT, "Inner ring, pixels"); 00953 d.put("r2", EMObject::INT, "Outer ring, pixels"); 00954 d.put("maxiter", EMObject::INT, "Maximum number of iterations"); 00955 d.put("maxshift", EMObject::INT, "Maximum translation in pixels"); 00956 return d; 00957 }
const string RotateTranslateFlipAlignerIterative::NAME = "rotate_translate_flip_iterative" [static] |