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