ITK  6.0.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 * 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 itkSimilarityIndexImageFilter_h
19#define itkSimilarityIndexImageFilter_h
20
22#include "itkNumericTraits.h"
23#include "itkArray.h"
24
25namespace itk
26{
60template <typename TInputImage1, typename TInputImage2>
61class ITK_TEMPLATE_EXPORT SimilarityIndexImageFilter : public ImageToImageFilter<TInputImage1, TInputImage1>
62{
63public:
64 ITK_DISALLOW_COPY_AND_MOVE(SimilarityIndexImageFilter);
65
71
73 itkNewMacro(Self);
74
76 itkOverrideGetNameOfClassMacro(SimilarityIndexImageFilter);
77
79 using InputImage1Type = TInputImage1;
80 using InputImage2Type = TInputImage2;
85
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
102 {
103 this->SetInput(image);
104 }
105
107 void
109
111 const InputImage1Type *
113 {
114 return this->GetInput();
115 }
116
118 const InputImage2Type *
120
122 itkGetConstMacro(SimilarityIndex, RealType);
123
124#ifdef ITK_USE_CONCEPT_CHECKING
125 // Begin concept checking
128 // End concept checking
129#endif
130
131protected:
133 ~SimilarityIndexImageFilter() override = default;
134 void
135 PrintSelf(std::ostream & os, Indent indent) const override;
136
139 void
140 AllocateOutputs() override;
141
143 void
145
148 void
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
164
165 // Override since the filter produces all of its output
166 void
168
169private:
170 RealType m_SimilarityIndex{};
171
172 Array<SizeValueType> m_CountOfImage1{};
173 Array<SizeValueType> m_CountOfImage2{};
174 Array<SizeValueType> m_CountOfIntersection{};
175}; // end of class
176} // end namespace itk
177
178#ifndef ITK_MANUAL_INSTANTIATION
179# include "itkSimilarityIndexImageFilter.hxx"
180#endif
181
182#endif
Base class for all data objects in ITK.
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
Light weight base class for most itk classes.
Define additional traits for native types such as int or float.
Measures the similarity between the set of non-zero pixels of two images.
void SetInput1(const InputImage1Type *image)
typename TInputImage1::RegionType RegionType
~SimilarityIndexImageFilter() override=default
void GenerateInputRequestedRegion() override
void BeforeThreadedGenerateData() override
typename TInputImage2::PixelType InputImage2PixelType
typename NumericTraits< InputImage1PixelType >::RealType RealType
const InputImage2Type * GetInput2()
typename TInputImage1::PixelType InputImage1PixelType
void DynamicThreadedGenerateData(const RegionType &) override
typename TInputImage1::SizeType SizeType
typename TInputImage1::ConstPointer InputImage1ConstPointer
void ThreadedGenerateData(const RegionType &outputRegionForThread, ThreadIdType threadId) override
void EnlargeOutputRequestedRegion(DataObject *data) override
typename TInputImage1::Pointer InputImage1Pointer
void SetInput2(const InputImage2Type *image)
typename TInputImage2::Pointer InputImage2Pointer
void PrintSelf(std::ostream &os, Indent indent) const override
void AfterThreadedGenerateData() override
typename TInputImage1::IndexType IndexType
typename TInputImage2::ConstPointer InputImage2ConstPointer
SmartPointer< const Self > ConstPointer
SmartPointer< Self > Pointer
#define itkConceptMacro(name, concept)
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
unsigned int ThreadIdType
Definition: itkIntTypes.h:102