Main Page   Groups   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Concepts

itkSample.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Insight Segmentation & Registration Toolkit
00004   Module:    $RCSfile: itkSample.h,v $
00005   Language:  C++
00006   Date:      $Date: 2005/07/26 15:55:04 $
00007   Version:   $Revision: 1.24 $
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 __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; // Do not do anything.
00116       //itkExceptionMacro( << "Cannot instantiate a sample with a fixed length "
00117       // << "container and resize it later. Create it with itk::Array if you like.");
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&) ; //purposely not implemented
00142   void operator=(const Self&) ; //purposely not implemented
00143 
00144   MeasurementVectorSizeType m_MeasurementVectorSize;
00145 } ; // end of class
00146 
00147 } // end of namespace Statistics 
00148 } // end of namespace itk
00149 
00150 #endif

Generated at Tue Aug 30 16:46:06 2005 for ITK by doxygen 1.4.1 written by Dimitri van Heesch, © 1997-2000