#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 299 of file aligner.h.
|
Implements EMAN::Aligner. Definition at line 305 of file aligner.h. References align(). 00306 { 00307 return align(this_img, to_img, "dot", Dict()); 00308 }
|
|
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 306 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(). 00308 { 00309 if (!to) { 00310 return 0; 00311 } 00312 00313 int ny = this_img->get_ysize(); 00314 int size = Util::calc_best_fft_size((int) (M_PI * ny * 1.5)); 00315 EMData *e1 = this_img->unwrap(4, ny * 7 / 16, size, 0, 0, 1); 00316 EMData *e2 = to->unwrap(4, ny * 7 / 16, size, 0, 0, 1); 00317 EMData *cf = e1->calc_ccfx(e2, 0, ny); 00318 00319 float *data = cf->get_data(); 00320 00321 float peak = 0; 00322 int peak_index = 0; 00323 Util::find_max(data, size, &peak, &peak_index); 00324 float a = (float) ((1.0f - 1.0f * peak_index / size) * 180. * 2); 00325 00326 Transform rot; 00327 rot.set_rotation(Dict("type","2d","alpha",(float)(a*180./M_PI))); 00328 EMData* rslt = this_img->process("xform",Dict("transform",&rot)); 00329 rslt->set_attr("xform.align2d",&rot); 00330 // 00331 // Transform* t = get_set_align_attr("xform.align2d",rslt,this_img); 00332 // t->set_rotation(Dict("type","2d","alpha",-a)); 00333 // 00334 // EMData* result this_img->transform(Dict("type","2d","alpha",(float)(a*180./M_PI))); 00335 // 00336 // cf->set_attr("xform.align2d",t); 00337 // delete t; 00338 // cf->update(); 00339 00340 if( e1 ) 00341 { 00342 delete e1; 00343 e1 = 0; 00344 } 00345 00346 if( e2 ) 00347 { 00348 delete e2; 00349 e2 = 0; 00350 } 00351 00352 if (cf) { 00353 delete cf; 00354 cf = 0; 00355 } 00356 return rslt; 00357 }
|
|
Implements EMAN::Aligner. Definition at line 315 of file aligner.h. 00316 { 00317 return "Performs rotational alignment and works accurately if the image is precentered"; 00318 }
|
|
Get the Aligner's name. Each Aligner is identified by a unique name.
Implements EMAN::Aligner. Definition at line 310 of file aligner.h. 00311 {
00312 return NAME;
00313 }
|
|
Implements EMAN::Aligner. Definition at line 325 of file aligner.h. 00326 {
00327 TypeDict d;
00328 return d;
00329 }
|
|
Definition at line 320 of file aligner.h. 00321 { 00322 return new RotatePrecenterAligner(); 00323 }
|
|
Definition at line 56 of file aligner.cpp. |