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


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 291 of file aligner.h.


Member Function Documentation

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 328 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(), EMAN::Transform::set_rotation(), and t.

Referenced by align().

00330 {
00331         // Get the 180 degree ambiguously rotationally aligned and its 180 degree rotation counterpart
00332         int rfp_mode = params.set_default("rfp_mode",0);
00333         EMData *rot_align  =  RotationalAligner::align_180_ambiguous(this_img,to,rfp_mode);
00334         Transform * tmp = rot_align->get_attr("xform.align2d");
00335         Dict rot = tmp->get_rotation("2d");
00336         float rotate_angle_solution = rot["alpha"];
00337         delete tmp;
00338 
00339         EMData *rot_align_180 = rot_align->copy();
00340         rot_align_180->process_inplace("math.rotate.180");
00341 
00342         Dict trans_params;
00343         trans_params["intonly"]  = 0;
00344         trans_params["maxshift"] = params.set_default("maxshift", -1);
00345 
00346         // Do the first case translational alignment
00347         trans_params["nozero"]   = params.set_default("nozero",false);
00348         EMData* rot_trans = rot_align->align("translational", to, trans_params, cmp_name, cmp_params);
00349         if( rot_align ) { // Clean up
00350                 delete rot_align;
00351                 rot_align = 0;
00352         }
00353 
00354         // Do the second case translational alignment
00355         EMData*  rot_180_trans = rot_align_180->align("translational", to, trans_params, cmp_name, cmp_params);
00356         if( rot_align_180 )     { // Clean up
00357                 delete rot_align_180;
00358                 rot_align_180 = 0;
00359         }
00360 
00361         // Finally decide on the result
00362         float cmp1 = rot_trans->cmp(cmp_name, to, cmp_params);
00363         float cmp2 = rot_180_trans->cmp(cmp_name, to, cmp_params);
00364 
00365         EMData *result = 0;
00366         if (cmp1 < cmp2) { // Assumes smaller is better - thus all comparitors should support "smaller is better"
00367                 if( rot_180_trans )     {
00368                         delete rot_180_trans;
00369                         rot_180_trans = 0;
00370                 }
00371                 result = rot_trans;
00372         }
00373         else {
00374                 if( rot_trans ) {
00375                         delete rot_trans;
00376                         rot_trans = 0;
00377                 }
00378                 result = rot_180_trans;
00379                 rotate_angle_solution -= 180.f;
00380         }
00381 
00382         Transform* t = result->get_attr("xform.align2d");
00383         t->set_rotation(Dict("type","2d","alpha",rotate_angle_solution));
00384         result->set_attr("xform.align2d",t);
00385         delete t;
00386 
00387         return result;
00388 }

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

Implements EMAN::Aligner.

Definition at line 297 of file aligner.h.

References align().

00298                 {
00299                         return align(this_img, to_img, "sqeuclidean", Dict());
00300                 }

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 302 of file aligner.h.

00303                 {
00304                         return "rotate_translate";
00305                 }

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

Implements EMAN::Aligner.

Definition at line 307 of file aligner.h.

00308                 {
00309                         return "Performs rotational alignment and follows this with translational alignment.";
00310                 }

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

Definition at line 312 of file aligner.h.

00313                 {
00314                         return new RotateTranslateAligner();
00315                 }

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

Implements EMAN::Aligner.

Definition at line 317 of file aligner.h.

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

00318                 {
00319                         TypeDict d;
00320                         //d.put("usedot", EMObject::INT);
00321                         d.put("maxshift", EMObject::INT, "Maximum translation in pixels");
00322                         d.put("nozero", EMObject::INT,"Zero translation not permitted (useful for CCD images)");
00323                         d.put("rfp_mode", EMObject::INT,"Either 0,1 or 2. A temporary flag for testing the rotational foot print");
00324                         return d;
00325                 }


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

Generated on Sat Nov 21 02:20:14 2009 for EMAN2 by  doxygen 1.5.6