itkSample.h
Go to the documentation of this file.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 #include "itkNumericTraits.h"
00029
00030 namespace itk{
00031 namespace Statistics{
00032
00062 template < class TMeasurementVector >
00063 class ITK_EXPORT Sample : public Object
00064 {
00065 public:
00067 typedef Sample Self;
00068 typedef Object Superclass ;
00069 typedef SmartPointer< Self > Pointer ;
00070 typedef SmartPointer<const Self> ConstPointer;
00071
00073 itkTypeMacro(Sample, Object);
00074
00076 typedef TMeasurementVector MeasurementVectorType ;
00077
00080 typedef typename MeasurementVectorType::ValueType MeasurementType;
00081
00083 typedef float FrequencyType ;
00084
00086 typedef NumericTraits<FrequencyType>::AccumulateType TotalFrequencyType ;
00087
00090 typedef unsigned long InstanceIdentifier ;
00091
00093 typedef unsigned int MeasurementVectorSizeType;
00094
00096 virtual unsigned int Size() const = 0 ;
00097
00100 virtual const MeasurementVectorType &
00101 GetMeasurementVector(const InstanceIdentifier &id) const = 0 ;
00102
00105 virtual FrequencyType GetFrequency(const InstanceIdentifier &id) const = 0 ;
00106
00108 virtual TotalFrequencyType GetTotalFrequency() const
00109 = 0 ;
00110
00111
00113 virtual void SetMeasurementVectorSize( const MeasurementVectorSizeType s )
00114 {
00115 MeasurementVectorType m;
00116 MeasurementVectorSizeType defaultLength = MeasurementVectorTraits::GetLength( m );
00117 if( (defaultLength != 0) && (s!=defaultLength) )
00118 {
00119 return;
00120
00121
00122 }
00123 this->m_MeasurementVectorSize = s;
00124 }
00125 itkGetConstMacro( MeasurementVectorSize, MeasurementVectorSizeType );
00127
00128
00129 protected:
00130 Sample()
00131 {
00132 m_MeasurementVectorSize = MeasurementVectorTraits::GetLength(
00133 MeasurementVectorType() );
00134 }
00135
00136 virtual ~Sample() {}
00137 void PrintSelf(std::ostream& os, Indent indent) const
00138 {
00139 Superclass::PrintSelf(os,indent);
00140 os << indent << "Length of measurement vectors in the sample: " <<
00141 m_MeasurementVectorSize << std::endl;
00142 }
00143
00144
00145
00146 private:
00147 Sample(const Self&) ;
00148 void operator=(const Self&) ;
00149
00150 MeasurementVectorSizeType m_MeasurementVectorSize;
00151 } ;
00152
00153 }
00154 }
00155
00156 #endif
00157