#include <aligner.h>
Inheritance diagram for EMAN::RotatePrecenterAligner:
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_precenter" |
Definition at line 302 of file aligner.h.
|
Implements EMAN::Aligner. Definition at line 308 of file aligner.h. References align(). 00309 { 00310 return align(this_img, to_img, "dot", Dict()); 00311 }
|
|
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 349 of file aligner.cpp. References EMAN::Util::calc_best_fft_size(), EMAN::EMData::calc_ccfx(), data, EMAN::Util::find_max(), EMAN::EMData::get_data(), EMAN::EMData::get_ysize(), ny, EMAN::EMData::process(), EMAN::EMData::set_attr(), EMAN::Transform::set_rotation(), and EMAN::EMData::unwrap(). 00351 { 00352 if (!to) { 00353 return 0; 00354 } 00355 00356 int ny = this_img->get_ysize(); 00357 int size = Util::calc_best_fft_size((int) (M_PI * ny * 1.5)); 00358 EMData *e1 = this_img->unwrap(4, ny * 7 / 16, size, 0, 0, 1); 00359 EMData *e2 = to->unwrap(4, ny * 7 / 16, size, 0, 0, 1); 00360 EMData *cf = e1->calc_ccfx(e2, 0, ny); 00361 00362 float *data = cf->get_data(); 00363 00364 float peak = 0; 00365 int peak_index = 0; 00366 Util::find_max(data, size, &peak, &peak_index); 00367 float a = (float) ((1.0f - 1.0f * peak_index / size) * 180. * 2); 00368 00369 Transform rot; 00370 rot.set_rotation(Dict("type","2d","alpha",(float)(a*180./M_PI))); 00371 EMData* rslt = this_img->process("xform",Dict("transform",&rot)); 00372 rslt->set_attr("xform.align2d",&rot); 00373 // 00374 // Transform* t = get_set_align_attr("xform.align2d",rslt,this_img); 00375 // t->set_rotation(Dict("type","2d","alpha",-a)); 00376 // 00377 // EMData* result this_img->transform(Dict("type","2d","alpha",(float)(a*180./M_PI))); 00378 // 00379 // cf->set_attr("xform.align2d",t); 00380 // delete t; 00381 // cf->update(); 00382 00383 if( e1 ) 00384 { 00385 delete e1; 00386 e1 = 0; 00387 } 00388 00389 if( e2 ) 00390 { 00391 delete e2; 00392 e2 = 0; 00393 } 00394 00395 if (cf) { 00396 delete cf; 00397 cf = 0; 00398 } 00399 return rslt; 00400 }
|
|
Implements EMAN::Aligner. Definition at line 318 of file aligner.h. 00319 { 00320 return "Performs rotational alignment and works accurately if the image is precentered"; 00321 }
|
|
Get the Aligner's name. Each Aligner is identified by a unique name.
Implements EMAN::Aligner. Definition at line 313 of file aligner.h. 00314 {
00315 return NAME;
00316 }
|
|
Implements EMAN::Aligner. Definition at line 328 of file aligner.h. 00329 {
00330 TypeDict d;
00331 return d;
00332 }
|
|
Definition at line 323 of file aligner.h. 00324 { 00325 return new RotatePrecenterAligner(); 00326 }
|
|
Definition at line 61 of file aligner.cpp. |