28 :
ImageToImageFilter(), m_Tolerance(0.0f), m_CompareResult(false), m_CompareDetails(nullptr)
30 this->SetNumberOfRequiredInputs(2);
73 CompareMultiComponentImage<char>(testInput, validInput);
77 CompareMultiComponentImage<unsigned char>(testInput, validInput);
81 CompareMultiComponentImage<int>(testInput, validInput);
85 CompareMultiComponentImage<unsigned int>(testInput, validInput);
89 CompareMultiComponentImage<short>(testInput, validInput);
93 CompareMultiComponentImage<unsigned short>(testInput, validInput);
97 CompareMultiComponentImage<long>(testInput, validInput);
101 CompareMultiComponentImage<unsigned long>(testInput, validInput);
105 CompareMultiComponentImage<float>(testInput, validInput);
109 CompareMultiComponentImage<double>(testInput, validInput);
113 mitkThrow() <<
"Pixel component type not supported!";
117 template <
typename TPixel>
119 const Image *validImage)
125 for (
unsigned int t = 0; t < noOfTimes; ++t)
130 for (
unsigned int p = 0; p < noOfPixels * noOfComponents; ++p)
132 TPixel vDataItem =
static_cast<TPixel *
>(
const_cast<void *
>(readAccVImage.GetData()))[p];
133 TPixel tDataItem =
static_cast<TPixel *
>(
const_cast<void *
>(readAccTImage.GetData()))[p];
135 if (std::abs(static_cast<double>(tDataItem - vDataItem)) > m_Tolerance)
137 ++m_CompareDetails->m_PixelsWithDifference;
139 m_CompareDetails->m_MaximumDifference =
140 std::max(m_CompareDetails->m_MaximumDifference, std::abs(static_cast<double>(tDataItem - vDataItem)));
143 std::min(m_CompareDetails->m_MinimumDifference, std::abs(static_cast<double>(tDataItem - vDataItem)));
146 m_CompareDetails->m_MinimumDifference =
min;
148 m_CompareDetails->m_TotalDifference += std::abs(static_cast<double>(tDataItem - vDataItem));
152 if (m_CompareDetails->m_PixelsWithDifference > 0)
154 m_CompareDetails->m_MeanDifference =
155 m_CompareDetails->m_TotalDifference / m_CompareDetails->m_PixelsWithDifference;
156 m_CompareResult =
false;
160 m_CompareResult =
true;
162 m_CompareDetails->m_FilterCompleted =
true;
void SetCompareFilterResult(CompareFilterResults *results)
const Image * GetTestImage()
void SetValidImage(const Image *_arg)
virtual void SetInput(const InputImageType *image)
DataCollection - Class to facilitate loading/accessing structured data.
void SetTestImage(const Image *_arg)
CompareFilterResults * GetCompareFilterResult()
const Image * GetValidImage()
virtual ImageDataItemPointer GetVolumeData(int t=0, int n=0, void *data=nullptr, ImportMemoryManagementType importMemoryManagement=CopyMemory) const
void CompareMultiComponentImage(const Image *testImage, const Image *validImage)
virtual void GenerateData() override
A version of GenerateData() specific for image processing filters.
Image class for storing images.
A simple struct to hold the result of the comparison filter.
bool GetResult(double threshold=0.0f)
int GetComponentType() const
Get the component type (the scalar (!) type). Each element may contain m_NumberOfComponents (more tha...
const mitk::PixelType GetPixelType(int n=0) const
Returns the PixelType of channel n.
Superclass of all classes having one or more Images as input and generating Images as output...
vcl_size_t m_PixelsWithDifference
MultiComponentImageDataComparisonFilter()
CompareFilterResults * m_CompareDetails
~MultiComponentImageDataComparisonFilter()
InputImageType * GetInput(void)
vcl_size_t GetNumberOfComponents() const
Get the number of components of which each element consists.
unsigned int GetDimension() const
Get dimension of the image.
ImageReadAccessor class to get locked read access for a particular image part.
Class for defining the data type of pixels.