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

rotational, translational and flip alignment, iterative style More...

#include <aligner.h>

Inheritance diagram for EMAN::RotateTranslateFlipAlignerIterative:
Inheritance graph
Collaboration diagram for EMAN::RotateTranslateFlipAlignerIterative:
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 TypeDict static_get_param_types ()

Static Public Attributes

static const string NAME = "rotate_translate_flip_iterative"

Detailed Description

rotational, translational and flip alignment, iterative style

r1inner ring
r2outer ring
maxitermaximum number of alignment iterations
maxshiftMaximum translation in pixels
John Flanagan
Oct 2010

Definition at line 925 of file aligner.h.

Member Function Documentation

EMData * RotateTranslateFlipAlignerIterative::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 862 of file aligner.cpp.

References EMAN::EMData::align(), EMAN::EMData::cmp(), cmp1(), cmp2(), EMAN::EMData::get_attr(), EMAN::Aligner::params, EMAN::EMData::process(), EMAN::EMData::process_inplace(), EMAN::EMData::set_attr(), EMAN::Dict::set_default(), EMAN::Transform::set_mirror(), and t.

Referenced by align().

        // Get the non flipped rotational, tranlsationally aligned image
        Dict rt_params("maxshift", params["maxshift"],"r1",params.set_default("r1",-1),"r2",params.set_default("r2",-1));
        EMData *rot_trans_align = this_img->align("rotate_translate_iterative",to,rt_params,cmp_name, cmp_params);

        // Do the same alignment, but using the flipped version of the image
        EMData *flipped = params.set_default("flip", (EMData *) 0);
        bool delete_flag = false;
        if (flipped == 0) {
                flipped = to->process("xform.flip", Dict("axis", "x"));
                delete_flag = true;

        EMData * rot_trans_align_flip = this_img->align("rotate_translate_iterative", flipped, rt_params, cmp_name, cmp_params);
        Transform* t = rot_trans_align_flip->get_attr("xform.align2d");
        delete t;

        // Now finally decide on what is the best answer
        float cmp1 = rot_trans_align->cmp(cmp_name, to, cmp_params);
        float cmp2 = rot_trans_align_flip->cmp(cmp_name, flipped, cmp_params);

        if (delete_flag){
                if(flipped) {
                        delete flipped;
                        flipped = 0;

        EMData *result = 0;
        if (cmp1 < cmp2 )  {

                if( rot_trans_align_flip ) {
                        delete rot_trans_align_flip;
                        rot_trans_align_flip = 0;
                result = rot_trans_align;
        else {
                if( rot_trans_align ) {
                        delete rot_trans_align;
                        rot_trans_align = 0;
                result = rot_trans_align_flip;

        return result;
virtual EMData* EMAN::RotateTranslateFlipAlignerIterative::align ( EMData this_img,
EMData to_img 
) const [inline, virtual]

Implements EMAN::Aligner.

Definition at line 930 of file aligner.h.

References align().

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

Implements EMAN::Aligner.

Definition at line 940 of file aligner.h.

                        return " Does two 'rotate_translate.iterative' alignments, one to accommodate for possible handedness change. Decided which alignment is better using a comparitor and returns the aligned image as the solution";
virtual string EMAN::RotateTranslateFlipAlignerIterative::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 935 of file aligner.h.

References NAME.

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

Implements EMAN::Aligner.

Definition at line 950 of file aligner.h.

References static_get_param_types().

                        return static_get_param_types();
static Aligner* EMAN::RotateTranslateFlipAlignerIterative::NEW ( ) [inline, static]

Definition at line 945 of file aligner.h.

                        return new RotateTranslateFlipAlignerIterative();
static TypeDict EMAN::RotateTranslateFlipAlignerIterative::static_get_param_types ( ) [inline, static]

Definition at line 955 of file aligner.h.

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

Referenced by get_param_types().

                        TypeDict d;
                        d.put("flip", EMObject::EMDATA);
                        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("maxshift", EMObject::INT, "Maximum translation in pixels");
                        return d;

Member Data Documentation

const string RotateTranslateFlipAlignerIterative::NAME = "rotate_translate_flip_iterative" [static]

Definition at line 965 of file aligner.h.

Referenced by get_name().

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