00001 /*========================================================================= 00002 00003 Program: Insight Segmentation & Registration Toolkit 00004 Module: $RCSfile: itkSampleClassifier.h,v $ 00005 Language: C++ 00006 Date: $Date: 2009-03-04 19:29:53 $ 00007 Version: $Revision: 1.17 $ 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 00072 template< class TSample > 00073 class ITK_EXPORT SampleClassifier : 00074 public ClassifierBase< TSample > 00075 { 00076 public: 00078 typedef SampleClassifier Self; 00079 typedef ClassifierBase< TSample > Superclass; 00080 typedef SmartPointer< Self > Pointer; 00081 typedef SmartPointer<const Self> ConstPointer; 00082 00084 itkTypeMacro(SampleClassifier, Object); 00085 itkNewMacro(Self); 00087 00089 typedef MembershipSample< TSample > OutputType; 00090 00092 typedef typename TSample::MeasurementType MeasurementType; 00093 typedef typename TSample::MeasurementVectorType MeasurementVectorType; 00094 00095 00097 typedef typename Superclass::MembershipFunctionPointerVector 00098 MembershipFunctionPointerVector; 00099 00100 typedef unsigned int ClassLabelType; 00101 typedef std::vector< ClassLabelType > ClassLabelVectorType; 00103 void SetSample(const TSample* sample); 00104 00106 const TSample* GetSample() const; 00107 00113 void SetMembershipFunctionClassLabels( ClassLabelVectorType& labels); 00114 00116 ClassLabelVectorType& GetMembershipFunctionClassLabels() 00117 { return m_ClassLabels; } 00118 00120 OutputType* GetOutput(); 00121 00122 protected: 00123 SampleClassifier(); 00124 virtual ~SampleClassifier() {} 00125 void PrintSelf(std::ostream& os, Indent indent) const; 00126 00128 void GenerateData(); 00129 00130 private: 00132 const TSample* m_Sample; 00133 00135 typename OutputType::Pointer m_Output; 00136 00138 ClassLabelVectorType m_ClassLabels; 00139 }; // end of class 00140 00141 00142 } // end of namespace Statistics 00143 } // end of namespace itk 00144 00145 00146 #ifndef ITK_MANUAL_INSTANTIATION 00147 #include "itkSampleClassifier.txx" 00148 #endif 00149 00150 #endif 00151