ITK  6.0.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 * 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 itkClassifierBase_h
19#define itkClassifierBase_h
20
23#include "itkDecisionRule.h"
24
25#include <vector>
26
27namespace itk
28{
86template <typename TDataContainer>
87class ITK_TEMPLATE_EXPORT ClassifierBase : public LightProcessObject
88{
89public:
90 ITK_DISALLOW_COPY_AND_MOVE(ClassifierBase);
91
95
97 itkOverrideGetNameOfClassMacro(ClassifierBase);
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
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
153
155 void
157
158protected:
160 ~ClassifierBase() override = default;
161 void
162 PrintSelf(std::ostream & os, Indent indent) const override;
163
166 void
167 GenerateData() override = 0;
168
169private:
171 unsigned int m_NumberOfClasses{};
172
174 typename DecisionRuleType::Pointer m_DecisionRule{};
175
177 MembershipFunctionPointerVector m_MembershipFunctions{};
178}; // class Classifier
179} // namespace itk
180
181#ifndef ITK_MANUAL_INSTANTIATION
182# include "itkClassifierBase.hxx"
183#endif
184
185#endif
Base class for classifier objects.
unsigned int AddMembershipFunction(MembershipFunctionType *function)
void SetDecisionRule(DecisionRuleType *ptrToDecisionRule)
unsigned int GetNumberOfMembershipFunctions()
void GenerateData() override=0
~ClassifierBase() override=default
typename MembershipFunctionType::Pointer MembershipFunctionPointer
std::vector< MembershipFunctionPointer > MembershipFunctionPointerVector
void PrintSelf(std::ostream &os, Indent indent) const override
const MembershipFunctionType * GetMembershipFunction(unsigned int index) const
DecisionRuleType * GetDecisionRule()
typename TDataContainer::ValueType MeasurementVectorType
Control indentation during Print() invocation.
Definition: itkIndent.h:50
Light weight base class for most itk classes.
LightProcessObject is the base class for all process objects (source, filters, mappers) in the Insigh...
Base class for most ITK classes.
Definition: itkObject.h:62
Base class for decision rules that return a class label based on a set of discriminant scores.
MembershipFunctionBase defines common interfaces for membership functions.
SmartPointer< Self > Pointer
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....