#include <cmp.h>
Inheritance diagram for EMAN::Cmp:


Public Member Functions | |
| virtual | ~Cmp () |
| virtual float | cmp (EMData *image, EMData *with) const =0 |
| To compare 'image' with another image passed in through its parameters. | |
| virtual string | get_name () const =0 |
| Get the Cmp's name. | |
| virtual string | get_desc () const =0 |
| virtual Dict | get_params () const |
| Get the Cmp parameters in a key/value dictionary. | |
| virtual void | set_params (const Dict &new_params) |
| Set the Cmp parameters using a key/value dictionary. | |
| virtual TypeDict | get_param_types () const =0 |
| Get Cmp parameter information in a dictionary. | |
Protected Member Functions | |
| void | validate_input_args (const EMData *image, const EMData *with) const |
Protected Attributes | |
| Dict | params |
Using default arguments, smaller values indicate more similar images.
Cmp class is the base comparison class. Each specific comparison class is a subclass of Cmp, and must have a unique name. The name is used to create a new Cmp instance or call a Cmp.
All Cmp classes in EMAN are managed by a Factory pattern. So each Cmp class must define:
Typical usage of Cmp:
vector<string> all_cmps = Factory<Cmp>::get_list();
EMData *image1 = ...;
EMData *image2 = ...;
Dict params = ...;
float result = image1->cmp("CMP_NAME", image2, params);
float cmp(EMData * image, EMData * with) const; TypeDict get_param_types() const; string get_name() const { return "XYZ"; } static Cmp *NEW() { return XYZCmp(); }
Definition at line 85 of file cmp.h.
|
|
Definition at line 88 of file cmp.h. 00089 {
00090 }
|
|
||||||||||||
|
To compare 'image' with another image passed in through its parameters. An optional transformation may be used to transform the 2 images.
Implemented in EMAN::CccCmp, EMAN::LodCmp, EMAN::SqEuclideanCmp, EMAN::DotCmp, EMAN::TomoCccCmp, EMAN::QuadMinDotCmp, EMAN::OptVarianceCmp, EMAN::PhaseCmp, EMAN::FRCCmp, and EMAN::XYZCmp. Referenced by EMAN::EMData::cmp(), EMAN::KMeansAnalyzer::reclassify(), refalifn(), and refalifn3dquat(). |
|
|
Implemented in EMAN::CccCmp, EMAN::LodCmp, EMAN::SqEuclideanCmp, EMAN::DotCmp, EMAN::TomoCccCmp, EMAN::QuadMinDotCmp, EMAN::OptVarianceCmp, EMAN::PhaseCmp, EMAN::FRCCmp, and EMAN::XYZCmp. |
|
|
Get the Cmp's name. Each Cmp is identified by a unique name.
Implemented in EMAN::CccCmp, EMAN::LodCmp, EMAN::SqEuclideanCmp, EMAN::DotCmp, EMAN::TomoCccCmp, EMAN::QuadMinDotCmp, EMAN::OptVarianceCmp, EMAN::PhaseCmp, EMAN::FRCCmp, and EMAN::XYZCmp. |
|
|
Get Cmp parameter information in a dictionary. Each parameter has one record in the dictionary. Each record contains its name, data-type, and description.
Implemented in EMAN::CccCmp, EMAN::LodCmp, EMAN::SqEuclideanCmp, EMAN::DotCmp, EMAN::TomoCccCmp, EMAN::QuadMinDotCmp, EMAN::OptVarianceCmp, EMAN::PhaseCmp, EMAN::FRCCmp, and EMAN::XYZCmp. |
|
|
Get the Cmp parameters in a key/value dictionary.
Definition at line 112 of file cmp.h. 00113 {
00114 return params;
00115 }
|
|
|
Set the Cmp parameters using a key/value dictionary.
Definition at line 120 of file cmp.h. 00121 {
00122 params = new_params;
00123 }
|
|
||||||||||||
|
Definition at line 72 of file cmp.cpp. References EMAN::EMData::get_data(), ImageFormatException, EMAN::EMUtil::is_same_size(), and NullPointerException. Referenced by EMAN::XYZCmp::cmp(), EMAN::FRCCmp::cmp(), EMAN::OptVarianceCmp::cmp(), EMAN::QuadMinDotCmp::cmp(), EMAN::DotCmp::cmp(), EMAN::SqEuclideanCmp::cmp(), EMAN::LodCmp::cmp(), and EMAN::CccCmp::cmp(). 00073 {
00074
00075 #ifdef EMAN2_USING_CUDA
00076 if (image->getcudarwdata() && with->getcudarwdata()) {
00077 //no need for futher checking, which will induce an expensive copy from device to host
00078 return;
00079 }
00080 #endif
00081 if (!image) {
00082 throw NullPointerException("compared image");
00083 }
00084 if (!with) {
00085 throw NullPointerException("compare-with image");
00086 }
00087
00088 if (!EMUtil::is_same_size(image, with)) {
00089 throw ImageFormatException( "images not same size");
00090 }
00091
00092 float *d1 = image->get_data();
00093 if (!d1) {
00094 throw NullPointerException("image contains no data");
00095 }
00096
00097 float *d2 = with->get_data();
00098 if (!d2) {
00099 throw NullPointerException("compare-with image data");
00100 }
00101 }
|
|
|
Definition at line 136 of file cmp.h. Referenced by EMAN::Refine3DAlignerQuaternion::align(), and EMAN::RefineAligner::align(). |
1.3.9.1