ITK  4.8.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 >
61  public ImageToImageFilter< TInputImage1, TInputImage1 >
62 {
63 public:
69 
71  itkNewMacro(Self);
72 
75 
77  typedef TInputImage1 InputImage1Type;
78  typedef TInputImage2 InputImage2Type;
79  typedef typename TInputImage1::Pointer InputImage1Pointer;
80  typedef typename TInputImage2::Pointer InputImage2Pointer;
81  typedef typename TInputImage1::ConstPointer InputImage1ConstPointer;
82  typedef typename TInputImage2::ConstPointer InputImage2ConstPointer;
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  SimilarityIndexImageFilter(const Self &); //purposely not implemented
153  void operator=(const Self &); //purposely not implemented
154 
156 
160 }; // end of class
161 } // end namespace itk
162 
163 #ifndef ITK_MANUAL_INSTANTIATION
164 #include "itkSimilarityIndexImageFilter.hxx"
165 #endif
166 
167 #endif
Array class with size defined at construction time.
Definition: itkArray.h:50
Light weight base class for most itk classes.
TInputImage2::ConstPointer InputImage2ConstPointer
void EnlargeOutputRequestedRegion(DataObject *data) override
void GenerateInputRequestedRegion() override
void PrintSelf(std::ostream &os, Indent indent) const override
unsigned long SizeValueType
Definition: itkIntTypes.h:143
NumericTraits< InputImage1PixelType >::RealType RealType
virtual void SetInput(const InputImageType *image)
void ThreadedGenerateData(const RegionType &outputRegionForThread, ThreadIdType threadId) override
void BeforeThreadedGenerateData() override
const InputImage2Type * GetInput2()
ImageToImageFilter< TInputImage1, TInputImage1 > Superclass
Measures the similarity between the set of non-zero pixels of two images.
void SetInput1(const InputImage1Type *image)
void SetInput2(const InputImage2Type *image)
unsigned int ThreadIdType
Definition: itkIntTypes.h:159
void AfterThreadedGenerateData() override
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
Base class for all data objects in ITK.