#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 | |
Aligner * | NEW () |
Static Public Attributes | |
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 343 of file aligner.h.
|
Implements EMAN::Aligner. Definition at line 349 of file aligner.h. References align(). 00350 { 00351 return align(this_img, to_img, "sqeuclidean", Dict()); 00352 }
|
|
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.
Implements EMAN::Aligner. Definition at line 549 of file aligner.cpp. References EMAN::EMData::align(), EMAN::RotationalAligner::align_180_ambiguous(), EMAN::EMData::cmp(), EMAN::EMData::copy(), EMAN::EMData::get_attr(), EMAN::Transform::get_rotation(), EMAN::EMData::process_inplace(), EMAN::EMData::set_attr(), EMAN::Dict::set_default(), EMAN::Transform::set_rotation(), and t. 00551 { 00552 00553 #ifdef EMAN2_USING_CUDA 00554 if(EMData::usecuda == 1) { 00555 //if(!this_img->getcudarwdata()) this_img->copy_to_cuda(); 00556 //if(!to->getcudarwdata()) to->copy_to_cuda(); 00557 } 00558 #endif 00559 00560 // Get the 180 degree ambiguously rotationally aligned and its 180 degree rotation counterpart 00561 int rfp_mode = params.set_default("rfp_mode",0); 00562 EMData *rot_align = RotationalAligner::align_180_ambiguous(this_img,to,rfp_mode); 00563 Transform * tmp = rot_align->get_attr("xform.align2d"); 00564 Dict rot = tmp->get_rotation("2d"); 00565 float rotate_angle_solution = rot["alpha"]; 00566 delete tmp; 00567 00568 EMData *rot_align_180 = rot_align->copy(); 00569 rot_align_180->process_inplace("math.rotate.180"); 00570 00571 Dict trans_params; 00572 trans_params["intonly"] = 0; 00573 trans_params["maxshift"] = params.set_default("maxshift", -1); 00574 trans_params["useflcf"]=params.set_default("useflcf",0); 00575 00576 // Do the first case translational alignment 00577 trans_params["nozero"] = params.set_default("nozero",false); 00578 EMData* rot_trans = rot_align->align("translational", to, trans_params, cmp_name, cmp_params); 00579 if( rot_align ) { // Clean up 00580 delete rot_align; 00581 rot_align = 0; 00582 } 00583 00584 // Do the second case translational alignment 00585 EMData* rot_180_trans = rot_align_180->align("translational", to, trans_params, cmp_name, cmp_params); 00586 if( rot_align_180 ) { // Clean up 00587 delete rot_align_180; 00588 rot_align_180 = 0; 00589 } 00590 00591 // Finally decide on the result 00592 float cmp1 = rot_trans->cmp(cmp_name, to, cmp_params); 00593 float cmp2 = rot_180_trans->cmp(cmp_name, to, cmp_params); 00594 00595 EMData *result = 0; 00596 if (cmp1 < cmp2) { // Assumes smaller is better - thus all comparitors should support "smaller is better" 00597 if( rot_180_trans ) { 00598 delete rot_180_trans; 00599 rot_180_trans = 0; 00600 } 00601 result = rot_trans; 00602 } 00603 else { 00604 if( rot_trans ) { 00605 delete rot_trans; 00606 rot_trans = 0; 00607 } 00608 result = rot_180_trans; 00609 rotate_angle_solution -= 180.f; 00610 } 00611 00612 Transform* t = result->get_attr("xform.align2d"); 00613 t->set_rotation(Dict("type","2d","alpha",rotate_angle_solution)); 00614 result->set_attr("xform.align2d",t); 00615 delete t; 00616 00617 return result; 00618 }
|
|
Implements EMAN::Aligner. Definition at line 359 of file aligner.h. 00360 { 00361 return "Performs rotational alignment and follows this with translational alignment."; 00362 }
|
|
Get the Aligner's name. Each Aligner is identified by a unique name.
Implements EMAN::Aligner. Definition at line 354 of file aligner.h. 00355 {
00356 return NAME;
00357 }
|
|
Implements EMAN::Aligner. Definition at line 369 of file aligner.h. References EMAN::TypeDict::put(). 00370 { 00371 TypeDict d; 00372 //d.put("usedot", EMObject::INT); 00373 d.put("maxshift", EMObject::INT, "Maximum translation in pixels"); 00374 d.put("nozero", EMObject::INT,"Zero translation not permitted (useful for CCD images)"); 00375 d.put("rfp_mode", EMObject::INT,"Either 0,1 or 2. A temporary flag for testing the rotational foot print"); 00376 d.put("useflcf", EMObject::INT,"Use Fast Local Correlation Function rather than CCF for translational alignment"); 00377 return d; 00378 }
|
|
Definition at line 364 of file aligner.h. 00365 { 00366 return new RotateTranslateAligner(); 00367 }
|
|
Definition at line 63 of file aligner.cpp. |