Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
mitk::BaseDataCompare Class Referenceabstract

Interface to compare two BaseData objects for (near) equality. More...

#include <mitkBaseDataCompare.h>

Inheritance diagram for mitk::BaseDataCompare:

Public Member Functions

bool AreEqual (const BaseData *left, const BaseData *right, ScalarType eps=mitk::eps, bool verbose=false)
 Main interface method, compares two given BaseData instances. More...
 

Static Public Member Functions

static void RegisterCoreEquals ()
 Register core type comparators that come with mitk::Equal() functions. More...
 

Detailed Description

Interface to compare two BaseData objects for (near) equality.

Classes implementing this interface must be able to judge two given instances of a certain BaseData type as equal or not.

The definition of "equal" is left to individual classes! (original use case being the comparison of BaseData objects after serialization)

This interface is used by DataStorageCompare to compare two given BaseData instances. The interface is required to handle all data types in an identical way (alternatives: operator== is too strict; mitk::Equal() has different signatures).

To re-use what already has been implemented in various mitk::Equal() functions, this interface is accompanied by a template class BaseDataCompareT which makes use of an existing mitk::Equal() method.

Warning
Current convention: service instances are described by a "basedata" property that contains the GetNameOfClass() string of the BaseData type that can be compared by this instance. mitk::DataStorageCompare uses this convention.

Definition at line 48 of file mitkBaseDataCompare.h.

Member Function Documentation

bool mitk::BaseDataCompare::AreEqual ( const BaseData left,
const BaseData right,
ScalarType  eps = mitk::eps,
bool  verbose = false 
)

Main interface method, compares two given BaseData instances.

Compares left and right BaseData instance using a given epsilon/precision for potential float value comparisons. Can print warnings when the verbose flag is given.

Parameters
leftleft BaseData instance of the comparison.
rightright BaseData instance of the comparison.
epsprecision for float value comparisons.
verbosewhen true, failing comparisons will print messages to logging/console.

Definition at line 29 of file mitkBaseDataCompare.cpp.


The documentation for this class was generated from the following files: