#include <cmp.h>
Inheritance diagram for EMAN::TomoDotCmp:
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 | |
Cmp * | NEW () |
Static Public Attributes | |
const string | NAME = "dot.tomo" |
threshold | threshold value to count large fourier amplitudes in the ccf image |
Definition at line 271 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.
Implements EMAN::Cmp. Definition at line 481 of file cmp.cpp. References EMAN::EMData::calc_ccf(), EMAN::EMData::do_fft(), EMAN::EMData::dot(), EMAN::EMData::get_attr(), EMAN::EMData::get_size(), EMAN::EMData::get_value_at_wrap(), InvalidParameterException, norm(), EMAN::EMData::process_inplace(), EMAN::Dict::set_default(), and UnexpectedBehaviorException. 00482 { 00483 ENTERFUNC; 00484 float threshold = params.set_default("threshold",0.f); 00485 if (threshold < 0.0f) throw InvalidParameterException("The threshold parameter must be greater than or equal to zero"); 00486 00487 if ( threshold > 0) { 00488 EMData* ccf = params.set_default("ccf",(EMData*) NULL); 00489 bool ccf_ownership = false; 00490 if (!ccf) { 00491 ccf = image->calc_ccf(with); 00492 ccf_ownership = true; 00493 } 00494 bool norm = params.set_default("norm",false); 00495 if (norm) ccf->process_inplace("normalize"); 00496 int tx = params.set_default("tx",0); int ty = params.set_default("ty",0); int tz = params.set_default("tz",0); 00497 float best_score = ccf->get_value_at_wrap(tx,ty,tz)/static_cast<float>(image->get_size()); 00498 EMData* ccf_fft = ccf->do_fft();// so cuda works, or else we could do an fft_inplace - though honestly doing an fft inplace is less efficient anyhow 00499 if (ccf_ownership) delete ccf; ccf = 0; 00500 ccf_fft->process_inplace("threshold.binary.fourier",Dict("value",threshold)); 00501 float map_sum = ccf_fft->get_attr("mean"); 00502 if (map_sum == 0.0f) throw UnexpectedBehaviorException("The number of voxels in the Fourier image with an amplitude above your threshold is zero. Please adjust your parameters"); 00503 best_score /= map_sum; 00504 delete ccf_fft; ccf_fft = 0; 00505 return -best_score; 00506 } else { 00507 return -image->dot(with); 00508 } 00509 00510 00511 }
|
|
Implements EMAN::Cmp. Definition at line 281 of file cmp.h. 00282 { 00283 return "straight dot product with consideration given for the missing wedge - normalization is applied by detecting significantly large Fourier amplitudes in the cross correlation image"; 00284 }
|
|
Get the Cmp's name. Each Cmp is identified by a unique name.
Implements EMAN::Cmp. Definition at line 276 of file cmp.h. 00277 {
00278 return NAME;
00279 }
|
|
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 291 of file cmp.h. References EMAN::TypeDict::put(). 00292 { 00293 TypeDict d; 00294 d.put("threshold", EMObject::FLOAT,"Threshold applied to the Fourier amplitudes of the ccf image - helps to correct for the missing wedge."); 00295 d.put("norm", EMObject::BOOL,"Whether the cross correlation image should be normalized. Default is false."); 00296 d.put("ccf", EMObject::EMDATA,"The ccf image, can be provided if it already exists to avoid recalculating it"); 00297 d.put("tx", EMObject::INT, "The x location of the maximum in the ccf image. May be negative. Useful thing to supply if you know the maximum is not at the phase origin"); 00298 d.put("ty", EMObject::INT, "The y location of the maximum in the ccf image. May be negative. Useful thing to supply if you know the maximum is not at the phase origin"); 00299 d.put("tz", EMObject::INT, "The z location of the maximum in the ccf image. May be negative. Useful thing to supply if you know the maximum is not at the phase origin"); 00300 00301 return d; 00302 }
|
|
Definition at line 286 of file cmp.h. 00287 { 00288 return new TomoDotCmp(); 00289 }
|
|
|