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
00067 typedef ImageToCooccurrenceListAdaptor Self;
00068 typedef ImageToListAdaptor< TImage, MeasurementVectorType > Superclass;
00069 typedef SmartPointer< Self > Pointer;
00070 typedef SmartPointer<const Self> ConstPointer;
00071
00073 typedef itk::ShapedNeighborhoodIterator<
00074 TImage ,
00075 ConstantBoundaryCondition<TImage>
00076 > ShapedNeighborhoodIteratorType;
00077
00079 typedef typename ShapedNeighborhoodIteratorType::OffsetType OffsetType;
00080 typedef std::vector<OffsetType> OffsetTable;
00081
00082 void UseNeighbor(const OffsetType & offset);
00083
00085 void Compute();
00086
00088 itkTypeMacro(ImageToCooccurrenceListAdaptor, ListSampleBase);
00089
00091 itkNewMacro(Self);
00092
00094 itkStaticConstMacro(MeasurementVectorSize, unsigned int, 2);
00095
00098 typedef typename Superclass::FrequencyType FrequencyType ;
00099 typedef typename Superclass::MeasurementType MeasurementType ;
00100 typedef typename Superclass::InstanceIdentifier InstanceIdentifier ;
00101 typedef MeasurementVectorType ValueType ;
00102
00104 itkStaticConstMacro(ImageDimension, unsigned int,
00105 TImage::ImageDimension);
00106
00107
00108 protected:
00109 ImageToCooccurrenceListAdaptor();
00110 virtual ~ImageToCooccurrenceListAdaptor() {}
00111 void PrintSelf(std::ostream& os, Indent indent) const;
00112
00113 private:
00114 ImageToCooccurrenceListAdaptor(const Self&) ;
00115 void operator=(const Self&) ;
00116 OffsetTable m_OffsetTable;
00117 typename SampleType::Pointer sample;
00118 } ;
00119
00120 }
00121 }
00122
00123 #ifndef ITK_MANUAL_INSTANTIATION
00124 #include "itkImageToCooccurrenceListAdaptor.txx"
00125 #endif
00126
00127 #endif