ITK  6.0.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  * 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 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  itkOverrideGetNameOfClassMacro(ImageClassifierBase);
87 
89  using InputImageType = TInputImage;
92 
95 
99  using typename Superclass::MeasurementVectorType;
100 
102  using typename Superclass::MembershipFunctionType;
103 
104  using typename Superclass::MembershipFunctionPointer;
105 
106  using typename Superclass::MembershipFunctionPointerVector;
107 
109  using typename Superclass::DecisionRuleType;
110 
112  itkSetConstObjectMacro(InputImage, InputImageType);
113  itkGetConstObjectMacro(InputImage, InputImageType);
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 
155  InputImageConstPointer m_InputImage{};
156  ClassifiedImagePointer m_ClassifiedImage{};
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
Pointer
SmartPointer< Self > Pointer
Definition: itkAddImageFilter.h:93
ConstPointer
SmartPointer< const Self > ConstPointer
Definition: itkAddImageFilter.h:94
itk::ImageClassifierBase::InputImagePointer
typename TInputImage::Pointer InputImagePointer
Definition: itkImageClassifierBase.h:90
itk::ImageClassifierBase::ClassifiedImagePixelType
typename TClassifiedImage::PixelType ClassifiedImagePixelType
Definition: itkImageClassifierBase.h:128
itk::ClassifierBase
Base class for classifier objects.
Definition: itkClassifierBase.h:87
itk::GTest::TypedefsAndConstructors::Dimension2::SizeType
ImageBaseType::SizeType SizeType
Definition: itkGTestTypedefsAndConstructors.h:49
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:55
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
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnatomicalOrientation.h:29
itk::ImageClassifierBase::InputImageType
TInputImage InputImageType
Definition: itkImageClassifierBase.h:89
itk::Object
Base class for most ITK classes.
Definition: itkObject.h:61
itk::ImageRegionConstIterator
A multi-dimensional iterator templated over image type that walks a region of pixels.
Definition: itkImageRegionConstIterator.h:109
itkClassifierBase.h