Public Member Functions | Static Public Member Functions | Static Public Attributes
EMAN::RotateTranslateAlignerIterative Class Reference

Iterative rotational, translational alignment. More...

#include <aligner.h>

Inheritance diagram for EMAN::RotateTranslateAlignerIterative:
Inheritance graph
Collaboration diagram for EMAN::RotateTranslateAlignerIterative:
Collaboration graph

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 = "rotate_translate_iterative"

Detailed Description

Iterative rotational, translational alignment.

Basically, we find the best translation, and move to that pointer then we find the best rotation and rotate to that point. Next we iterate X times.

maxshiftMaximum translation in pixels
r1inner ring
r2outer ring
maxitermaximum number of alignment iterations
nozeroZero translation not permitted (useful for CCD images)
John Flanagan
Oct 2010

Definition at line 522 of file aligner.h.

Member Function Documentation

EMData * RotateTranslateAlignerIterative::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_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.
The aligned image.

Implements EMAN::Aligner.

Definition at line 583 of file aligner.cpp.

References EMAN::EMData::align(), EMAN::EMData::get_attr(), EMAN::Aligner::params, EMAN::EMData::process(), EMAN::EMData::set_attr(), EMAN::Dict::set_default(), and t.

Referenced by align().

        int maxiter = params.set_default("maxiter", 3);
        Dict trans_params;
        trans_params["intonly"] = 0;
        trans_params["maxshift"] = params.set_default("maxshift", -1);
        trans_params["useflcf"] = params.set_default("useflcf",0);
        trans_params["nozero"] = params.set_default("nozero",false);
        Dict rot_params;
        rot_params["r1"] = params.set_default("r1", -1);
        rot_params["r2"] = params.set_default("r2", -1);
        Transform t;
        EMData * moving_img = this_img;
        for(int it = 0; it < maxiter; it++){
                // First do a translational alignment
                EMData * trans_align = moving_img->align("translational", to, trans_params, cmp_name, cmp_params);
                Transform * tt = trans_align->get_attr("xform.align2d");
                t = *tt*t;
                delete tt;

                //now do rotation
                EMData * rottrans_align = trans_align->align("rotational_iterative", to, rot_params, cmp_name, cmp_params);
                Transform * rt = rottrans_align->get_attr("xform.align2d");
                t = *rt*t;
                delete trans_align; trans_align = 0;
                delete rottrans_align; rottrans_align = 0;
                delete rt;
                //this minimizes interpolation errors (all images that are futher processed will be interpolated at most twice)
                if(it > 0){delete moving_img;}
                moving_img = this_img->process("xform",Dict("transform",&t));  //iterate
        //write the total transformation; Avoids interpolation erros    
        moving_img->set_attr("xform.align2d", &t);
        return moving_img;
virtual EMData* EMAN::RotateTranslateAlignerIterative::align ( EMData this_img,
EMData to_img 
) const [inline, virtual]

Implements EMAN::Aligner.

Definition at line 528 of file aligner.h.

References align().

                        return align(this_img, to_img, "sqeuclidean", Dict());
virtual string EMAN::RotateTranslateAlignerIterative::get_desc ( ) const [inline, virtual]

Implements EMAN::Aligner.

Definition at line 538 of file aligner.h.

                        return "Performs rotational alignment and follows this with translational alignment using the iterative method.";
virtual string EMAN::RotateTranslateAlignerIterative::get_name ( ) const [inline, virtual]

Get the Aligner's name.

Each Aligner is identified by a unique name.

The Aligner's name.

Implements EMAN::Aligner.

Definition at line 533 of file aligner.h.

References NAME.

                        return NAME;
virtual TypeDict EMAN::RotateTranslateAlignerIterative::get_param_types ( ) const [inline, virtual]

Implements EMAN::Aligner.

Definition at line 548 of file aligner.h.

References EMAN::EMObject::INT, and EMAN::TypeDict::put().

                        TypeDict d;
                        d.put("maxshift", EMObject::INT, "Maximum translation in pixels");
                        d.put("r1", EMObject::INT, "Inner ring, pixels");
                        d.put("r2", EMObject::INT, "Outer ring, pixels");
                        d.put("maxiter", EMObject::INT, "Maximum number of iterations");
                        d.put("nozero", EMObject::INT,"Zero translation not permitted (useful for CCD images)");
                        d.put("useflcf", EMObject::INT,"Use Fast Local Correlation Function rather than CCF for translational alignment");
                        return d;
static Aligner* EMAN::RotateTranslateAlignerIterative::NEW ( ) [inline, static]

Definition at line 543 of file aligner.h.

                        return new RotateTranslateAlignerIterative();

Member Data Documentation

const string RotateTranslateAlignerIterative::NAME = "rotate_translate_iterative" [static]

Definition at line 560 of file aligner.h.

Referenced by get_name().

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