00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef __itkSample_h
00018 #define __itkSample_h
00019
00020 #include <vector>
00021
00022 #include "itkMacro.h"
00023 #include "itkPoint.h"
00024 #include "itkSize.h"
00025 #include "itkObject.h"
00026 #include "itkFixedArray.h"
00027 #include "itkMeasurementVectorTraits.h"
00028
00029 namespace itk{
00030 namespace Statistics{
00031
00061 template < class TMeasurementVector >
00062 class ITK_EXPORT Sample : public Object
00063 {
00064 public:
00066 typedef Sample Self;
00067 typedef Object Superclass ;
00068 typedef SmartPointer< Self > Pointer ;
00069 typedef SmartPointer<const Self> ConstPointer;
00070
00072 itkTypeMacro(Sample, Object);
00073
00075 typedef TMeasurementVector MeasurementVectorType ;
00076
00079 typedef typename MeasurementVectorType::ValueType MeasurementType;
00080
00082 typedef float FrequencyType ;
00083
00086 typedef unsigned long InstanceIdentifier ;
00087
00089 typedef unsigned int MeasurementVectorSizeType;
00090
00092 virtual unsigned int Size() const = 0 ;
00093
00096 virtual const MeasurementVectorType &
00097 GetMeasurementVector(const InstanceIdentifier &id) const = 0 ;
00098
00101 virtual FrequencyType GetFrequency(const InstanceIdentifier &id) const = 0 ;
00102
00104 virtual FrequencyType GetTotalFrequency() const
00105 = 0 ;
00106
00107
00109 virtual void SetMeasurementVectorSize( const MeasurementVectorSizeType s )
00110 {
00111 MeasurementVectorType m;
00112 MeasurementVectorSizeType defaultLength = MeasurementVectorTraits::GetLength( m );
00113 if( (defaultLength != 0) && (s!=defaultLength) )
00114 {
00115 return;
00116
00117
00118 }
00119 this->m_MeasurementVectorSize = s;
00120 }
00121 itkGetConstMacro( MeasurementVectorSize, MeasurementVectorSizeType );
00122
00123
00124 protected:
00125 Sample()
00126 {
00127 m_MeasurementVectorSize = 0;
00128 }
00129
00130 virtual ~Sample() {}
00131 void PrintSelf(std::ostream& os, Indent indent) const
00132 {
00133 Superclass::PrintSelf(os,indent);
00134 os << indent << "Length of measurement vectors in the sample: " <<
00135 m_MeasurementVectorSize << std::endl;
00136 }
00137
00138
00139
00140 private:
00141 Sample(const Self&) ;
00142 void operator=(const Self&) ;
00143
00144 MeasurementVectorSizeType m_MeasurementVectorSize;
00145 } ;
00146
00147 }
00148 }
00149
00150 #endif