ITK  4.13.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:
51 
53  itkNewMacro(Self);
54 
57 
59  typedef TInputImage InputImageType;
60  typedef typename InputImageType::PixelType InputPixelType;
61  typedef TOutputImage OutputImageType;
62  typedef typename OutputImageType::PixelType OutputPixelType;
63  typedef typename OutputImageType::RegionType OutputImageRegionType;
66 
68  itkSetInputMacro(ValidInput, InputImageType);
69 
71  itkSetInputMacro(TestInput, InputImageType);
72 
75  itkSetMacro(VerifyInputInformation, bool);
76  itkGetConstMacro(VerifyInputInformation, bool);
77  itkBooleanMacro(VerifyInputInformation);
79 
82  itkSetMacro(ToleranceRadius, int);
83  itkGetConstMacro(ToleranceRadius, int);
85 
88  itkSetMacro(DifferenceThreshold, OutputPixelType);
89  itkGetConstMacro(DifferenceThreshold, OutputPixelType);
91 
95  itkSetMacro(IgnoreBoundaryPixels, bool);
96  itkGetConstMacro(IgnoreBoundaryPixels, bool);
98 
101  itkGetConstMacro(MinimumDifference, OutputPixelType);
102  itkGetConstMacro(MaximumDifference, OutputPixelType);
103  itkGetConstMacro(MeanDifference, RealType);
104  itkGetConstMacro(TotalDifference, AccumulateType);
105  itkGetConstMacro(NumberOfPixelsWithDifferences, SizeValueType);
107 
108 protected:
110  virtual ~ComparisonImageFilter() ITK_OVERRIDE {}
111 
112  void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE;
113 
123  void ThreadedGenerateData(const OutputImageRegionType & threadRegion,
124  ThreadIdType threadId) ITK_OVERRIDE;
125 
126  void BeforeThreadedGenerateData() ITK_OVERRIDE;
127 
128  void AfterThreadedGenerateData() ITK_OVERRIDE;
129 
130  void VerifyInputInformation() ITK_OVERRIDE;
131 
132  OutputPixelType m_DifferenceThreshold;
133 
134  RealType m_MeanDifference;
135  OutputPixelType m_MinimumDifference;
136  OutputPixelType m_MaximumDifference;
137  bool m_VerifyInputInformation;
138 
139  AccumulateType m_TotalDifference;
140 
141  SizeValueType m_NumberOfPixelsWithDifferences;
142 
143  int m_ToleranceRadius;
144 
145  Array< AccumulateType > m_ThreadDifferenceSum;
146  Array< SizeValueType > m_ThreadNumberOfPixels;
147 
148  Array< OutputPixelType > m_ThreadMinimumDifference;
149  Array< OutputPixelType > m_ThreadMaximumDifference;
150 
151 private:
152  ITK_DISALLOW_COPY_AND_ASSIGN(ComparisonImageFilter);
153 
154  bool m_IgnoreBoundaryPixels;
155 };
156 } // end namespace Testing
157 } // end namespace itk
158 
159 #ifndef ITK_MANUAL_INSTANTIATION
160 #include "itkTestingComparisonImageFilter.hxx"
161 #endif
162 
163 
164 #endif
Array class with size defined at construction time.
Definition: itkArray.h:50
Base class for all process objects that output image data.
unsigned long SizeValueType
Definition: itkIntTypes.h:143
NumericTraits< RealType >::AccumulateType AccumulateType
NumericTraits< OutputPixelType >::RealType RealType
unsigned int ThreadIdType
Definition: itkIntTypes.h:159
ImageToImageFilter< TInputImage, TOutputImage > Superclass
Implements comparison between two images.
Base class for filters that take an image as input and produce an image as output.
Control indentation during Print() invocation.
Definition: itkIndent.h:49
Define additional traits for native types such as int or float.