ITK  4.4.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< class TDataContainer >
86 class ITK_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 
124  DecisionRuleType * GetDecisionRule(void)
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 
139  unsigned int GetNumberOfMembershipFunctions()
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  void PrintSelf(std::ostream & os, Indent indent) const;
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
179