Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

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

CmpNEW ()

Static Public Attributes

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 636 of file cmp.cpp.

References EMAN::EMData::calc_ccf(), 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::EMData::process_inplace(), EMAN::Dict::set_default(), and sqrt().

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

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.

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::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                 }

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 51 of file cmp.cpp.


The documentation for this class was generated from the following files:
Generated on Tue Jun 11 13:41:56 2013 for EMAN2 by  doxygen 1.3.9.1