ITK  5.4.0
Insight Toolkit
itkTestingComparisonImageFilter.h
Go to the documentation of this file.
1/*=========================================================================
2 *
3 * Copyright NumFOCUS
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * https://www.apache.org/licenses/LICENSE-2.0.txt
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 *
17 *=========================================================================*/
18#ifndef itkTestingComparisonImageFilter_h
19#define itkTestingComparisonImageFilter_h
20
21#include "itkArray.h"
22#include "itkNumericTraits.h"
24
25namespace itk
26{
27namespace Testing
28{
42template <typename TInputImage, typename TOutputImage>
43class ITK_TEMPLATE_EXPORT ComparisonImageFilter : public ImageToImageFilter<TInputImage, TOutputImage>
44{
45public:
46 ITK_DISALLOW_COPY_AND_MOVE(ComparisonImageFilter);
47
53
55 itkNewMacro(Self);
56
58 itkOverrideGetNameOfClassMacro(ComparisonImageFilter);
59
61 using InputImageType = TInputImage;
62 using InputPixelType = typename InputImageType::PixelType;
63 using OutputImageType = TOutputImage;
64 using OutputPixelType = typename OutputImageType::PixelType;
68
71
74
77 itkSetMacro(VerifyInputInformation, bool);
78 itkGetConstMacro(VerifyInputInformation, bool);
79 itkBooleanMacro(VerifyInputInformation);
84 itkSetMacro(ToleranceRadius, int);
85 itkGetConstMacro(ToleranceRadius, int);
90 itkSetMacro(DifferenceThreshold, OutputPixelType);
91 itkGetConstMacro(DifferenceThreshold, OutputPixelType);
97 itkSetMacro(IgnoreBoundaryPixels, bool);
98 itkGetConstMacro(IgnoreBoundaryPixels, bool);
99 itkBooleanMacro(IgnoreBoundaryPixels);
104 itkGetConstMacro(MinimumDifference, OutputPixelType);
105 itkGetConstMacro(MaximumDifference, OutputPixelType);
106 itkGetConstMacro(MeanDifference, RealType);
107 itkGetConstMacro(TotalDifference, AccumulateType);
108 itkGetConstMacro(NumberOfPixelsWithDifferences, SizeValueType);
111protected:
113 ~ComparisonImageFilter() override = default;
114
115 void
116 PrintSelf(std::ostream & os, Indent indent) const override;
117
127 void
128 ThreadedGenerateData(const OutputImageRegionType & threadRegion, ThreadIdType threadId) override;
129
130 void
132 {
133 itkExceptionMacro("This class requires threadId so it must use classic multi-threading model");
134 }
135
136 void
138
139 void
141
142 void
143 VerifyInputInformation() ITKv5_CONST override;
144
145 OutputPixelType m_DifferenceThreshold{};
146
147 RealType m_MeanDifference{};
148 OutputPixelType m_MinimumDifference{};
149 OutputPixelType m_MaximumDifference{};
150 bool m_VerifyInputInformation{};
151
152 AccumulateType m_TotalDifference{};
153
154 SizeValueType m_NumberOfPixelsWithDifferences{};
155
156 int m_ToleranceRadius{};
157
158 Array<AccumulateType> m_ThreadDifferenceSum{};
159 Array<SizeValueType> m_ThreadNumberOfPixels{};
160
161 Array<OutputPixelType> m_ThreadMinimumDifference{};
162 Array<OutputPixelType> m_ThreadMaximumDifference{};
163
164private:
165 bool m_IgnoreBoundaryPixels{};
166};
167} // end namespace Testing
168} // end namespace itk
169
170#ifndef ITK_MANUAL_INSTANTIATION
171# include "itkTestingComparisonImageFilter.hxx"
172#endif
173
174
175#endif
Base class for all process objects that output image data.
typename OutputImageType::RegionType OutputImageRegionType
TOutputImage OutputImageType
Base class for filters that take an image as input and produce an image as output.
Control indentation during Print() invocation.
Definition: itkIndent.h:50
Define additional traits for native types such as int or float.
The base class for all process objects (source, filters, mappers) in the Insight data processing pipe...
Implements comparison between two images.
typename OutputImageType::PixelType OutputPixelType
typename InputImageType::PixelType InputPixelType
void DynamicThreadedGenerateData(const OutputImageRegionType &) override
void BeforeThreadedGenerateData() override
typename NumericTraits< RealType >::AccumulateType AccumulateType
~ComparisonImageFilter() override=default
itkSetInputMacro(ValidInput, InputImageType)
void VerifyInputInformation() ITKv5_CONST override
Verifies that the input images occupy the same physical space and the each index is at the same physi...
itkSetInputMacro(TestInput, InputImageType)
void PrintSelf(std::ostream &os, Indent indent) const override
typename NumericTraits< OutputPixelType >::RealType RealType
void ThreadedGenerateData(const OutputImageRegionType &threadRegion, ThreadIdType threadId) override
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
unsigned int ThreadIdType
Definition: itkIntTypes.h:99
unsigned long SizeValueType
Definition: itkIntTypes.h:83