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::FrequencyType FrequencyType ;
00114 typedef typename Superclass::MeasurementType MeasurementType ;
00115 typedef typename Superclass::InstanceIdentifier InstanceIdentifier ;
00116 typedef MeasurementVectorType ValueType ;
00117
00119 itkStaticConstMacro(ImageDimension, unsigned int,
00120 TImage::ImageDimension);
00121
00122
00123 protected:
00124 ImageToCooccurrenceListAdaptor();
00125 virtual ~ImageToCooccurrenceListAdaptor() {}
00126 void PrintSelf(std::ostream& os, Indent indent) const;
00127
00128 private:
00129 ImageToCooccurrenceListAdaptor(const Self&) ;
00130 void operator=(const Self&) ;
00131 OffsetTable m_OffsetTable;
00132 typename SampleType::Pointer sample;
00133 } ;
00134
00135 }
00136 }
00137
00138 #ifndef ITK_MANUAL_INSTANTIATION
00139 #include "itkImageToCooccurrenceListAdaptor.txx"
00140 #endif
00141
00142 #endif