ITK  4.6.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 >
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();
153  virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE;
154 
157  virtual void GenerateData() = 0;
158 
159 private:
160  ClassifierBase(const Self &); //purposely not implemented
161  void operator=(const Self &); //purposely not implemented
162 
164  unsigned int m_NumberOfClasses;
165 
168 
171 }; // class Classifier
172 } // namespace itk
173 
174 #ifndef ITK_MANUAL_INSTANTIATION
175 #include "itkClassifierBase.hxx"
176 #endif
177 
178 #endif
MembershipFunctionPointerVector m_MembershipFunctions
DecisionRuleType * GetDecisionRule(void)
virtual void GenerateData()=0
MembershipFunctionType::Pointer MembershipFunctionPointer
unsigned int GetNumberOfMembershipFunctions()
TDataContainer::ValueType MeasurementVectorType
unsigned int m_NumberOfClasses
unsigned int AddMembershipFunction(MembershipFunctionType *function)
ObjectType * GetPointer() const
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...
void operator=(const Self &)
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
DecisionRuleType::Pointer m_DecisionRule
virtual void PrintSelf(std::ostream &os, Indent indent) const ITK_OVERRIDE