ITK  5.2.0
Insight Toolkit
itkClassifierBase.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 itkClassifierBase_h
19 #define itkClassifierBase_h
20 
21 #include "itkLightProcessObject.h"
23 #include "itkDecisionRule.h"
24 
25 #include <vector>
26 
27 namespace itk
28 {
86 template <typename TDataContainer>
87 class ITK_TEMPLATE_EXPORT ClassifierBase : public LightProcessObject
88 {
89 public:
90  ITK_DISALLOW_COPY_AND_MOVE(ClassifierBase);
91 
95 
97  itkTypeMacro(ClassifierBase, LightProcessObject);
98 
100  itkSetMacro(NumberOfClasses, unsigned int);
101 
103  itkGetConstReferenceMacro(NumberOfClasses, unsigned int);
104 
106  using MeasurementVectorType = typename TDataContainer::ValueType;
107 
111 
112  using MembershipFunctionPointerVector = std::vector<MembershipFunctionPointer>;
113 
116 
120  void
121  SetDecisionRule(DecisionRuleType * ptrToDecisionRule)
122  {
123  m_DecisionRule = ptrToDecisionRule;
124  }
125 
127  DecisionRuleType *
129  {
130  return m_DecisionRule.GetPointer();
131  }
132 
137  const MembershipFunctionType *
138  GetMembershipFunction(unsigned int index) const
139  {
140  return m_MembershipFunctions[index].GetPointer();
141  }
142 
144  unsigned int
146  {
147  return static_cast<unsigned int>(m_MembershipFunctions.size());
148  }
149 
151  unsigned int
152  AddMembershipFunction(MembershipFunctionType * function);
153 
155  void
156  Update();
157 
158 protected:
159  ClassifierBase();
160  ~ClassifierBase() override = default;
161  void
162  PrintSelf(std::ostream & os, Indent indent) const override;
163 
166  void
167  GenerateData() override = 0;
168 
169 private:
171  unsigned int m_NumberOfClasses;
172 
175 
178 }; // class Classifier
179 } // namespace itk
180 
181 #ifndef ITK_MANUAL_INSTANTIATION
182 # include "itkClassifierBase.hxx"
183 #endif
184 
185 #endif
itk::ClassifierBase::SetDecisionRule
void SetDecisionRule(DecisionRuleType *ptrToDecisionRule)
Definition: itkClassifierBase.h:121
itk::LightProcessObject
LightProcessObject is the base class for all process objects (source, filters, mappers) in the Insigh...
Definition: itkLightProcessObject.h:72
itk::ClassifierBase::GetMembershipFunction
const MembershipFunctionType * GetMembershipFunction(unsigned int index) const
Definition: itkClassifierBase.h:138
itk::ClassifierBase
Base class for classifier objects.
Definition: itkClassifierBase.h:87
itkLightProcessObject.h
itk::ClassifierBase< TInputImage >::MeasurementVectorType
typename TInputImage ::ValueType MeasurementVectorType
Definition: itkClassifierBase.h:106
itkDecisionRule.h
itk::Statistics::MembershipFunctionBase
MembershipFunctionBase defines common interfaces for membership functions.
Definition: itkMembershipFunctionBase.h:58
itk::SmartPointer< Self >
itk::Indent
Control indentation during Print() invocation.
Definition: itkIndent.h:49
itk::ClassifierBase< TInputImage >::MembershipFunctionPointerVector
std::vector< MembershipFunctionPointer > MembershipFunctionPointerVector
Definition: itkClassifierBase.h:112
itk::ClassifierBase::m_DecisionRule
DecisionRuleType::Pointer m_DecisionRule
Definition: itkClassifierBase.h:174
itk::LightObject
Light weight base class for most itk classes.
Definition: itkLightObject.h:59
itk::ClassifierBase::GetNumberOfMembershipFunctions
unsigned int GetNumberOfMembershipFunctions()
Definition: itkClassifierBase.h:145
itk::ClassifierBase::m_MembershipFunctions
MembershipFunctionPointerVector m_MembershipFunctions
Definition: itkClassifierBase.h:177
itkMembershipFunctionBase.h
itk::Statistics::DecisionRule
Base class for decision rules that return a class label based on a set of discriminant scores.
Definition: itkDecisionRule.h:48
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnnulusOperator.h:24
itk::ClassifierBase::m_NumberOfClasses
unsigned int m_NumberOfClasses
Definition: itkClassifierBase.h:171
itk::Object
Base class for most ITK classes.
Definition: itkObject.h:62
itk::ClassifierBase::GetDecisionRule
DecisionRuleType * GetDecisionRule()
Definition: itkClassifierBase.h:128
itk::ClassifierBase< TInputImage >::MembershipFunctionPointer
typename MembershipFunctionType::Pointer MembershipFunctionPointer
Definition: itkClassifierBase.h:110