Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

EMAN::Cmp Class Reference

Cmp class defines image comparison method. More...

#include <cmp.h>

Inheritance diagram for EMAN::Cmp:

Inheritance graph
[legend]
Collaboration diagram for EMAN::Cmp:

Collaboration graph
[legend]
List of all members.

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

Detailed Description

Cmp class defines image comparison method.

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:

Definition at line 85 of file cmp.h.


Constructor & Destructor Documentation

virtual EMAN::Cmp::~Cmp  )  [inline, virtual]
 

Definition at line 88 of file cmp.h.

00089                 {
00090                 }


Member Function Documentation

virtual float EMAN::Cmp::cmp EMData image,
EMData with
const [pure virtual]
 

To compare 'image' with another image passed in through its parameters.

An optional transformation may be used to transform the 2 images.

Parameters:
image The first image to be compared.
with The second image to be comppared.
Returns:
The comparison result. Smaller better by default

Implemented in EMAN::CccCmp, EMAN::SqEuclideanCmp, EMAN::DotCmp, EMAN::TomoDotCmp, EMAN::QuadMinDotCmp, EMAN::OptVarianceCmp, EMAN::PhaseCmp, EMAN::FRCCmp, and EMAN::XYZCmp.

Referenced by EMAN::EMData::cmp(), EMAN::KMeansAnalyzer::reclassify(), refalifn(), refalifn3d(), and EMAN::KMeansAnalyzer::reseed().

virtual string EMAN::Cmp::get_desc  )  const [pure virtual]
 

Implemented in EMAN::CccCmp, EMAN::SqEuclideanCmp, EMAN::DotCmp, EMAN::TomoDotCmp, EMAN::QuadMinDotCmp, EMAN::OptVarianceCmp, EMAN::PhaseCmp, EMAN::FRCCmp, and EMAN::XYZCmp.

virtual string EMAN::Cmp::get_name  )  const [pure virtual]
 

Get the Cmp's name.

Each Cmp is identified by a unique name.

Returns:
The Cmp's name.

Implemented in EMAN::CccCmp, EMAN::SqEuclideanCmp, EMAN::DotCmp, EMAN::TomoDotCmp, EMAN::QuadMinDotCmp, EMAN::OptVarianceCmp, EMAN::PhaseCmp, EMAN::FRCCmp, and EMAN::XYZCmp.

virtual TypeDict EMAN::Cmp::get_param_types  )  const [pure 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.

Implemented in EMAN::CccCmp, EMAN::SqEuclideanCmp, EMAN::DotCmp, EMAN::TomoDotCmp, EMAN::QuadMinDotCmp, EMAN::OptVarianceCmp, EMAN::PhaseCmp, EMAN::FRCCmp, and EMAN::XYZCmp.

virtual Dict EMAN::Cmp::get_params  )  const [inline, virtual]
 

Get the Cmp parameters in a key/value dictionary.

Returns:
A key/value pair dictionary containing the parameters.

Definition at line 112 of file cmp.h.

References params.

00113                 {
00114                         return params;
00115                 }

virtual void EMAN::Cmp::set_params const Dict new_params  )  [inline, virtual]
 

Set the Cmp parameters using a key/value dictionary.

Parameters:
new_params A dictionary containing the new parameters.

Definition at line 120 of file cmp.h.

References params.

00121                 {
00122                         params = new_params;
00123                 }

void Cmp::validate_input_args const EMData image,
const EMData with
const [protected]
 

Definition at line 65 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(), and EMAN::CccCmp::cmp().

00066 {
00067         if (!image) {
00068                 throw NullPointerException("compared image");
00069         }
00070         if (!with) {
00071                 throw NullPointerException("compare-with image");
00072         }
00073 
00074         if (!EMUtil::is_same_size(image, with)) {
00075                 throw ImageFormatException( "images not same size");
00076         }
00077 
00078         float *d1 = image->get_data();
00079         if (!d1) {
00080                 throw NullPointerException("image contains no data");
00081         }
00082 
00083         float *d2 = with->get_data();
00084         if (!d2) {
00085                 throw NullPointerException("compare-with image data");
00086         }
00087 }


Member Data Documentation

Dict EMAN::Cmp::params [mutable, protected]
 

Definition at line 136 of file cmp.h.

Referenced by EMAN::XYZCmp::cmp(), EMAN::FRCCmp::cmp(), EMAN::PhaseCmp::cmp(), EMAN::OptVarianceCmp::cmp(), EMAN::QuadMinDotCmp::cmp(), EMAN::TomoDotCmp::cmp(), EMAN::DotCmp::cmp(), EMAN::SqEuclideanCmp::cmp(), EMAN::CccCmp::cmp(), get_params(), and set_params().


The documentation for this class was generated from the following files:
Generated on Mon Jul 19 13:05:55 2010 for EMAN2 by  doxygen 1.4.4