EMAN::RotateTranslateAligner Class Reference
[a function or class that is CUDA enabled]

rotational, translational alignment More...

#include <aligner.h>

Inheritance diagram for EMAN::RotateTranslateAligner:

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

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

Detailed Description

rotational, translational alignment

Parameters:
maxshift Maximum translation in pixels
nozero Zero translation not permitted (useful for CCD images)
rfp_mode Either 0,1 or 2. A temporary flag for testing the rotational foot print

Definition at line 298 of file aligner.h.


Member Function Documentation

virtual EMData* EMAN::RotateTranslateAligner::align ( EMData this_img,
EMData to_img 
) const [inline, virtual]

Implements EMAN::Aligner.

Definition at line 304 of file aligner.h.

References align().

00305                 {
00306                         return align(this_img, to_img, "sqeuclidean", Dict());
00307                 }

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

Implements EMAN::Aligner.

Definition at line 353 of file aligner.cpp.

References EMAN::EMData::align(), EMAN::RotationalAligner::align_180_ambiguous(), EMAN::EMData::cmp(), cmp1(), cmp2(), EMAN::EMData::copy(), EMAN::EMData::get_attr(), EMAN::Transform::get_rotation(), EMAN::Aligner::params, EMAN::EMData::process_inplace(), EMAN::EMData::set_attr(), EMAN::Dict::set_default(), and t.

Referenced by align().

00355 {
00356         // Get the 180 degree ambiguously rotationally aligned and its 180 degree rotation counterpart
00357         int rfp_mode = params.set_default("rfp_mode",0);
00358         EMData *rot_align  =  RotationalAligner::align_180_ambiguous(this_img,to,rfp_mode);
00359         Transform * tmp = rot_align->get_attr("xform.align2d");
00360         Dict rot = tmp->get_rotation("2d");
00361         float rotate_angle_solution = rot["alpha"];
00362         delete tmp;
00363 
00364         EMData *rot_align_180 = rot_align->copy();
00365         rot_align_180->process_inplace("math.rotate.180");
00366 
00367         Dict trans_params;
00368         trans_params["intonly"]  = 0;
00369         trans_params["maxshift"] = params.set_default("maxshift", -1);
00370         trans_params["useflcf"]=params.set_default("useflcf",0);
00371 
00372         // Do the first case translational alignment
00373         trans_params["nozero"]   = params.set_default("nozero",false);
00374         EMData* rot_trans = rot_align->align("translational", to, trans_params, cmp_name, cmp_params);
00375         if( rot_align ) { // Clean up
00376                 delete rot_align;
00377                 rot_align = 0;
00378         }
00379 
00380         // Do the second case translational alignment
00381         EMData*  rot_180_trans = rot_align_180->align("translational", to, trans_params, cmp_name, cmp_params);
00382         if( rot_align_180 )     { // Clean up
00383                 delete rot_align_180;
00384                 rot_align_180 = 0;
00385         }
00386 
00387         // Finally decide on the result
00388         float cmp1 = rot_trans->cmp(cmp_name, to, cmp_params);
00389         float cmp2 = rot_180_trans->cmp(cmp_name, to, cmp_params);
00390 
00391         EMData *result = 0;
00392         if (cmp1 < cmp2) { // Assumes smaller is better - thus all comparitors should support "smaller is better"
00393                 if( rot_180_trans )     {
00394                         delete rot_180_trans;
00395                         rot_180_trans = 0;
00396                 }
00397                 result = rot_trans;
00398         }
00399         else {
00400                 if( rot_trans ) {
00401                         delete rot_trans;
00402                         rot_trans = 0;
00403                 }
00404                 result = rot_180_trans;
00405                 rotate_angle_solution -= 180.f;
00406         }
00407 
00408         Transform* t = result->get_attr("xform.align2d");
00409         t->set_rotation(Dict("type","2d","alpha",rotate_angle_solution));
00410         result->set_attr("xform.align2d",t);
00411         delete t;
00412 
00413         return result;
00414 }

virtual string EMAN::RotateTranslateAligner::get_desc (  )  const [inline, virtual]

Implements EMAN::Aligner.

Definition at line 314 of file aligner.h.

00315                 {
00316                         return "Performs rotational alignment and follows this with translational alignment.";
00317                 }

virtual string EMAN::RotateTranslateAligner::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 309 of file aligner.h.

References NAME.

00310                 {
00311                         return NAME;
00312                 }

virtual TypeDict EMAN::RotateTranslateAligner::get_param_types (  )  const [inline, virtual]

Implements EMAN::Aligner.

Definition at line 324 of file aligner.h.

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

00325                 {
00326                         TypeDict d;
00327                         //d.put("usedot", EMObject::INT);
00328                         d.put("maxshift", EMObject::INT, "Maximum translation in pixels");
00329                         d.put("nozero", EMObject::INT,"Zero translation not permitted (useful for CCD images)");
00330                         d.put("rfp_mode", EMObject::INT,"Either 0,1 or 2. A temporary flag for testing the rotational foot print");
00331                         d.put("useflcf", EMObject::INT,"Use Fast Local Correlation Function rather than CCF for translational alignment");
00332                         return d;
00333                 }

static Aligner* EMAN::RotateTranslateAligner::NEW (  )  [inline, static]

Definition at line 319 of file aligner.h.

00320                 {
00321                         return new RotateTranslateAligner();
00322                 }


Member Data Documentation

const string RotateTranslateAligner::NAME = "rotate_translate" [static]

Definition at line 335 of file aligner.h.

Referenced by get_name().


The documentation for this class was generated from the following files:
Generated on Mon Jul 19 12:42:13 2010 for EMAN2 by  doxygen 1.4.7