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

This implements the technique of Mike Schmid where by the cross correlation is normalized in an effort to remove the effects of the missing wedge. More...

#include <cmp.h>

Inheritance diagram for EMAN::TomoCccCmp:

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

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 = "ccc.tomo"

Detailed Description

This implements the technique of Mike Schmid where by the cross correlation is normalized in an effort to remove the effects of the missing wedge.

Somewhat of a heuristic solution, but it seems to work. Basiaclly it relies on the observation that 'good' matchs will conentrate the correlation signal in the peak, wheras 'bad' correlations will distribute the signal.

Author:
John Flanagan (a port of Mike Schmid's code - Mike Schmid is the intellectual author)
Date:
2010-10-18
Parameters:
norm Normalize the ccf (you need to do this if a missing wedge is present)
ccf Supply your own ccf function (can be used for speedups)
searchx The maximum acceptable tx from the origin
searchy The maximum acceptable ty from the origin
searchz The maximum acceptable tz from the origin

Definition at line 317 of file cmp.h.


Member Function Documentation

float TomoCccCmp::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 633 of file cmp.cpp.

References EMAN::EMData::calc_ccf(), ENTERFUNC, get_stats_cuda(), EMAN::EMData::get_value_at_wrap(), get_value_at_wrap_cuda(), EMAN::EMData::get_xsize(), EMAN::EMData::get_ysize(), EMAN::EMData::get_zsize(), norm(), EMAN::Cmp::params, EMAN::EMData::process_inplace(), EMAN::Dict::set_default(), and sqrt().

00634 {
00635         ENTERFUNC;
00636         EMData* ccf = params.set_default("ccf",(EMData*) NULL);
00637         bool ccf_ownership = false;
00638         bool norm = params.set_default("norm",true);
00639         float negative = (float)params.set_default("negative", 1);
00640         if (negative) negative=-1.0; else negative=1.0;
00641         int searchx, searchy, searchz;
00642         
00643 
00644         searchx = params.set_default("searchx",-1); 
00645         searchy = params.set_default("searchy",-1); 
00646         searchz = params.set_default("searchz",-1);
00647         
00648 #ifdef EMAN2_USING_CUDA 
00649         if(image->getcudarwdata() && with->getcudarwdata()){
00650                 if (!ccf) {
00651                         ccf = image->calc_ccf(with);
00652                         ccf_ownership = true;
00653                 }
00654                 //cout << "using CUDA" << endl;
00655                 float2 stats = get_stats_cuda(ccf->getcudarwdata(), ccf->get_xsize(), ccf->get_ysize(), ccf->get_zsize());
00656                 float best_score = get_value_at_wrap_cuda(ccf->getcudarwdata(), 0, 0, 0, ccf->get_xsize(), ccf->get_ysize(), ccf->get_zsize());
00657                 if(norm) {
00658                         best_score = negative*(best_score - stats.x)/sqrt(stats.y);
00659                 } else {
00660                         best_score = negative*best_score;
00661                 }
00662                 
00663                 if (ccf_ownership) delete ccf; ccf = 0;
00664                 
00665                 return best_score;
00666                 
00667         }
00668 #endif
00669 
00670         if (!ccf) {
00671                 ccf = image->calc_ccf(with);
00672                 ccf_ownership = true;
00673         }
00674         if (norm) ccf->process_inplace("normalize");
00675         
00676         float best_score = ccf->get_value_at_wrap(0,0,0);
00677         if (ccf_ownership) delete ccf; ccf = 0;
00678         
00679         return negative*best_score;
00680 
00681 }

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

Implements EMAN::Cmp.

Definition at line 327 of file cmp.h.

00328                 {
00329                         return "Ccc with consideration given for the missing wedge";
00330                 }

virtual string EMAN::TomoCccCmp::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 322 of file cmp.h.

References NAME.

00323                 {
00324                         return NAME;
00325                 }

TypeDict EMAN::TomoCccCmp::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 337 of file cmp.h.

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

00338                 {
00339                         TypeDict d;
00340                         d.put("norm", EMObject::BOOL,"Whether the cross correlation image should be normalized (should be for normalized images). Default is true.");
00341                         d.put("ccf", EMObject::EMDATA,"The ccf image, can be provided if it already exists to avoid recalculating it");
00342                         d.put("normalize", EMObject::EMDATA,"Return the negative value (which is EMAN2 convention), Defalut is true(1)");
00343                         d.put("searchx", EMObject::INT, "The maximum range of the peak location in the x direction. Default is sizex/4");
00344                         d.put("searchy", EMObject::INT, "The maximum range of the peak location in the y direction. Default is sizey/4");
00345                         d.put("searchz", EMObject::INT, "The maximum range of the peak location in the z direction. Default is sizez/4");
00346                         return d;
00347                 }

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

Definition at line 332 of file cmp.h.

00333                 {
00334                         return new TomoCccCmp();
00335                 }


Member Data Documentation

const string TomoCccCmp::NAME = "ccc.tomo" [static]

Definition at line 349 of file cmp.h.

Referenced by get_name().


The documentation for this class was generated from the following files:
Generated on Tue Jul 12 13:48:08 2011 for EMAN2 by  doxygen 1.4.7