00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef __itkImageToCooccurrenceListAdaptor_h
00019 #define __itkImageToCooccurrenceListAdaptor_h
00020
00021 #include <typeinfo>
00022
00023 #include "itkImage.h"
00024 #include "itkPixelTraits.h"
00025 #include "itkImageToListAdaptor.h"
00026 #include "itkSmartPointer.h"
00027 #include "itkImageRegionIterator.h"
00028 #include "itkShapedNeighborhoodIterator.h"
00029 #include "itkNeighborhoodIterator.h"
00030 #include "itkNeighborhoodAlgorithm.h"
00031 #include "itkConstantBoundaryCondition.h"
00032 #include "itkListSample.h"
00033 #include "itkFixedArray.h"
00034 #include "itkMacro.h"
00035
00036 #include <vector>
00037 #include <algorithm>
00038 #include <iostream>
00039
00040 namespace itk{
00041 namespace Statistics{
00042
00053 template < class TImage >
00054 class ITK_EXPORT ImageToCooccurrenceListAdaptor
00055 : public ImageToListAdaptor<
00056 TImage,
00057 FixedArray< typename TImage::PixelType, 2 > >
00058 {
00059 public:
00060 typedef TImage ImageType;
00061
00062 typedef FixedArray< typename TImage::PixelType, 2 > MeasurementVectorType ;
00063
00064 typedef itk::Statistics::ListSample< MeasurementVectorType > SampleType ;
00065 typedef typename SampleType::MeasurementVectorSizeType MeasurementVectorSizeType;
00066
00068 typedef ImageToCooccurrenceListAdaptor Self;
00069 typedef ImageToListAdaptor< TImage, MeasurementVectorType > Superclass;
00070 typedef SmartPointer< Self > Pointer;
00071 typedef SmartPointer<const Self> ConstPointer;
00072
00074 typedef itk::ShapedNeighborhoodIterator<
00075 TImage ,
00076 ConstantBoundaryCondition<TImage>
00077 > ShapedNeighborhoodIteratorType;
00078
00080 typedef typename ShapedNeighborhoodIteratorType::OffsetType OffsetType;
00081 typedef std::vector<OffsetType> OffsetTable;
00082
00083 void UseNeighbor(const OffsetType & offset);
00084
00086 void Compute();
00087
00089 itkTypeMacro(ImageToCooccurrenceListAdaptor, ListSampleBase);
00090
00092 itkNewMacro(Self);
00093
00095 itkStaticConstMacro(MeasurementVectorSize, unsigned int, 2);
00096
00097 virtual void SetMeasurementVectorSize( const MeasurementVectorSizeType )
00098 {
00099
00100
00101 itkWarningMacro( << "This method does nothing! The MeasurementVectorSize is "
00102 << MeasurementVectorSize );
00103 }
00104
00105 unsigned int GetMeasurementVectorSize() const
00106 {
00107 return Superclass::MeasurementVectorSize;
00108 }
00109
00110
00113 typedef typename Superclass::PixelType PixelType ;
00114 typedef typename Superclass::FrequencyType FrequencyType ;
00115 typedef typename Superclass::MeasurementType MeasurementType ;
00116 typedef typename Superclass::InstanceIdentifier InstanceIdentifier ;
00117 typedef MeasurementVectorType ValueType ;
00118
00120 itkStaticConstMacro(ImageDimension, unsigned int,
00121 TImage::ImageDimension);
00122
00123
00124 protected:
00125 ImageToCooccurrenceListAdaptor();
00126 virtual ~ImageToCooccurrenceListAdaptor() {}
00127 void PrintSelf(std::ostream& os, Indent indent) const;
00128
00129 private:
00130 ImageToCooccurrenceListAdaptor(const Self&) ;
00131 void operator=(const Self&) ;
00132 OffsetTable m_OffsetTable;
00133 typename SampleType::Pointer sample;
00134 } ;
00135
00136 }
00137 }
00138
00139 #ifndef ITK_MANUAL_INSTANTIATION
00140 #include "itkImageToCooccurrenceListAdaptor.txx"
00141 #endif
00142
00143 #endif
00144