00001 /*========================================================================= 00002 00003 Program: Insight Segmentation & Registration Toolkit 00004 Module: $RCSfile: itkSampleClassifier.h,v $ 00005 Language: C++ 00006 Date: $Date: 2003/12/15 01:00:46 $ 00007 Version: $Revision: 1.15 $ 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 __itkSampleClassifier_h 00018 #define __itkSampleClassifier_h 00019 00020 #include <vector> 00021 00022 #include "itkObject.h" 00023 #include "itkExceptionObject.h" 00024 #include "itkSubsample.h" 00025 #include "itkMembershipSample.h" 00026 #include "itkClassifierBase.h" 00027 00028 namespace itk{ 00029 namespace Statistics{ 00030 00065 template< class TSample > 00066 class ITK_EXPORT SampleClassifier : 00067 public ClassifierBase< TSample > 00068 { 00069 public: 00071 typedef SampleClassifier Self; 00072 typedef ClassifierBase< TSample > Superclass; 00073 typedef SmartPointer< Self > Pointer; 00074 typedef SmartPointer<const Self> ConstPointer; 00075 00077 itkTypeMacro(SampleClassifier, Object); 00078 itkNewMacro(Self) ; 00079 00081 typedef MembershipSample< TSample > OutputType ; 00082 00084 typedef typename TSample::MeasurementType MeasurementType ; 00085 typedef typename TSample::MeasurementVectorType MeasurementVectorType ; 00086 00087 itkStaticConstMacro(MeasurementVectorSize, unsigned int, 00088 TSample::MeasurementVectorSize); 00089 00091 typedef typename Superclass::MembershipFunctionPointerVector 00092 MembershipFunctionPointerVector ; 00093 00094 typedef unsigned int ClassLabelType ; 00095 typedef std::vector< ClassLabelType > ClassLabelVectorType ; 00097 void SetSample(const TSample* sample) ; 00098 00100 const TSample* GetSample() const; 00101 00107 void SetMembershipFunctionClassLabels( ClassLabelVectorType& labels) ; 00108 00110 ClassLabelVectorType& GetMembershipFunctionClassLabels() 00111 { return m_ClassLabels ; } 00112 00114 OutputType* GetOutput() ; 00115 00116 protected: 00117 SampleClassifier() ; 00118 virtual ~SampleClassifier() {} 00119 void PrintSelf(std::ostream& os, Indent indent) const; 00120 00122 void GenerateData() ; 00123 00124 private: 00126 const TSample* m_Sample ; 00127 00129 typename OutputType::Pointer m_Output ; 00130 00132 ClassLabelVectorType m_ClassLabels ; 00133 } ; // end of class 00134 00135 00136 } // end of namespace Statistics 00137 } // end of namespace itk 00138 00139 00140 #ifndef ITK_MANUAL_INSTANTIATION 00141 #include "itkSampleClassifier.txx" 00142 #endif 00143 00144 #endif 00145 00146 00147 00148 00149 00150 00151