00001 /*========================================================================= 00002 00003 Program: Insight Segmentation & Registration Toolkit 00004 Module: $RCSfile: itkSampleClassifier.h,v $ 00005 Language: C++ 00006 Date: $Date: 2005/07/26 15:55:04 $ 00007 Version: $Revision: 1.16 $ 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) ; 00086 00088 typedef MembershipSample< TSample > OutputType ; 00089 00091 typedef typename TSample::MeasurementType MeasurementType ; 00092 typedef typename TSample::MeasurementVectorType MeasurementVectorType ; 00093 00094 00096 typedef typename Superclass::MembershipFunctionPointerVector 00097 MembershipFunctionPointerVector ; 00098 00099 typedef unsigned int ClassLabelType ; 00100 typedef std::vector< ClassLabelType > ClassLabelVectorType ; 00102 void SetSample(const TSample* sample) ; 00103 00105 const TSample* GetSample() const; 00106 00112 void SetMembershipFunctionClassLabels( ClassLabelVectorType& labels) ; 00113 00115 ClassLabelVectorType& GetMembershipFunctionClassLabels() 00116 { return m_ClassLabels ; } 00117 00119 OutputType* GetOutput() ; 00120 00121 protected: 00122 SampleClassifier() ; 00123 virtual ~SampleClassifier() {} 00124 void PrintSelf(std::ostream& os, Indent indent) const; 00125 00127 void GenerateData() ; 00128 00129 private: 00131 const TSample* m_Sample ; 00132 00134 typename OutputType::Pointer m_Output ; 00135 00137 ClassLabelVectorType m_ClassLabels ; 00138 } ; // end of class 00139 00140 00141 } // end of namespace Statistics 00142 } // end of namespace itk 00143 00144 00145 #ifndef ITK_MANUAL_INSTANTIATION 00146 #include "itkSampleClassifier.txx" 00147 #endif 00148 00149 #endif 00150 00151 00152 00153 00154 00155 00156