#include <cmp.h>
Inheritance diagram for EMAN::TomoCccCmp:
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 Cmp * | NEW () |
Static Public Attributes | |
static const string | NAME = "ccc.tomo" |
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.
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.
To compare 'image' with another image passed in through its parameters.
An optional transformation may be used to transform the 2 images.
image | The first image to be compared. | |
with | The second image to be comppared. |
Implements EMAN::Cmp.
Definition at line 636 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().
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] |
virtual string EMAN::TomoCccCmp::get_name | ( | ) | const [inline, virtual] |
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.
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] |
const string TomoCccCmp::NAME = "ccc.tomo" [static] |