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

rotational, translational and flip alignment More...

#include <aligner.h>

Inheritance diagram for EMAN::RotateTranslateFlipAligner:

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

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


Detailed Description

rotational, translational and flip alignment

Parameters:
flip 
usedot 
maxshift Maximum translation in pixels
rfp_mode Either 0,1 or 2. A temporary flag for testing the rotational foot print

Definition at line 420 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.

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

00395 {
00396         // Get the non flipped rotational, tranlsationally aligned image
00397         Dict rt_params("maxshift", params["maxshift"], "rfp_mode", params.set_default("rfp_mode",0));
00398         EMData *rot_trans_align = this_img->align("rotate_translate",to,rt_params,cmp_name, cmp_params);
00399 
00400         // Do the same alignment, but using the flipped version of the image
00401         EMData *flipped = params.set_default("flip", (EMData *) 0);
00402         bool delete_flag = false;
00403         if (flipped == 0) {
00404                 flipped = to->process("xform.flip", Dict("axis", "x"));
00405                 delete_flag = true;
00406         }
00407 
00408         EMData * rot_trans_align_flip = this_img->align("rotate_translate", flipped, rt_params, cmp_name, cmp_params);
00409         Transform* t = rot_trans_align_flip->get_attr("xform.align2d");
00410         t->set_mirror(true);
00411         rot_trans_align_flip->set_attr("xform.align2d",t);
00412         delete t;
00413 
00414         // Now finally decide on what is the best answer
00415         float cmp1 = rot_trans_align->cmp(cmp_name, to, cmp_params);
00416         float cmp2 = rot_trans_align_flip->cmp(cmp_name, flipped, cmp_params);
00417 
00418         if (delete_flag){
00419                 if(flipped) {
00420                         delete flipped;
00421                         flipped = 0;
00422                 }
00423         }
00424 
00425         EMData *result = 0;
00426         if (cmp1 < cmp2 )  {
00427 
00428                 if( rot_trans_align_flip ) {
00429                         delete rot_trans_align_flip;
00430                         rot_trans_align_flip = 0;
00431                 }
00432                 result = rot_trans_align;
00433         }
00434         else {
00435                 if( rot_trans_align ) {
00436                         delete rot_trans_align;
00437                         rot_trans_align = 0;
00438                 }
00439                 result = rot_trans_align_flip;
00440                 result->process_inplace("xform.flip",Dict("axis","x"));
00441         }
00442 
00443         return result;
00444 }

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

Implements EMAN::Aligner.

Definition at line 425 of file aligner.h.

References align().

00426                 {
00427                         return align(this_img, to_img, "sqeuclidean", Dict());
00428                 }

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

00431                 {
00432                         return "rotate_translate_flip";
00433                 }

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

Implements EMAN::Aligner.

Definition at line 435 of file aligner.h.

00436                 {
00437                         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";
00438                 }

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

Definition at line 440 of file aligner.h.

00441                 {
00442                         return new RotateTranslateFlipAligner();
00443                 }

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

Implements EMAN::Aligner.

Definition at line 445 of file aligner.h.

References static_get_param_types().

00446                 {
00447                         return static_get_param_types();
00448                 }

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

Definition at line 450 of file aligner.h.

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

Referenced by get_param_types().

00450                                                          {
00451                         TypeDict d;
00452 
00453                         d.put("flip", EMObject::EMDATA);
00454                         d.put("usedot", EMObject::INT);
00455                         d.put("maxshift", EMObject::INT, "Maximum translation in pixels");
00456                         d.put("rfp_mode", EMObject::INT,"Either 0,1 or 2. A temporary flag for testing the rotational foot print");
00457                         return d;
00458                 }


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