00001 /*========================================================================= 00002 00003 Program: Insight Segmentation & Registration Toolkit 00004 Module: $RCSfile: itkTableLookupSampleClassifier.h,v $ 00005 Language: C++ 00006 Date: $Date: 2002/10/01 01:36:06 $ 00007 Version: $Revision: 1.8 $ 00008 00009 Copyright (c) 2002 Insight 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 __itkTableLookupSampleClassifier_h 00018 #define __itkTableLookupSampleClassifier_h 00019 00020 #include <vector> 00021 00022 #include "itkSampleClassifier.h" 00023 #include "itkImageRegionIteratorWithIndex.h" 00024 00025 namespace itk{ 00026 namespace Statistics{ 00027 00073 template< class TSample > 00074 class ITK_EXPORT TableLookupSampleClassifier : 00075 public SampleClassifier< TSample > 00076 { 00077 public: 00079 typedef TableLookupSampleClassifier Self; 00080 typedef SampleClassifier< TSample > Superclass; 00081 typedef SmartPointer<Self> Pointer; 00082 00084 itkTypeMacro(TableLookupSampleClassifier, SampleClassifier); 00085 itkNewMacro(Self) ; 00086 00088 typedef typename Superclass::OutputType OutputType; 00089 typedef typename Superclass::MeasurementType MeasurementType ; 00090 typedef typename Superclass::MeasurementVectorType MeasurementVectorType ; 00091 00092 itkStaticConstMacro(MeasurementVectorSize, unsigned int, 00093 Superclass::MeasurementVectorSize); 00094 00096 typedef Index< itkGetStaticConstMacro(MeasurementVectorSize) > CachedMeasurementVectorType ; 00097 typedef Image< MeasurementType, itkGetStaticConstMacro(MeasurementVectorSize) > LookupTableType ; 00098 typedef typename LookupTableType::Pointer LookupTablePointer ; 00099 typedef ImageRegionIteratorWithIndex< LookupTableType > LookupTableIteratorType ; 00100 typedef typename LookupTableType::RegionType RegionType ; 00101 typedef typename LookupTableType::SizeType SizeType ; 00102 00104 void SetLookupTableLowerBound(MeasurementVectorType lower) ; 00105 00107 void SetLookupTableUpperBound(MeasurementVectorType upper) ; 00108 00109 protected: 00110 TableLookupSampleClassifier() ; 00111 virtual ~TableLookupSampleClassifier() {} 00112 void PrintSelf(std::ostream& os, Indent indent) const; 00113 00114 void PrepareLookupTable() ; 00115 00117 void GenerateData() ; 00118 00119 private: 00120 LookupTablePointer m_LookupTable ; 00121 CachedMeasurementVectorType m_UpperBound ; 00122 CachedMeasurementVectorType m_LowerBound ; 00123 } ; // end of class 00124 00125 00126 } // end of namespace Statistics 00127 } // end of namespace itk 00128 00129 00130 #ifndef ITK_MANUAL_INSTANTIATION 00131 #include "itkTableLookupSampleClassifier.txx" 00132 #endif 00133 00134 #endif 00135 00136 00137 00138 00139 00140 00141