EMAN::TomoDotCmp Class Reference

Use dot product but normalize based on characteristics of the missing wedge. More...

#include <cmp.h>

Inheritance diagram for EMAN::TomoDotCmp:

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

Collaboration graph
[legend]

List of all members.

Public Member Functions

virtual float cmp (EMData *image, EMData *with) const
 To compare 'image' with another image passed in through its parameters.
virtual string get_name () const
 Get the Cmp's name.
virtual string get_desc () const
TypeDict get_param_types () const
 Get Cmp parameter information in a dictionary.

Static Public Member Functions

static CmpNEW ()


Detailed Description

Use dot product but normalize based on characteristics of the missing wedge.

Author:
David Woolford (a port of Mike Schmid's code - Mike Schmid is the intellectual author)
Date:
2009-08-04
Parameters:
threshold threshold value to count large fourier amplitudes in the ccf image

Definition at line 266 of file cmp.h.


Member Function Documentation

float TomoDotCmp::cmp ( EMData image,
EMData with 
) const [virtual]

To compare 'image' with another image passed in through its parameters.

An optional transformation may be used to transform the 2 images.

Parameters:
image The first image to be compared.
with The second image to be comppared.
Returns:
The comparison result. Smaller better by default

Implements EMAN::Cmp.

Definition at line 444 of file cmp.cpp.

References EMAN::EMData::calc_ccf(), EMAN::EMData::do_fft(), EMAN::EMData::dot(), ENTERFUNC, EMAN::EMData::get_attr(), EMAN::EMData::get_size(), EMAN::EMData::get_value_at_wrap(), InvalidParameterException, norm(), EMAN::Cmp::params, EMAN::EMData::process_inplace(), EMAN::Dict::set_default(), and UnexpectedBehaviorException.

00445 {
00446         ENTERFUNC;
00447         float threshold = params.set_default("threshold",0.f);
00448         if (threshold < 0.0f) throw InvalidParameterException("The threshold parameter must be greater than or equal to zero");
00449 
00450         if ( threshold > 0) {
00451                 EMData* ccf = params.set_default("ccf",(EMData*) NULL);
00452                 bool ccf_ownership = false;
00453                 if (!ccf) {
00454                         ccf = image->calc_ccf(with);
00455                         ccf_ownership = true;
00456                 }
00457                 bool norm = params.set_default("norm",false);
00458                 if (norm) ccf->process_inplace("normalize");
00459                 int tx = params.set_default("tx",0); int ty = params.set_default("ty",0); int tz = params.set_default("tz",0);
00460                 float best_score = ccf->get_value_at_wrap(tx,ty,tz)/static_cast<float>(image->get_size());
00461                 EMData* ccf_fft = ccf->do_fft();// so cuda works, or else we could do an fft_inplace - though honestly doing an fft inplace is less efficient anyhow
00462                 if (ccf_ownership) delete ccf; ccf = 0;
00463                 ccf_fft->process_inplace("threshold.binary.fourier",Dict("value",threshold));
00464                 float map_sum =  ccf_fft->get_attr("mean");
00465                 if (map_sum == 0.0f) throw UnexpectedBehaviorException("The number of voxels in the Fourier image with an amplitude above your threshold is zero. Please adjust your parameters");
00466                 best_score /= map_sum;
00467                 delete ccf_fft; ccf_fft = 0;
00468                 return -best_score;
00469         } else {
00470                 return -image->dot(with);
00471         }
00472 
00473 
00474 }

virtual string EMAN::TomoDotCmp::get_name (  )  const [inline, virtual]

Get the Cmp's name.

Each Cmp is identified by a unique name.

Returns:
The Cmp's name.

Implements EMAN::Cmp.

Definition at line 271 of file cmp.h.

00272                 {
00273                         return "dot.tomo";
00274                 }

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

Implements EMAN::Cmp.

Definition at line 276 of file cmp.h.

00277                 {
00278                         return "straight dot product with consideration given for the missing wedge - normalization is applied by detecting significantly large Fourier amplitudes in the cross correlation image";
00279                 }

static Cmp* EMAN::TomoDotCmp::NEW (  )  [inline, static]

Definition at line 281 of file cmp.h.

00282                 {
00283                         return new TomoDotCmp();
00284                 }

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

Get Cmp parameter information in a dictionary.

Each parameter has one record in the dictionary. Each record contains its name, data-type, and description.

Returns:
A dictionary containing the parameter info.

Implements EMAN::Cmp.

Definition at line 286 of file cmp.h.

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

00287                 {
00288                         TypeDict d;
00289                         d.put("threshold", EMObject::FLOAT,"Threshold applied to the Fourier amplitudes of the ccf image - helps to correct for the missing wedge.");
00290                         d.put("norm", EMObject::BOOL,"Whether the cross correlation image should be normalized. Default is false.");
00291                         d.put("ccf", EMObject::EMDATA,"The ccf image, can be provided if it already exists to avoid recalculating it");
00292                         d.put("tx", EMObject::INT, "The x location of the maximum in the ccf image. May be negative. Useful thing to supply if you know the maximum is not at the phase origin");
00293                         d.put("ty", EMObject::INT, "The y location of the maximum in the ccf image. May be negative. Useful thing to supply if you know the maximum is not at the phase origin");
00294                         d.put("tz", EMObject::INT, "The z location of the maximum in the ccf image. May be negative. Useful thing to supply if you know the maximum is not at the phase origin");
00295 
00296                         return d;
00297                 }


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

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