Medical Imaging Interaction Toolkit  2026.06.00
Medical Imaging Interaction Toolkit
mitk::CompareImageDataFilter Class Reference

Filter for pixel-wise comparison of two mitk::Image objects. More...

#include <mitkCompareImageDataFilter.h>

Inheritance diagram for mitk::CompareImageDataFilter:
Collaboration diagram for mitk::CompareImageDataFilter:

Public Member Functions

 mitkClassMacro (CompareImageDataFilter, ImageToImageFilter)
 
 itkSimpleNewMacro (Self)
 
bool GetResult (size_t threshold=0)
 Check whether the comparison passes a given threshold. More...
 
CompareFilterResults GetCompareResults ()
 Get the detailed results of the comparison run. More...
 
void SetTolerance (double eps)
 Set the tolerance for per-pixel difference comparison. More...
 
- Public Member Functions inherited from mitk::ImageToImageFilter
 mitkClassMacro (ImageToImageFilter, ImageSource)
 
Pointer Clone () const
 
virtual void SetInput (const InputImageType *image)
 Set the image input of this process object. More...
 
virtual void SetInput (unsigned int idx, const InputImageType *image)
 Set the image input at the specified index. More...
 
InputImageType * GetInput (void)
 Get the input image (non-const). More...
 
InputImageType * GetInput (unsigned int idx)
 Get the input image at the specified index (non-const). More...
 
const InputImageType * GetInput (void) const
 Get the input image (const). More...
 
const InputImageType * GetInput (unsigned int idx) const
 Get the input image at the specified index (const). More...
 
- Public Member Functions inherited from mitk::ImageSource
 mitkClassMacro (ImageSource, BaseDataSource)
 
Pointer Clone () const
 
mitkBaseDataSourceGetOutputDeclarations itk::DataObject::Pointer MakeOutput (DataObjectPointerArraySizeType idx) override
 Get the output data of this image source object. More...
 
itk::DataObject::Pointer MakeOutput (const DataObjectIdentifierType &name) override
 
virtual vtkImageData * GetVtkImageData ()
 Get the output as VTK image data (non-const version). More...
 
virtual const vtkImageData * GetVtkImageData () const
 Get the output as VTK image data (const version). More...
 
- Public Member Functions inherited from mitk::BaseDataSource
 mitkClassMacroItkParent (BaseDataSource, itk::ProcessObject)
 
OutputType * GetOutput ()
 
const OutputType * GetOutput () const
 
OutputType * GetOutput (DataObjectPointerArraySizeType idx)
 
const OutputType * GetOutput (DataObjectPointerArraySizeType idx) const
 
virtual void GraftOutput (OutputType *output)
 Graft the specified BaseData onto this BaseDataSource's output. More...
 
virtual void GraftOutput (const DataObjectIdentifierType &key, OutputType *output)
 Graft the specified base data object onto a named output. More...
 
virtual void GraftNthOutput (unsigned int idx, OutputType *output)
 Graft the specified base data object onto this BaseDataSource's idx'th output. More...
 
bool Updating () const
 Check whether the pipeline is currently executing. More...
 

Protected Member Functions

 CompareImageDataFilter ()
 Constructor. Sets the number of required inputs to 2. More...
 
 ~CompareImageDataFilter () override
 Destructor. More...
 
void GenerateData () override
 Perform the pixel-wise comparison. More...
 
void ResetCompareResultsToInitial ()
 Reset the comparison detail struct to its initial state. More...
 
template<typename TPixel , unsigned int VImageDimension>
void EstimateValueDifference (const itk::Image< TPixel, VImageDimension > *itkImage1, const mitk::Image *referenceImage)
 Run itk::Testing::ComparisonImageFilter on the two inputs. More...
 
- Protected Member Functions inherited from mitk::ImageToImageFilter
 ImageToImageFilter ()
 
 ~ImageToImageFilter () override
 
void PrintSelf (std::ostream &os, itk::Indent indent) const override
 Print self information to the given stream. More...
 
void GenerateInputRequestedRegion () override
 Determine the input requested region to produce the output requested region. More...
 
- Protected Member Functions inherited from mitk::ImageSource
 ImageSource ()
 
 ~ImageSource () override
 
void GenerateData () override
 A version of GenerateData() specific for image processing filters. More...
 
virtual void ThreadedGenerateData (const OutputImageRegionType &outputRegionForThread, itk::ThreadIdType threadId)
 If an imaging filter can be implemented as a multithreaded algorithm, the filter will provide an implementation of ThreadedGenerateData(). More...
 
void PrepareOutputs () override
 This method is intentionally left blank. More...
 
virtual void AllocateOutputs ()
 The GenerateData method normally allocates the buffers for all of the outputs of a filter. More...
 
virtual void BeforeThreadedGenerateData ()
 If an imaging filter needs to perform processing after the buffer has been allocated but before threads are spawned, the filter can provide an implementation for BeforeThreadedGenerateData(). More...
 
virtual void AfterThreadedGenerateData ()
 If an imaging filter needs to perform processing after all processing threads have completed, the filter can provide an implementation for AfterThreadedGenerateData(). More...
 
virtual unsigned int SplitRequestedRegion (unsigned int i, unsigned int num, OutputImageRegionType &splitRegion)
 Split the output's RequestedRegion into "num" pieces, returning region "i" as "splitRegion". More...
 
- Protected Member Functions inherited from mitk::BaseDataSource
 BaseDataSource ()
 Constructor. More...
 
 ~BaseDataSource () override
 Destructor. More...
 

Protected Attributes

bool m_CompareResult
 Overall pass/fail result. More...
 
CompareFilterResults m_CompareDetails
 Detailed comparison statistics. More...
 
double m_Tolerance
 Per-pixel tolerance value. More...
 

Additional Inherited Members

- Public Types inherited from mitk::ImageToImageFilter
typedef Superclass::OutputImageRegionType OutputImageRegionType
 Superclass typedefs. More...
 
typedef mitk::Image InputImageType
 Some convenient typedefs. More...
 
typedef InputImageType::Pointer InputImagePointer
 
typedef InputImageType::ConstPointer InputImageConstPointer
 
typedef SlicedData::RegionType InputImageRegionType
 
- Public Types inherited from mitk::ImageSource
typedef mitk::Image OutputImageType
 Some convenient typedefs. More...
 
typedef OutputImageType OutputType
 
typedef OutputImageType::Pointer OutputImagePointer
 
typedef SlicedData::RegionType OutputImageRegionType
 
- Public Types inherited from mitk::BaseDataSource
typedef BaseData OutputType
 Output data type. More...
 
typedef itk::DataObject::DataObjectIdentifierType DataObjectIdentifierType
 Identifier type for named data objects. More...
 
- Static Public Member Functions inherited from mitk::ImageToImageFilter
static Pointer New ()
 Method for creation through the object factory. More...
 
- Static Public Member Functions inherited from mitk::ImageSource
static Pointer New ()
 Method for creation through the object factory. More...
 
- Static Protected Member Functions inherited from mitk::ImageSource
static itk::ITK_THREAD_RETURN_TYPE ThreaderCallback (void *arg)
 Static function used as a "callback" by the MultiThreader. More...
 
- Static Protected Member Functions inherited from mitk::BaseDataSource
static Pointer New ()
 

Detailed Description

Filter for pixel-wise comparison of two mitk::Image objects.

Uses itk::Testing::ComparisonImageFilter internally to find per-pixel differences. Provide two images via SetInput(0, image1) and SetInput(1, image2). For multi-component images the MultiComponentImageDataComparisonFilter is used instead.

See also
CompareFilterResults ImageToImageFilter

Definition at line 69 of file mitkCompareImageDataFilter.h.

Constructor & Destructor Documentation

◆ CompareImageDataFilter()

mitk::CompareImageDataFilter::CompareImageDataFilter ( )
protected

Constructor. Sets the number of required inputs to 2.

◆ ~CompareImageDataFilter()

mitk::CompareImageDataFilter::~CompareImageDataFilter ( )
inlineoverrideprotected

Destructor.

Definition at line 106 of file mitkCompareImageDataFilter.h.

Member Function Documentation

◆ EstimateValueDifference()

template<typename TPixel , unsigned int VImageDimension>
void mitk::CompareImageDataFilter::EstimateValueDifference ( const itk::Image< TPixel, VImageDimension > *  itkImage1,
const mitk::Image *  referenceImage 
)
protected

Run itk::Testing::ComparisonImageFilter on the two inputs.

Template Parameters
TPixelThe pixel type of the input image.
VImageDimensionThe dimension of the input image.

◆ GenerateData()

void mitk::CompareImageDataFilter::GenerateData ( )
overrideprotected

Perform the pixel-wise comparison.

◆ GetCompareResults()

CompareFilterResults mitk::CompareImageDataFilter::GetCompareResults ( )
inline

Get the detailed results of the comparison run.

Returns
A CompareFilterResults struct with all comparison statistics.
See also
CompareFilterResults

Definition at line 94 of file mitkCompareImageDataFilter.h.

◆ GetResult()

bool mitk::CompareImageDataFilter::GetResult ( size_t  threshold = 0)

Check whether the comparison passes a given threshold.

Returns true if the number of pixels with differences is at or below the specified threshold. Returns false if the ITK ComparisonImageFilter raised an exception during Update().

Parameters
thresholdMaximum allowed number of pixels with differences (default 0).
Returns
true if the comparison passes, false otherwise.
See also
GetCompareResults

◆ itkSimpleNewMacro()

mitk::CompareImageDataFilter::itkSimpleNewMacro ( Self  )

◆ mitkClassMacro()

mitk::CompareImageDataFilter::mitkClassMacro ( CompareImageDataFilter  ,
ImageToImageFilter   
)

◆ ResetCompareResultsToInitial()

void mitk::CompareImageDataFilter::ResetCompareResultsToInitial ( )
protected

Reset the comparison detail struct to its initial state.

◆ SetTolerance()

void mitk::CompareImageDataFilter::SetTolerance ( double  eps)
inline

Set the tolerance for per-pixel difference comparison.

Parameters
epsAllowed absolute difference per pixel.

Definition at line 100 of file mitkCompareImageDataFilter.h.

References mitk::eps.

Member Data Documentation

◆ m_CompareDetails

CompareFilterResults mitk::CompareImageDataFilter::m_CompareDetails
protected

Detailed comparison statistics.

Definition at line 124 of file mitkCompareImageDataFilter.h.

◆ m_CompareResult

bool mitk::CompareImageDataFilter::m_CompareResult
protected

Overall pass/fail result.

Definition at line 123 of file mitkCompareImageDataFilter.h.

◆ m_Tolerance

double mitk::CompareImageDataFilter::m_Tolerance
protected

Per-pixel tolerance value.

Definition at line 125 of file mitkCompareImageDataFilter.h.


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