ITK  5.3.0
Insight Toolkit
itkSimilarityIndexImageFilter.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  * 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 itkSimilarityIndexImageFilter_h
19 #define itkSimilarityIndexImageFilter_h
20 
21 #include "itkImageToImageFilter.h"
22 #include "itkNumericTraits.h"
23 #include "itkArray.h"
24 
25 namespace itk
26 {
60 template <typename TInputImage1, typename TInputImage2>
61 class ITK_TEMPLATE_EXPORT SimilarityIndexImageFilter : public ImageToImageFilter<TInputImage1, TInputImage1>
62 {
63 public:
64  ITK_DISALLOW_COPY_AND_MOVE(SimilarityIndexImageFilter);
65 
71 
73  itkNewMacro(Self);
74 
77 
79  using InputImage1Type = TInputImage1;
80  using InputImage2Type = TInputImage2;
81  using InputImage1Pointer = typename TInputImage1::Pointer;
82  using InputImage2Pointer = typename TInputImage2::Pointer;
83  using InputImage1ConstPointer = typename TInputImage1::ConstPointer;
84  using InputImage2ConstPointer = typename TInputImage2::ConstPointer;
85 
87  using SizeType = typename TInputImage1::SizeType;
89 
90  using InputImage1PixelType = typename TInputImage1::PixelType;
91  using InputImage2PixelType = typename TInputImage2::PixelType;
92 
94  static constexpr unsigned int ImageDimension = TInputImage1::ImageDimension;
95 
98 
100  void
101  SetInput1(const InputImage1Type * image)
102  {
103  this->SetInput(image);
104  }
105 
107  void
108  SetInput2(const InputImage2Type * image);
109 
111  const InputImage1Type *
113  {
114  return this->GetInput();
115  }
116 
118  const InputImage2Type *
119  GetInput2();
120 
122  itkGetConstMacro(SimilarityIndex, RealType);
123 
124 #ifdef ITK_USE_CONCEPT_CHECKING
125  // Begin concept checking
128  // End concept checking
129 #endif
130 
131 protected:
133  ~SimilarityIndexImageFilter() override = default;
134  void
135  PrintSelf(std::ostream & os, Indent indent) const override;
136 
139  void
140  AllocateOutputs() override;
141 
143  void
144  BeforeThreadedGenerateData() override;
145 
148  void
149  AfterThreadedGenerateData() override;
150 
152  void
153  ThreadedGenerateData(const RegionType & outputRegionForThread, ThreadIdType threadId) override;
154 
155  void
157  {
158  itkExceptionMacro("This class requires threadId so it must use classic multi-threading model");
159  }
160 
161  // Override since the filter needs all the data for the algorithm
162  void
163  GenerateInputRequestedRegion() override;
164 
165  // Override since the filter produces all of its output
166  void
167  EnlargeOutputRequestedRegion(DataObject * data) override;
168 
169 private:
171 
175 }; // end of class
176 } // end namespace itk
177 
178 #ifndef ITK_MANUAL_INSTANTIATION
179 # include "itkSimilarityIndexImageFilter.hxx"
180 #endif
181 
182 #endif
itk::SimilarityIndexImageFilter::GetInput1
const InputImage1Type * GetInput1()
Definition: itkSimilarityIndexImageFilter.h:112
itk::Concept::HasNumericTraits
Definition: itkConceptChecking.h:714
itk::SimilarityIndexImageFilter::RegionType
typename TInputImage1::RegionType RegionType
Definition: itkSimilarityIndexImageFilter.h:86
itk::SimilarityIndexImageFilter::m_CountOfIntersection
Array< SizeValueType > m_CountOfIntersection
Definition: itkSimilarityIndexImageFilter.h:174
itk::SimilarityIndexImageFilter::InputImage2PixelType
typename TInputImage2::PixelType InputImage2PixelType
Definition: itkSimilarityIndexImageFilter.h:91
itk::SimilarityIndexImageFilter::m_CountOfImage2
Array< SizeValueType > m_CountOfImage2
Definition: itkSimilarityIndexImageFilter.h:173
itk::SimilarityIndexImageFilter::InputImage1Pointer
typename TInputImage1::Pointer InputImage1Pointer
Definition: itkSimilarityIndexImageFilter.h:81
itk::GTest::TypedefsAndConstructors::Dimension2::SizeType
ImageBaseType::SizeType SizeType
Definition: itkGTestTypedefsAndConstructors.h:49
itk::SmartPointer< Self >
itk::Indent
Control indentation during Print() invocation.
Definition: itkIndent.h:49
itk::ThreadIdType
unsigned int ThreadIdType
Definition: itkIntTypes.h:99
itk::GTest::TypedefsAndConstructors::Dimension2::IndexType
ImageBaseType::IndexType IndexType
Definition: itkGTestTypedefsAndConstructors.h:50
itk::ImageToImageFilter
Base class for filters that take an image as input and produce an image as output.
Definition: itkImageToImageFilter.h:108
itk::SimilarityIndexImageFilter::m_SimilarityIndex
RealType m_SimilarityIndex
Definition: itkSimilarityIndexImageFilter.h:170
itk::SimilarityIndexImageFilter::m_CountOfImage1
Array< SizeValueType > m_CountOfImage1
Definition: itkSimilarityIndexImageFilter.h:172
itk::LightObject
Light weight base class for most itk classes.
Definition: itkLightObject.h:59
itk::SimilarityIndexImageFilter::SizeType
typename TInputImage1::SizeType SizeType
Definition: itkSimilarityIndexImageFilter.h:87
itk::SimilarityIndexImageFilter
Measures the similarity between the set of non-zero pixels of two images.
Definition: itkSimilarityIndexImageFilter.h:61
itk::GTest::TypedefsAndConstructors::Dimension2::RegionType
ImageBaseType::RegionType RegionType
Definition: itkGTestTypedefsAndConstructors.h:54
itk::SimilarityIndexImageFilter::SetInput1
void SetInput1(const InputImage1Type *image)
Definition: itkSimilarityIndexImageFilter.h:101
itkImageToImageFilter.h
itk::SimilarityIndexImageFilter::InputImage2Pointer
typename TInputImage2::Pointer InputImage2Pointer
Definition: itkSimilarityIndexImageFilter.h:82
itk::SimilarityIndexImageFilter::DynamicThreadedGenerateData
void DynamicThreadedGenerateData(const RegionType &) override
Definition: itkSimilarityIndexImageFilter.h:156
itk::NumericTraits
Define additional traits for native types such as int or float.
Definition: itkNumericTraits.h:58
itk::SimilarityIndexImageFilter::InputImage1ConstPointer
typename TInputImage1::ConstPointer InputImage1ConstPointer
Definition: itkSimilarityIndexImageFilter.h:83
itkArray.h
itk::SimilarityIndexImageFilter::InputImage1Type
TInputImage1 InputImage1Type
Definition: itkSimilarityIndexImageFilter.h:79
itk::SimilarityIndexImageFilter::InputImage1PixelType
typename TInputImage1::PixelType InputImage1PixelType
Definition: itkSimilarityIndexImageFilter.h:90
itk::SimilarityIndexImageFilter::InputImage2Type
TInputImage2 InputImage2Type
Definition: itkSimilarityIndexImageFilter.h:80
itkConceptMacro
#define itkConceptMacro(name, concept)
Definition: itkConceptChecking.h:65
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnnulusOperator.h:24
itk::SimilarityIndexImageFilter::IndexType
typename TInputImage1::IndexType IndexType
Definition: itkSimilarityIndexImageFilter.h:88
itk::SimilarityIndexImageFilter::RealType
typename NumericTraits< InputImage1PixelType >::RealType RealType
Definition: itkSimilarityIndexImageFilter.h:97
itk::Array< SizeValueType >
itkNumericTraits.h
itk::SimilarityIndexImageFilter::InputImage2ConstPointer
typename TInputImage2::ConstPointer InputImage2ConstPointer
Definition: itkSimilarityIndexImageFilter.h:84
itk::DataObject
Base class for all data objects in ITK.
Definition: itkDataObject.h:293