ITK  4.12.0
Insight Segmentation and Registration Toolkit
itkSimilarityIndexImageFilter.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 itkSimilarityIndexImageFilter_h
19 #define itkSimilarityIndexImageFilter_h
20 
21 #include "itkImageToImageFilter.h"
22 #include "itkNumericTraits.h"
23 #include "itkArray.h"
24 
25 namespace itk
26 {
59 template< typename TInputImage1, typename TInputImage2 >
60 class ITK_TEMPLATE_EXPORT SimilarityIndexImageFilter:
61  public ImageToImageFilter< TInputImage1, TInputImage1 >
62 {
63 public:
69 
71  itkNewMacro(Self);
72 
75 
77  typedef TInputImage1 InputImage1Type;
78  typedef TInputImage2 InputImage2Type;
83 
84  typedef typename TInputImage1::RegionType RegionType;
85  typedef typename TInputImage1::SizeType SizeType;
86  typedef typename TInputImage1::IndexType IndexType;
87 
88  typedef typename TInputImage1::PixelType InputImage1PixelType;
89  typedef typename TInputImage2::PixelType InputImage2PixelType;
90 
92  itkStaticConstMacro(ImageDimension, unsigned int,
93  TInputImage1::ImageDimension);
94 
97 
99  void SetInput1(const InputImage1Type *image)
100  { this->SetInput(image); }
101 
103  void SetInput2(const InputImage2Type *image);
104 
107  { return this->GetInput(); }
108 
110  const InputImage2Type * GetInput2();
111 
113  itkGetConstMacro(SimilarityIndex, RealType);
114 
115 #ifdef ITK_USE_CONCEPT_CHECKING
116  // Begin concept checking
117  itkConceptMacro( Input1HasNumericTraitsCheck,
119  itkConceptMacro( Input2HasNumericTraitsCheck,
121  // End concept checking
122 #endif
123 
124 protected:
127  void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE;
128 
131  void AllocateOutputs() ITK_OVERRIDE;
132 
134  void BeforeThreadedGenerateData() ITK_OVERRIDE;
135 
138  void AfterThreadedGenerateData() ITK_OVERRIDE;
139 
141  void ThreadedGenerateData(const RegionType &
142  outputRegionForThread,
143  ThreadIdType threadId) ITK_OVERRIDE;
144 
145  // Override since the filter needs all the data for the algorithm
146  void GenerateInputRequestedRegion() ITK_OVERRIDE;
147 
148  // Override since the filter produces all of its output
149  void EnlargeOutputRequestedRegion(DataObject *data) ITK_OVERRIDE;
150 
151 private:
152  ITK_DISALLOW_COPY_AND_ASSIGN(SimilarityIndexImageFilter);
153 
154  RealType m_SimilarityIndex;
155 
156  Array< SizeValueType > m_CountOfImage1;
157  Array< SizeValueType > m_CountOfImage2;
158  Array< SizeValueType > m_CountOfIntersection;
159 }; // end of class
160 } // end namespace itk
161 
162 #ifndef ITK_MANUAL_INSTANTIATION
163 #include "itkSimilarityIndexImageFilter.hxx"
164 #endif
165 
166 #endif
Array class with size defined at construction time.
Definition: itkArray.h:50
virtual void PrintSelf(std::ostream &os, Indent indent) const override
Light weight base class for most itk classes.
TInputImage2::ConstPointer InputImage2ConstPointer
unsigned long SizeValueType
Definition: itkIntTypes.h:143
NumericTraits< InputImage1PixelType >::RealType RealType
SmartPointer< Self > Pointer
SmartPointer< const Self > ConstPointer
ImageToImageFilter< TInputImage1, TInputImage1 > Superclass
Measures the similarity between the set of non-zero pixels of two images.
void SetInput1(const InputImage1Type *image)
unsigned int ThreadIdType
Definition: itkIntTypes.h:159
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:49
Define additional traits for native types such as int or float.
#define itkConceptMacro(name, concept)
TInputImage1::ConstPointer InputImage1ConstPointer