EMAN2
Public Member Functions | Static Public Member Functions | Static Public Attributes
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]

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

References EMAN::EMData::calc_ccf(), ENTERFUNC, EXITFUNC, 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().

{
        ENTERFUNC;
        EMData* ccf = params.set_default("ccf",(EMData*) NULL);
        bool ccf_ownership = false;
        bool norm = params.set_default("norm",true);
        float negative = (float)params.set_default("negative", 1);
        if (negative) negative=-1.0; else negative=1.0;
        
#ifdef EMAN2_USING_CUDA 
        if(image->getcudarwdata() && with->getcudarwdata()){
                if (!ccf) {
                        ccf = image->calc_ccf(with);
                        ccf_ownership = true;
                }
                //cout << "using CUDA" << endl;
                float2 stats = get_stats_cuda(ccf->getcudarwdata(), ccf->get_xsize(), ccf->get_ysize(), ccf->get_zsize());
                float best_score = get_value_at_wrap_cuda(ccf->getcudarwdata(), 0, 0, 0, ccf->get_xsize(), ccf->get_ysize(), ccf->get_zsize());
                if(norm) {
                        best_score = negative*(best_score - stats.x)/sqrt(stats.y);
                } else {
                        best_score = negative*best_score;
                }
                
                if (ccf_ownership) delete ccf; ccf = 0;
                
                EXITFUNC;
                return best_score;
                
        }
#endif

        if (!ccf) {
                ccf = image->calc_ccf(with);
                ccf_ownership = true;
        }
        if (norm) ccf->process_inplace("normalize");
        
        float best_score = ccf->get_value_at_wrap(0,0,0);
        if (ccf_ownership) delete ccf; ccf = 0;
        
        return negative*best_score;

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

Implements EMAN::Cmp.

Definition at line 327 of file cmp.h.

                {
                        return "Ccc with consideration given for the missing wedge";
                }
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.

                {
                        return NAME;
                }
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().

                {
                        TypeDict d;
                        d.put("norm", EMObject::BOOL,"Whether the cross correlation image should be normalized (should be for normalized images). Default is true.");
                        d.put("ccf", EMObject::EMDATA,"The ccf image, can be provided if it already exists to avoid recalculating it");
                        d.put("normalize", EMObject::EMDATA,"Return the negative value (which is EMAN2 convention), Defalut is true(1)");
                        d.put("searchx", EMObject::INT, "The maximum range of the peak location in the x direction. Default is sizex/4");
                        d.put("searchy", EMObject::INT, "The maximum range of the peak location in the y direction. Default is sizey/4");
                        d.put("searchz", EMObject::INT, "The maximum range of the peak location in the z direction. Default is sizez/4");
                        return d;
                }
static Cmp* EMAN::TomoCccCmp::NEW ( ) [inline, static]

Definition at line 332 of file cmp.h.

                {
                        return new TomoCccCmp();
                }

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: