00001 /*========================================================================= 00002 00003 Program: Insight Segmentation & Registration Toolkit 00004 Module: $RCSfile: itkClassifierBase.h,v $ 00005 Language: C++ 00006 Date: $Date: 2006-02-05 20:57:45 $ 00007 Version: $Revision: 1.11 $ 00008 00009 Copyright (c) Insight Software Consortium. All rights reserved. 00010 See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details. 00011 00012 This software is distributed WITHOUT ANY WARRANTY; without even 00013 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00014 PURPOSE. See the above copyright notices for more information. 00015 00016 =========================================================================*/ 00017 #ifndef _itkClassifierBase_h 00018 #define _itkClassifierBase_h 00019 00020 #include "itkLightProcessObject.h" 00021 #include "itkMembershipFunctionBase.h" 00022 #include "itkDecisionRuleBase.h" 00023 00024 #include <vector> 00025 00026 namespace itk 00027 { 00028 00085 template <class TDataContainer> 00086 class ITK_EXPORT ClassifierBase : public LightProcessObject 00087 { 00088 public: 00090 typedef ClassifierBase Self; 00091 typedef LightProcessObject Superclass; 00092 00094 itkTypeMacro(ClassifierBase,LightProcessObject); 00095 00097 itkSetMacro(NumberOfClasses, unsigned int); 00098 00100 itkGetConstReferenceMacro(NumberOfClasses, unsigned int); 00101 00103 typedef typename TDataContainer::ValueType MeasurementVectorType ; 00104 00106 typedef Statistics::MembershipFunctionBase< MeasurementVectorType > 00107 MembershipFunctionType; 00108 typedef typename MembershipFunctionType::Pointer MembershipFunctionPointer ; 00109 00110 typedef std::vector< MembershipFunctionPointer > 00111 MembershipFunctionPointerVector; 00112 00114 typedef DecisionRuleBase DecisionRuleType; 00115 00119 void SetDecisionRule( DecisionRuleType* ptrToDecisionRule ) 00120 { 00121 m_DecisionRule = ptrToDecisionRule; 00122 } 00123 00125 DecisionRuleType* GetDecisionRule(void) 00126 { 00127 return m_DecisionRule.GetPointer() ; 00128 } 00129 00134 const MembershipFunctionType* GetMembershipFunction(unsigned int index)const 00135 { 00136 return m_MembershipFunctions[index].GetPointer() ; 00137 } 00138 00140 unsigned int GetNumberOfMembershipFunctions() 00141 { 00142 return static_cast<unsigned int>( m_MembershipFunctions.size() ); 00143 } 00144 00146 unsigned int AddMembershipFunction(MembershipFunctionType* function); 00147 00149 void Update() ; 00150 00151 protected: 00152 ClassifierBase() ; 00153 ~ClassifierBase() ; 00154 void PrintSelf(std::ostream& os, Indent indent) const; 00155 00158 virtual void GenerateData() = 0 ; 00159 00160 private: 00161 ClassifierBase(const Self&); //purposely not implemented 00162 void operator=(const Self&); //purposely not implemented 00163 00165 unsigned int m_NumberOfClasses ; 00166 00168 typename DecisionRuleType::Pointer m_DecisionRule ; 00169 00171 MembershipFunctionPointerVector m_MembershipFunctions ; 00172 00173 }; // class Classifier 00174 00175 00176 } // namespace itk 00177 00178 #ifndef ITK_MANUAL_INSTANTIATION 00179 #include "itkClassifierBase.txx" 00180 #endif 00181 00182 #endif 00183 00184