ITK  5.0.0
Insight Segmentation and Registration Toolkit
itkImageClassifierBase.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 itkImageClassifierBase_h
19 #define itkImageClassifierBase_h
20 
21 #include "itkClassifierBase.h"
22 #include "itkMacro.h"
23 #include "itkImageRegionIterator.h"
24 
25 namespace itk
26 {
69 template< typename TInputImage,
70  typename TClassifiedImage >
71 class ITK_TEMPLATE_EXPORT ImageClassifierBase:
72  public ClassifierBase< TInputImage >
73 {
74 public:
75  ITK_DISALLOW_COPY_AND_ASSIGN(ImageClassifierBase);
76 
82 
84  itkNewMacro(Self);
85 
87  itkTypeMacro(ImageClassifierBase, ClassifierBase);
88 
90  using InputImageType = TInputImage;
91  using InputImagePointer = typename TInputImage::Pointer;
92  using InputImageConstPointer = typename TInputImage::ConstPointer;
93 
95  using ClassifiedImagePointer = typename TClassifiedImage::Pointer;
96 
100  using MeasurementVectorType = typename Superclass::MeasurementVectorType;
101 
103  using MembershipFunctionType = typename Superclass::MembershipFunctionType;
104 
105  using MembershipFunctionPointer = typename Superclass::MembershipFunctionPointer;
106 
107  using MembershipFunctionPointerVector = typename Superclass::MembershipFunctionPointerVector;
108 
110  using DecisionRuleType = typename Superclass::DecisionRuleType;
111 
113  itkSetConstObjectMacro(InputImage, InputImageType);
114  itkGetConstObjectMacro(InputImage, InputImageType);
116 
118  itkSetMacro(ClassifiedImage, ClassifiedImagePointer);
119 
121  itkGetConstMacro(ClassifiedImage, ClassifiedImagePointer);
122 
125  using InputImagePixelType = typename TInputImage::PixelType;
126 
129  using ClassifiedImagePixelType = typename TClassifiedImage::PixelType;
130 
134 
136  std::vector< double >
137  GetPixelMembershipValue(const InputImagePixelType inputImagePixel);
138 
139 protected:
140  ImageClassifierBase() = default;
141  ~ImageClassifierBase() override = default;
142  void PrintSelf(std::ostream & os, Indent indent) const override;
143 
145  void Allocate();
146 
148  void GenerateData() override;
149 
150 private:
152 
155 
157  virtual void Classify();
158 }; // class ImageClassifierBase
159 } // namespace itk
160 
161 #ifndef ITK_MANUAL_INSTANTIATION
162 #include "itkImageClassifierBase.hxx"
163 #endif
164 
165 #endif
Light weight base class for most itk classes.
typename TInputImage::SizeType InputImageSizeType
InputImageConstPointer m_InputImage
typename Superclass::MembershipFunctionPointerVector MembershipFunctionPointerVector
typename TInputImage::Pointer InputImagePointer
Base class for the ImageClassifierBase object.
typename Superclass::MembershipFunctionPointer MembershipFunctionPointer
Base class for classifier objects.
typename TInputImage::PixelType InputImagePixelType
typename Superclass::DecisionRuleType DecisionRuleType
A multi-dimensional iterator templated over image type that walks a region of pixels.
typename TInputImage::ConstPointer InputImageConstPointer
ClassifiedImagePointer m_ClassifiedImage
typename Superclass::MeasurementVectorType MeasurementVectorType
Control indentation during Print() invocation.
Definition: itkIndent.h:49
typename TClassifiedImage::PixelType ClassifiedImagePixelType
typename TClassifiedImage::Pointer ClassifiedImagePointer
typename Superclass::MembershipFunctionType MembershipFunctionType
Base class for most ITK classes.
Definition: itkObject.h:60
A multi-dimensional iterator templated over image type that walks a region of pixels.