ITK  5.2.0
Insight Toolkit
itkImageClassifierBase.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 itkImageClassifierBase_h
19 #define itkImageClassifierBase_h
20 
21 #include "itkClassifierBase.h"
22 #include "itkMacro.h"
23 #include "itkImageRegionIterator.h"
24 
25 namespace itk
26 {
70 template <typename TInputImage, typename TClassifiedImage>
71 class ITK_TEMPLATE_EXPORT ImageClassifierBase : public ClassifierBase<TInputImage>
72 {
73 public:
74  ITK_DISALLOW_COPY_AND_MOVE(ImageClassifierBase);
75 
81 
83  itkNewMacro(Self);
84 
86  itkTypeMacro(ImageClassifierBase, ClassifierBase);
87 
89  using InputImageType = TInputImage;
90  using InputImagePointer = typename TInputImage::Pointer;
91  using InputImageConstPointer = typename TInputImage::ConstPointer;
92 
94  using ClassifiedImagePointer = typename TClassifiedImage::Pointer;
95 
99  using MeasurementVectorType = typename Superclass::MeasurementVectorType;
100 
102  using MembershipFunctionType = typename Superclass::MembershipFunctionType;
103 
104  using MembershipFunctionPointer = typename Superclass::MembershipFunctionPointer;
105 
106  using MembershipFunctionPointerVector = typename Superclass::MembershipFunctionPointerVector;
107 
109  using DecisionRuleType = typename Superclass::DecisionRuleType;
110 
112  itkSetConstObjectMacro(InputImage, InputImageType);
113  itkGetConstObjectMacro(InputImage, InputImageType);
115 
117  itkSetMacro(ClassifiedImage, ClassifiedImagePointer);
118 
120  itkGetConstMacro(ClassifiedImage, ClassifiedImagePointer);
121 
124  using InputImagePixelType = typename TInputImage::PixelType;
125 
128  using ClassifiedImagePixelType = typename TClassifiedImage::PixelType;
129 
133 
135  std::vector<double>
136  GetPixelMembershipValue(const InputImagePixelType inputImagePixel);
137 
138 protected:
139  ImageClassifierBase() = default;
140  ~ImageClassifierBase() override = default;
141  void
142  PrintSelf(std::ostream & os, Indent indent) const override;
143 
145  void
146  Allocate();
147 
149  void
150  GenerateData() override;
151 
152 private:
154 
157 
159  virtual void
160  Classify();
161 }; // class ImageClassifierBase
162 } // namespace itk
163 
164 #ifndef ITK_MANUAL_INSTANTIATION
165 # include "itkImageClassifierBase.hxx"
166 #endif
167 
168 #endif
itk::ImageClassifierBase::InputImagePointer
typename TInputImage::Pointer InputImagePointer
Definition: itkImageClassifierBase.h:90
itk::ImageClassifierBase::MembershipFunctionType
typename Superclass::MembershipFunctionType MembershipFunctionType
Definition: itkImageClassifierBase.h:102
itk::ImageClassifierBase::ClassifiedImagePixelType
typename TClassifiedImage::PixelType ClassifiedImagePixelType
Definition: itkImageClassifierBase.h:128
itk::ClassifierBase
Base class for classifier objects.
Definition: itkClassifierBase.h:87
itk::ImageClassifierBase::DecisionRuleType
typename Superclass::DecisionRuleType DecisionRuleType
Definition: itkImageClassifierBase.h:109
itk::GTest::TypedefsAndConstructors::Dimension2::SizeType
ImageBaseType::SizeType SizeType
Definition: itkGTestTypedefsAndConstructors.h:49
itk::ImageClassifierBase::MembershipFunctionPointer
typename Superclass::MembershipFunctionPointer MembershipFunctionPointer
Definition: itkImageClassifierBase.h:104
itk::SmartPointer< Self >
itkImageRegionIterator.h
itk::Indent
Control indentation during Print() invocation.
Definition: itkIndent.h:49
itk::ImageClassifierBase::InputImageConstPointer
typename TInputImage::ConstPointer InputImageConstPointer
Definition: itkImageClassifierBase.h:91
itk::ImageRegionIterator
A multi-dimensional iterator templated over image type that walks a region of pixels.
Definition: itkImageRegionIterator.h:80
itk::ImageClassifierBase::InputImageSizeType
typename TInputImage::SizeType InputImageSizeType
Definition: itkImageClassifierBase.h:153
itk::LightObject
Light weight base class for most itk classes.
Definition: itkLightObject.h:59
itk::ImageClassifierBase::MeasurementVectorType
typename Superclass::MeasurementVectorType MeasurementVectorType
Definition: itkImageClassifierBase.h:99
itk::ImageClassifierBase::m_ClassifiedImage
ClassifiedImagePointer m_ClassifiedImage
Definition: itkImageClassifierBase.h:156
itkMacro.h
itk::ImageClassifierBase
Base class for the ImageClassifierBase object.
Definition: itkImageClassifierBase.h:71
itk::ImageClassifierBase::InputImagePixelType
typename TInputImage::PixelType InputImagePixelType
Definition: itkImageClassifierBase.h:124
itk::ImageClassifierBase::ClassifiedImagePointer
typename TClassifiedImage::Pointer ClassifiedImagePointer
Definition: itkImageClassifierBase.h:94
itk::ImageClassifierBase::MembershipFunctionPointerVector
typename Superclass::MembershipFunctionPointerVector MembershipFunctionPointerVector
Definition: itkImageClassifierBase.h:106
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnnulusOperator.h:24
itk::ImageClassifierBase::InputImageType
TInputImage InputImageType
Definition: itkImageClassifierBase.h:89
itk::ImageClassifierBase::m_InputImage
InputImageConstPointer m_InputImage
Definition: itkImageClassifierBase.h:155
itk::Object
Base class for most ITK classes.
Definition: itkObject.h:62
itk::ImageRegionConstIterator
A multi-dimensional iterator templated over image type that walks a region of pixels.
Definition: itkImageRegionConstIterator.h:109
itkClassifierBase.h