ITK  4.13.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:
92 
94  itkTypeMacro(ClassifierBase, LightProcessObject);
95 
97  itkSetMacro(NumberOfClasses, unsigned int);
98 
100  itkGetConstReferenceMacro(NumberOfClasses, unsigned int);
101 
103  typedef typename TDataContainer::ValueType MeasurementVectorType;
104 
108 
109  typedef std::vector< MembershipFunctionPointer >
111 
114 
118  void SetDecisionRule(DecisionRuleType *ptrToDecisionRule)
119  {
120  m_DecisionRule = ptrToDecisionRule;
121  }
122 
125  {
126  return m_DecisionRule.GetPointer();
127  }
128 
133  const MembershipFunctionType * GetMembershipFunction(unsigned int index) const
134  {
135  return m_MembershipFunctions[index].GetPointer();
136  }
137 
140  {
141  return static_cast< unsigned int >( m_MembershipFunctions.size() );
142  }
143 
145  unsigned int AddMembershipFunction(MembershipFunctionType *function);
146 
148  void Update();
149 
150 protected:
151  ClassifierBase();
152  ~ClassifierBase() ITK_OVERRIDE;
153  virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE;
154 
157  virtual void GenerateData() ITK_OVERRIDE = 0;
158 
159 private:
160  ITK_DISALLOW_COPY_AND_ASSIGN(ClassifierBase);
161 
163  unsigned int m_NumberOfClasses;
164 
166  typename DecisionRuleType::Pointer m_DecisionRule;
167 
169  MembershipFunctionPointerVector m_MembershipFunctions;
170 }; // class Classifier
171 } // namespace itk
172 
173 #ifndef ITK_MANUAL_INSTANTIATION
174 #include "itkClassifierBase.hxx"
175 #endif
176 
177 #endif
DecisionRuleType * GetDecisionRule(void)
MembershipFunctionType::Pointer MembershipFunctionPointer
unsigned int GetNumberOfMembershipFunctions()
TDataContainer::ValueType MeasurementVectorType
Base class for classifier objects.
Statistics::MembershipFunctionBase< MeasurementVectorType > MembershipFunctionType
Base class for decision rules that return a class label based on a set of discriminant scores...
MembershipFunctionBase defines common interfaces for membership functions.
const MembershipFunctionType * GetMembershipFunction(unsigned int index) const
void SetDecisionRule(DecisionRuleType *ptrToDecisionRule)
std::vector< MembershipFunctionPointer > MembershipFunctionPointerVector
LightProcessObject is the base class for all process objects (source, filters, mappers) in the Insigh...
Statistics::DecisionRule DecisionRuleType
Control indentation during Print() invocation.
Definition: itkIndent.h:49
LightProcessObject Superclass