EMAN2
Public Member Functions | Static Public Member Functions | Static Public Attributes | List of all members
EMAN::TomoCccCmp Class Reference

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]

Public Member Functions

virtual float cmp (EMData *image, EMData *with) const
 To compare 'image' with another image passed in through its parameters. More...
 
virtual string get_name () const
 Get the Cmp's name. More...
 
virtual string get_desc () const
 
TypeDict get_param_types () const
 Get Cmp parameter information in a dictionary. More...
 
- Public Member Functions inherited from EMAN::Cmp
virtual ~Cmp ()
 
virtual Dict get_params () const
 Get the Cmp parameters in a key/value dictionary. More...
 
virtual void set_params (const Dict &new_params)
 Set the Cmp parameters using a key/value dictionary. More...
 

Static Public Member Functions

static CmpNEW ()
 

Static Public Attributes

static const string NAME = "ccc.tomo"
 

Additional Inherited Members

- Protected Member Functions inherited from EMAN::Cmp
void validate_input_args (const EMData *image, const EMData *with) const
 
- Protected Attributes inherited from EMAN::Cmp
Dict params
 

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
normNormalize the ccf (you need to do this if a missing wedge is present)
ccfSupply your own ccf function (can be used for speedups)
searchxThe maximum acceptable tx from the origin
searchyThe maximum acceptable ty from the origin
searchzThe maximum acceptable tz from the origin

Definition at line 313 of file cmp.h.

Member Function Documentation

◆ cmp()

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
imageThe first image to be compared.
withThe second image to be comppared.
Returns
The comparison result. Smaller better by default

Implements EMAN::Cmp.

Definition at line 643 of file cmp.cpp.

644{
645 ENTERFUNC;
646 EMData* ccf = params.set_default("ccf",(EMData*) NULL);
647 bool ccf_ownership = false;
648 bool norm = params.set_default("norm",true);
649 float negative = (float)params.set_default("negative", 1);
650 if (negative) negative=-1.0; else negative=1.0;
651
652#ifdef EMAN2_USING_CUDA
653 if(image->getcudarwdata() && with->getcudarwdata()){
654 if (!ccf) {
655 ccf = image->calc_ccf(with);
656 ccf_ownership = true;
657 }
658 //cout << "using CUDA" << endl;
659 float2 stats = get_stats_cuda(ccf->getcudarwdata(), ccf->get_xsize(), ccf->get_ysize(), ccf->get_zsize());
660 float best_score = get_value_at_wrap_cuda(ccf->getcudarwdata(), 0, 0, 0, ccf->get_xsize(), ccf->get_ysize(), ccf->get_zsize());
661 if(norm) {
662 best_score = negative*(best_score - stats.x)/sqrt(stats.y);
663 } else {
664 best_score = negative*best_score;
665 }
666
667 if (ccf_ownership) delete ccf; ccf = 0;
668
669 EXITFUNC;
670 return best_score;
671
672 }
673#endif
674
675 if (!ccf) {
676 ccf = image->calc_ccf(with);
677 ccf_ownership = true;
678 }
679 if (norm) ccf->process_inplace("normalize");
680
681 float best_score = ccf->get_value_at_wrap(0,0,0);
682 if (ccf_ownership) delete ccf; ccf = 0;
683
684 return negative*best_score;
685
686}
Dict params
Definition: cmp.h:132
type set_default(const string &key, type val)
Default setting behavior This can be achieved using a template - d.woolford Jan 2008 (before there wa...
Definition: emobject.h:569
EMData stores an image's data and defines core image processing routines.
Definition: emdata.h:82
float get_value_at_wrap_cuda(float *data, int tx, int ty, int tz, int nx, int ny, int nz)
float2 get_stats_cuda(const float *data, const int nx, const int ny, const int nz)
EMData * sqrt() const
return square root of current image
EMData * calc_ccf(EMData *with=0, fp_flag fpflag=CIRCULANT, bool center=false)
Calculate Cross-Correlation Function (CCF).
Definition: emdata.cpp:1499
#define ENTERFUNC
Definition: log.h:48
#define EXITFUNC
Definition: log.h:49

References EMAN::EMData::calc_ccf(), ENTERFUNC, EXITFUNC, get_stats_cuda(), get_value_at_wrap_cuda(), EMAN::Cmp::params, EMAN::Dict::set_default(), and sqrt().

◆ get_desc()

virtual string EMAN::TomoCccCmp::get_desc ( ) const
inlinevirtual

Implements EMAN::Cmp.

Definition at line 323 of file cmp.h.

324 {
325 return "Ccc with consideration given for the missing wedge";
326 }

◆ get_name()

virtual string EMAN::TomoCccCmp::get_name ( ) const
inlinevirtual

Get the Cmp's name.

Each Cmp is identified by a unique name.

Returns
The Cmp's name.

Implements EMAN::Cmp.

Definition at line 318 of file cmp.h.

319 {
320 return NAME;
321 }
static const string NAME
Definition: cmp.h:345

References NAME.

◆ get_param_types()

TypeDict EMAN::TomoCccCmp::get_param_types ( ) const
inlinevirtual

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

334 {
335 TypeDict d;
336 d.put("norm", EMObject::BOOL,"Whether the cross correlation image should be normalized (should be for normalized images). Default is true.");
337 d.put("ccf", EMObject::EMDATA,"The ccf image, can be provided if it already exists to avoid recalculating it");
338 d.put("normalize", EMObject::EMDATA,"Return the negative value (which is EMAN2 convention), Defalut is true(1)");
339 d.put("searchx", EMObject::INT, "The maximum range of the peak location in the x direction. Default is sizex/4");
340 d.put("searchy", EMObject::INT, "The maximum range of the peak location in the y direction. Default is sizey/4");
341 d.put("searchz", EMObject::INT, "The maximum range of the peak location in the z direction. Default is sizez/4");
342 return d;
343 }

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

◆ NEW()

static Cmp * EMAN::TomoCccCmp::NEW ( )
inlinestatic

Definition at line 328 of file cmp.h.

329 {
330 return new TomoCccCmp();
331 }

Member Data Documentation

◆ NAME

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

Definition at line 345 of file cmp.h.

Referenced by get_name().


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