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

Static Public Attributes

static const string NAME = "dot.tomo"


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 270 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 455 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.

00456 {
00457         ENTERFUNC;
00458         float threshold = params.set_default("threshold",0.f);
00459         if (threshold < 0.0f) throw InvalidParameterException("The threshold parameter must be greater than or equal to zero");
00460 
00461         if ( threshold > 0) {
00462                 EMData* ccf = params.set_default("ccf",(EMData*) NULL);
00463                 bool ccf_ownership = false;
00464                 if (!ccf) {
00465                         ccf = image->calc_ccf(with);
00466                         ccf_ownership = true;
00467                 }
00468                 bool norm = params.set_default("norm",false);
00469                 if (norm) ccf->process_inplace("normalize");
00470                 int tx = params.set_default("tx",0); int ty = params.set_default("ty",0); int tz = params.set_default("tz",0);
00471                 float best_score = ccf->get_value_at_wrap(tx,ty,tz)/static_cast<float>(image->get_size());
00472                 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
00473                 if (ccf_ownership) delete ccf; ccf = 0;
00474                 ccf_fft->process_inplace("threshold.binary.fourier",Dict("value",threshold));
00475                 float map_sum =  ccf_fft->get_attr("mean");
00476                 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");
00477                 best_score /= map_sum;
00478                 delete ccf_fft; ccf_fft = 0;
00479                 return -best_score;
00480         } else {
00481                 return -image->dot(with);
00482         }
00483 
00484 
00485 }

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 275 of file cmp.h.

References NAME.

00276                 {
00277                         return NAME;
00278                 }

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

Implements EMAN::Cmp.

Definition at line 280 of file cmp.h.

00281                 {
00282                         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";
00283                 }

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

Definition at line 285 of file cmp.h.

00286                 {
00287                         return new TomoDotCmp();
00288                 }

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 290 of file cmp.h.

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

00291                 {
00292                         TypeDict d;
00293                         d.put("threshold", EMObject::FLOAT,"Threshold applied to the Fourier amplitudes of the ccf image - helps to correct for the missing wedge.");
00294                         d.put("norm", EMObject::BOOL,"Whether the cross correlation image should be normalized. Default is false.");
00295                         d.put("ccf", EMObject::EMDATA,"The ccf image, can be provided if it already exists to avoid recalculating it");
00296                         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");
00297                         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");
00298                         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");
00299 
00300                         return d;
00301                 }


Member Data Documentation

const string TomoDotCmp::NAME = "dot.tomo" [static]

Definition at line 303 of file cmp.h.

Referenced by get_name().


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

Generated on Sat Mar 20 02:20:23 2010 for EMAN2 by  doxygen 1.5.6