#include <aligner.h>
Inheritance diagram for EMAN::RotationalAlignerIterative:
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 | |
static Aligner * | NEW () |
Static Public Attributes | |
static const string | NAME = "rotational_iterative" |
The advantage of this over the 'regular' rotational alinger is that this is done in real space and does not use invariants.
r1 | inner ring | |
r2 | outer ring |
Definition at line 332 of file aligner.h.
virtual EMData* EMAN::RotationalAlignerIterative::align | ( | EMData * | this_img, | |
EMData * | to_img | |||
) | const [inline, virtual] |
Implements EMAN::Aligner.
Definition at line 338 of file aligner.h.
References align().
00339 { 00340 return align(this_img, to_img, "dot", Dict()); 00341 }
EMData * RotationalAlignerIterative::align | ( | EMData * | this_img, | |
EMData * | to_img, | |||
const string & | cmp_name = "dot" , |
|||
const Dict & | cmp_params = Dict() | |||
) | const [virtual] |
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.
this_img | The image to be compared. | |
to_img | 'this_img" is aligned with 'to_img'. | |
cmp_name | The comparison method to compare the two images. | |
cmp_params | The parameter dictionary for comparison method. |
Implements EMAN::Aligner.
Definition at line 549 of file aligner.cpp.
References EMAN::EMData::calc_ccfx(), data, EMAN::Util::find_max(), EMAN::EMData::get_data(), EMAN::EMData::get_xsize(), EMAN::EMData::get_ysize(), EMAN::Aligner::params, EMAN::EMData::process(), EMAN::EMData::set_attr(), EMAN::Dict::set_default(), and EMAN::EMData::unwrap().
Referenced by align().
00551 { 00552 int r1 = params.set_default("r1",-1); 00553 int r2 = params.set_default("r2",-1); 00554 //to start lest try the original size image. If needed, we can pad it.... 00555 EMData * to_polar = to->unwrap(r1,r2,-1,0,0,true); 00556 EMData * this_img_polar = this_img->unwrap(r1,r2,-1,0,0,true); 00557 int this_img_polar_nx = this_img_polar->get_xsize(); 00558 00559 EMData * cf = this_img_polar->calc_ccfx(to_polar, 0, this_img->get_ysize()); 00560 00561 //take out the garbage 00562 delete to_polar; to_polar = 0; 00563 delete this_img_polar; this_img_polar = 0; 00564 00565 float * data = cf->get_data(); 00566 float peak = 0; 00567 int peak_index = 0; 00568 Util::find_max(data, this_img_polar_nx, &peak, &peak_index); 00569 00570 delete cf; cf = 0; 00571 float rot_angle = (float) (peak_index * 360.0f / this_img_polar_nx); 00572 00573 //return the result 00574 //cout << rot_angle << endl; 00575 Transform tmp(Dict("type","2d","alpha",rot_angle)); 00576 EMData * rotimg=this_img->process("xform",Dict("transform",(Transform*)&tmp)); 00577 rotimg->set_attr("xform.align2d",&tmp); 00578 00579 return rotimg; 00580 00581 }
virtual string EMAN::RotationalAlignerIterative::get_desc | ( | ) | const [inline, virtual] |
virtual string EMAN::RotationalAlignerIterative::get_name | ( | ) | const [inline, virtual] |
virtual TypeDict EMAN::RotationalAlignerIterative::get_param_types | ( | ) | const [inline, virtual] |
Implements EMAN::Aligner.
Definition at line 358 of file aligner.h.
References EMAN::EMObject::INT, and EMAN::TypeDict::put().
00359 { 00360 TypeDict d; 00361 d.put("r1", EMObject::INT, "Inner ring, pixels"); 00362 d.put("r2", EMObject::INT, "Outer ring, pixels"); 00363 return d; 00364 }
static Aligner* EMAN::RotationalAlignerIterative::NEW | ( | ) | [inline, static] |
const string RotationalAlignerIterative::NAME = "rotational_iterative" [static] |