EMAN2
Public Member Functions | Static Public Member Functions | Static Public Attributes
EMAN::RotationalAlignerIterative Class Reference

rotational alignment using the iterative method (in this case we only do one iteration b/c we are not doing a translation. More...

#include <aligner.h>

Inheritance diagram for EMAN::RotationalAlignerIterative:
Inheritance graph
[legend]
Collaboration diagram for EMAN::RotationalAlignerIterative:
Collaboration graph
[legend]

List of all members.

Public Member Functions

virtual EMDataalign (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 EMDataalign (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 AlignerNEW ()

Static Public Attributes

static const string NAME = "rotational_iterative"

Detailed Description

rotational alignment using the iterative method (in this case we only do one iteration b/c we are not doing a translation.

The advantage of this over the 'regular' rotational alinger is that this is done in real space and does not use invariants.

Parameters:
r1inner ring
r2outer ring
Author:
John Flanagan
Date:
Oct 2010

Definition at line 332 of file aligner.h.


Member Function Documentation

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.

Parameters:
this_imgThe image to be compared.
to_img'this_img" is aligned with 'to_img'.
cmp_nameThe comparison method to compare the two images.
cmp_paramsThe parameter dictionary for comparison method.
Returns:
The aligned image.

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().

{
        int r1 = params.set_default("r1",-1);
        int r2 = params.set_default("r2",-1);
        //to start lest try the original size image. If needed, we can pad it....
        EMData * to_polar = to->unwrap(r1,r2,-1,0,0,true);
        EMData * this_img_polar = this_img->unwrap(r1,r2,-1,0,0,true);
        int this_img_polar_nx = this_img_polar->get_xsize();
        
        EMData * cf = this_img_polar->calc_ccfx(to_polar, 0, this_img->get_ysize());
        
        //take out the garbage
        delete to_polar; to_polar = 0;
        delete this_img_polar; this_img_polar = 0;
        
        float * data = cf->get_data();
        float peak = 0;
        int peak_index = 0;
        Util::find_max(data, this_img_polar_nx, &peak, &peak_index);

        delete cf; cf = 0;
        float rot_angle = (float) (peak_index * 360.0f / this_img_polar_nx);
        
        //return the result
        //cout << rot_angle << endl;
        Transform tmp(Dict("type","2d","alpha",rot_angle));
        EMData * rotimg=this_img->process("xform",Dict("transform",(Transform*)&tmp));
        rotimg->set_attr("xform.align2d",&tmp);
        
        return rotimg;
        
}
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().

                {
                        return align(this_img, to_img, "dot", Dict());
                }
virtual string EMAN::RotationalAlignerIterative::get_desc ( ) const [inline, virtual]

Implements EMAN::Aligner.

Definition at line 348 of file aligner.h.

                {
                        return "Performs rotational alignment using the SPIDER method";
                }
virtual string EMAN::RotationalAlignerIterative::get_name ( ) const [inline, virtual]

Get the Aligner's name.

Each Aligner is identified by a unique name.

Returns:
The Aligner's name.

Implements EMAN::Aligner.

Definition at line 343 of file aligner.h.

References NAME.

                {
                        return NAME;
                }
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().

                {
                        TypeDict d;
                        d.put("r1", EMObject::INT, "Inner ring, pixels");
                        d.put("r2", EMObject::INT, "Outer ring, pixels");
                        return d;
                }
static Aligner* EMAN::RotationalAlignerIterative::NEW ( ) [inline, static]

Definition at line 353 of file aligner.h.

                {
                        return new RotationalAlignerIterative();
                }

Member Data Documentation

const string RotationalAlignerIterative::NAME = "rotational_iterative" [static]

Definition at line 366 of file aligner.h.

Referenced by get_name().


The documentation for this class was generated from the following files: