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