ITK  5.0.0
Insight Segmentation and Registration Toolkit
itkClassifierBase.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 itkClassifierBase_h
19 #define itkClassifierBase_h
20 
21 #include "itkLightProcessObject.h"
23 #include "itkDecisionRule.h"
24 
25 #include <vector>
26 
27 namespace itk
28 {
85 template< typename TDataContainer >
86 class ITK_TEMPLATE_EXPORT ClassifierBase:public LightProcessObject
87 {
88 public:
89  ITK_DISALLOW_COPY_AND_ASSIGN(ClassifierBase);
90 
94 
96  itkTypeMacro(ClassifierBase, LightProcessObject);
97 
99  itkSetMacro(NumberOfClasses, unsigned int);
100 
102  itkGetConstReferenceMacro(NumberOfClasses, unsigned int);
103 
105  using MeasurementVectorType = typename TDataContainer::ValueType;
106 
110 
111  using MembershipFunctionPointerVector = std::vector<MembershipFunctionPointer>;
112 
115 
119  void SetDecisionRule(DecisionRuleType *ptrToDecisionRule)
120  {
121  m_DecisionRule = ptrToDecisionRule;
122  }
123 
126  {
127  return m_DecisionRule.GetPointer();
128  }
129 
134  const MembershipFunctionType * GetMembershipFunction(unsigned int index) const
135  {
136  return m_MembershipFunctions[index].GetPointer();
137  }
138 
141  {
142  return static_cast< unsigned int >( m_MembershipFunctions.size() );
143  }
144 
146  unsigned int AddMembershipFunction(MembershipFunctionType *function);
147 
149  void Update();
150 
151 protected:
152  ClassifierBase();
153  ~ClassifierBase() override = default;
154  void PrintSelf(std::ostream & os, Indent indent) const override;
155 
158  void GenerateData() override = 0;
159 
160 private:
162  unsigned int m_NumberOfClasses;
163 
166 
169 }; // class Classifier
170 } // namespace itk
171 
172 #ifndef ITK_MANUAL_INSTANTIATION
173 #include "itkClassifierBase.hxx"
174 #endif
175 
176 #endif
typename MembershipFunctionType::Pointer MembershipFunctionPointer
MembershipFunctionPointerVector m_MembershipFunctions
Light weight base class for most itk classes.
unsigned int GetNumberOfMembershipFunctions()
unsigned int m_NumberOfClasses
DecisionRuleType * GetDecisionRule()
std::vector< MembershipFunctionPointer > MembershipFunctionPointerVector
Base class for classifier objects.
Base class for decision rules that return a class label based on a set of discriminant scores...
MembershipFunctionBase defines common interfaces for membership functions.
typename TInputImage::ValueType MeasurementVectorType
const MembershipFunctionType * GetMembershipFunction(unsigned int index) const
void SetDecisionRule(DecisionRuleType *ptrToDecisionRule)
LightProcessObject is the base class for all process objects (source, filters, mappers) in the Insigh...
Control indentation during Print() invocation.
Definition: itkIndent.h:49
Base class for most ITK classes.
Definition: itkObject.h:60
DecisionRuleType::Pointer m_DecisionRule