00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef __itkScalarImageToListAdaptor_h
00018 #define __itkScalarImageToListAdaptor_h
00019
00020 #include <typeinfo>
00021
00022 #include "itkImage.h"
00023 #include "itkPixelTraits.h"
00024 #include "itkImageToListAdaptor.h"
00025 #include "itkSmartPointer.h"
00026 #include "itkImageRegionIterator.h"
00027 #include "itkFixedArray.h"
00028 #include "itkMacro.h"
00029
00030 namespace itk{
00031 namespace Statistics{
00032
00062 template < class TImage >
00063 class ITK_EXPORT ScalarImageToListAdaptor
00064 : public ImageToListAdaptor<
00065 TImage,
00066 FixedArray< typename TImage::PixelType, 1 > >
00067 {
00068 public:
00069 typedef FixedArray< typename TImage::PixelType, 1 > MeasurementVectorType ;
00070
00072 typedef ScalarImageToListAdaptor Self;
00073 typedef ImageToListAdaptor< TImage, MeasurementVectorType > Superclass;
00074 typedef SmartPointer< Self > Pointer;
00075 typedef SmartPointer<const Self> ConstPointer;
00076
00078 itkTypeMacro(ScalarImageToListAdaptor, ListSampleBase) ;
00079
00081 itkNewMacro(Self) ;
00082
00084 itkStaticConstMacro(MeasurementVectorSize, unsigned int, 1);
00085
00086
00089 typedef typename Superclass::FrequencyType FrequencyType ;
00090 typedef typename Superclass::MeasurementType MeasurementType ;
00091 typedef typename Superclass::InstanceIdentifier InstanceIdentifier ;
00092 typedef typename Superclass::MeasurementVectorSizeType MeasurementVectorSizeType;
00093 typedef MeasurementVectorType ValueType ;
00094
00095 virtual void SetMeasurementVectorSize( const MeasurementVectorSizeType s )
00096 {
00097
00098
00099 if( s!=1 )
00100 {
00101 itkExceptionMacro( << "Cannot set measurement vector size of "
00102 << " ScalarImageToListAdaptor to " << s );
00103 }
00104 }
00105
00107 MeasurementVectorSizeType GetMeasurementVectorSize() const
00108 {
00109 return MeasurementVectorSize;
00110 }
00111
00112 const MeasurementVectorType & GetMeasurementVector(const InstanceIdentifier &id) const;
00113
00114 protected:
00115 ScalarImageToListAdaptor()
00116 {
00117 Superclass::SetMeasurementVectorSize( MeasurementVectorSize);
00118 }
00119
00120 virtual ~ScalarImageToListAdaptor() {}
00121 void PrintSelf(std::ostream& os, Indent indent) const;
00122
00123 private:
00124 ScalarImageToListAdaptor(const Self&) ;
00125 void operator=(const Self&) ;
00126 mutable MeasurementVectorType m_TempVector ;
00127 } ;
00128
00129 }
00130 }
00131
00132 #ifndef ITK_MANUAL_INSTANTIATION
00133 #include "itkScalarImageToListAdaptor.txx"
00134 #endif
00135
00136 #endif
00137