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

rotational, translational and flip alignment More...

#include <aligner.h>

Inheritance diagram for EMAN::RotateTranslateFlipAligner:
Inheritance graph
Collaboration diagram for EMAN::RotateTranslateFlipAligner:
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"

Detailed Description

rotational, translational and flip alignment

maxshiftMaximum translation in pixels
rfp_modeEither 0,1 or 2. A temporary flag for testing the rotational foot print

Definition at line 811 of file aligner.h.

Member Function Documentation

EMData * RotateTranslateFlipAligner::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 793 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"], "rfp_mode", params.set_default("rfp_mode",2),"useflcf",params.set_default("useflcf",0),"zscore",params.set_default("zscore",0));
        EMData *rot_trans_align = this_img->align("rotate_translate",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", 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::RotateTranslateFlipAligner::align ( EMData this_img,
EMData to_img 
) const [inline, virtual]

Implements EMAN::Aligner.

Definition at line 816 of file aligner.h.

References align().

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

Implements EMAN::Aligner.

Definition at line 826 of file aligner.h.

                        return " Does two 'rotate_translate' 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::RotateTranslateFlipAligner::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 821 of file aligner.h.

References NAME.

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

Implements EMAN::Aligner.

Definition at line 836 of file aligner.h.

References static_get_param_types().

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

Definition at line 831 of file aligner.h.

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

Definition at line 841 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("usedot", EMObject::INT);
                        d.put("maxshift", EMObject::INT, "Maximum translation in pixels");
                        d.put("rfp_mode", EMObject::INT,"Either 0,1 or 2. A temporary flag for testing the rotational foot print");
                        d.put("useflcf", EMObject::INT,"Use Fast Local Correlation Function rather than CCF for translational alignment");
                        d.put("zscore", EMObject::INT,"Either 0 or 1. This option is passed directly to the rotational aligner (default=false)");
                        return d;

Member Data Documentation

const string RotateTranslateFlipAligner::NAME = "rotate_translate_flip" [static]

Definition at line 853 of file aligner.h.

Referenced by get_name().

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