#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 541 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. 00543 { 00544 00545 #ifdef EMAN2_USING_CUDA 00546 if(EMData::usecuda == 1) { 00547 if(!this_img->cudarwdata) this_img->copy_to_cuda(); 00548 if(!to->cudarwdata) to->copy_to_cuda(); 00549 } 00550 #endif 00551 00552 // Get the 180 degree ambiguously rotationally aligned and its 180 degree rotation counterpart 00553 int rfp_mode = params.set_default("rfp_mode",0); 00554 EMData *rot_align = RotationalAligner::align_180_ambiguous(this_img,to,rfp_mode); 00555 Transform * tmp = rot_align->get_attr("xform.align2d"); 00556 Dict rot = tmp->get_rotation("2d"); 00557 float rotate_angle_solution = rot["alpha"]; 00558 delete tmp; 00559 00560 EMData *rot_align_180 = rot_align->copy(); 00561 rot_align_180->process_inplace("math.rotate.180"); 00562 00563 Dict trans_params; 00564 trans_params["intonly"] = 0; 00565 trans_params["maxshift"] = params.set_default("maxshift", -1); 00566 trans_params["useflcf"]=params.set_default("useflcf",0); 00567 00568 // Do the first case translational alignment 00569 trans_params["nozero"] = params.set_default("nozero",false); 00570 EMData* rot_trans = rot_align->align("translational", to, trans_params, cmp_name, cmp_params); 00571 if( rot_align ) { // Clean up 00572 delete rot_align; 00573 rot_align = 0; 00574 } 00575 00576 // Do the second case translational alignment 00577 EMData* rot_180_trans = rot_align_180->align("translational", to, trans_params, cmp_name, cmp_params); 00578 if( rot_align_180 ) { // Clean up 00579 delete rot_align_180; 00580 rot_align_180 = 0; 00581 } 00582 00583 // Finally decide on the result 00584 float cmp1 = rot_trans->cmp(cmp_name, to, cmp_params); 00585 float cmp2 = rot_180_trans->cmp(cmp_name, to, cmp_params); 00586 00587 EMData *result = 0; 00588 if (cmp1 < cmp2) { // Assumes smaller is better - thus all comparitors should support "smaller is better" 00589 if( rot_180_trans ) { 00590 delete rot_180_trans; 00591 rot_180_trans = 0; 00592 } 00593 result = rot_trans; 00594 } 00595 else { 00596 if( rot_trans ) { 00597 delete rot_trans; 00598 rot_trans = 0; 00599 } 00600 result = rot_180_trans; 00601 rotate_angle_solution -= 180.f; 00602 } 00603 00604 Transform* t = result->get_attr("xform.align2d"); 00605 t->set_rotation(Dict("type","2d","alpha",rotate_angle_solution)); 00606 result->set_attr("xform.align2d",t); 00607 delete t; 00608 00609 return result; 00610 }
|
|
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 62 of file aligner.cpp. |