ITK  5.1.0
Insight Segmentation and Registration Toolkit
itkTestingComparisonImageFilter.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright Insight Software Consortium
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  * http://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"
23 #include "itkImageToImageFilter.h"
24 
25 namespace itk
26 {
27 namespace Testing
28 {
41 template< typename TInputImage, typename TOutputImage >
42 class ITK_TEMPLATE_EXPORT ComparisonImageFilter:
43  public ImageToImageFilter< TInputImage, TOutputImage >
44 {
45 public:
46  ITK_DISALLOW_COPY_AND_ASSIGN(ComparisonImageFilter);
47 
53 
55  itkNewMacro(Self);
56 
59 
61  using InputImageType = TInputImage;
62  using InputPixelType = typename InputImageType::PixelType;
63  using OutputImageType = TOutputImage;
64  using OutputPixelType = typename OutputImageType::PixelType;
68 
70  itkSetInputMacro(ValidInput, InputImageType);
71 
73  itkSetInputMacro(TestInput, InputImageType);
74 
77  itkSetMacro(VerifyInputInformation, bool);
78  itkGetConstMacro(VerifyInputInformation, bool);
79  itkBooleanMacro(VerifyInputInformation);
81 
84  itkSetMacro(ToleranceRadius, int);
85  itkGetConstMacro(ToleranceRadius, int);
87 
90  itkSetMacro(DifferenceThreshold, OutputPixelType);
91  itkGetConstMacro(DifferenceThreshold, OutputPixelType);
93 
97  itkSetMacro(IgnoreBoundaryPixels, bool);
98  itkGetConstMacro(IgnoreBoundaryPixels, bool);
100 
103  itkGetConstMacro(MinimumDifference, OutputPixelType);
104  itkGetConstMacro(MaximumDifference, OutputPixelType);
105  itkGetConstMacro(MeanDifference, RealType);
106  itkGetConstMacro(TotalDifference, AccumulateType);
107  itkGetConstMacro(NumberOfPixelsWithDifferences, SizeValueType);
109 
110 protected:
112  ~ComparisonImageFilter() override = default;
113 
114  void PrintSelf(std::ostream & os, Indent indent) const override;
115 
125  void ThreadedGenerateData(const OutputImageRegionType & threadRegion,
126  ThreadIdType threadId) override;
127 
129  {
130  itkExceptionMacro("This class requires threadId so it must use classic multi-threading model");
131  }
132 
133  void BeforeThreadedGenerateData() override;
134 
135  void AfterThreadedGenerateData() override;
136 
137  void VerifyInputInformation() ITKv5_CONST override;
138 
139  OutputPixelType m_DifferenceThreshold;
140 
141  RealType m_MeanDifference;
142  OutputPixelType m_MinimumDifference;
143  OutputPixelType m_MaximumDifference;
144  bool m_VerifyInputInformation;
145 
146  AccumulateType m_TotalDifference;
147 
148  SizeValueType m_NumberOfPixelsWithDifferences;
149 
150  int m_ToleranceRadius;
151 
152  Array< AccumulateType > m_ThreadDifferenceSum;
153  Array< SizeValueType > m_ThreadNumberOfPixels;
154 
155  Array< OutputPixelType > m_ThreadMinimumDifference;
156  Array< OutputPixelType > m_ThreadMaximumDifference;
157 
158 private:
159  bool m_IgnoreBoundaryPixels;
160 };
161 } // end namespace Testing
162 } // end namespace itk
163 
164 #ifndef ITK_MANUAL_INSTANTIATION
165 #include "itkTestingComparisonImageFilter.hxx"
166 #endif
167 
168 
169 #endif
Array class with size defined at construction time.
Definition: itkArray.h:46
void DynamicThreadedGenerateData(const OutputImageRegionType &) override
typename NumericTraits< RealType >::AccumulateType AccumulateType
typename OutputImageType::PixelType OutputPixelType
unsigned long SizeValueType
Definition: itkIntTypes.h:83
The base class for all process objects (source, filters, mappers) in the Insight data processing pipe...
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkArray.h:26
Base class for all process objects that output image data.
typename OutputImageType::RegionType OutputImageRegionType
TOutputImage OutputImageType
Implements comparison between two images.
Base class for filters that take an image as input and produce an image as output.
typename NumericTraits< OutputPixelType >::RealType RealType
Control indentation during Print() invocation.
Definition: itkIndent.h:49
unsigned int ThreadIdType
Definition: itkIntTypes.h:99
Define additional traits for native types such as int or float.
typename InputImageType::PixelType InputPixelType