00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef __itkScalarImageToGreyLevelCooccurrenceMatrixGenerator_h
00018 #define __itkScalarImageToGreyLevelCooccurrenceMatrixGenerator_h
00019
00020 #include "itkImage.h"
00021 #include "itkHistogram.h"
00022 #include "itkDenseFrequencyContainer.h"
00023 #include "itkVectorContainer.h"
00024 #include "itkObject.h"
00025 #include "itkNumericTraits.h"
00026 #include "itkMacro.h"
00027
00028 namespace itk {
00029 namespace Statistics {
00030
00090 template< class TImageType, class THistogramFrequencyContainer =
00091 DenseFrequencyContainer< float > >
00092 class ScalarImageToGreyLevelCooccurrenceMatrixGenerator : public Object
00093 {
00094 public:
00096 typedef ScalarImageToGreyLevelCooccurrenceMatrixGenerator Self;
00097 typedef Object Superclass;
00098 typedef SmartPointer<Self> Pointer;
00099 typedef SmartPointer<const Self> ConstPointer;
00100
00102 itkTypeMacro(ScalarImageToGreyLevelCooccurrenceMatrixGenerator, Object);
00103
00105 itkNewMacro(Self) ;
00106
00107 typedef TImageType ImageType;
00108 typedef typename ImageType::Pointer ImagePointer;
00109 typedef typename ImageType::ConstPointer ImageConstPointer;
00110 typedef typename ImageType::PixelType PixelType;
00111 typedef typename ImageType::RegionType RegionType;
00112 typedef typename ImageType::SizeType RadiusType;
00113 typedef typename ImageType::OffsetType OffsetType;
00114 typedef VectorContainer<unsigned char, OffsetType> OffsetVector;
00115 typedef typename OffsetVector::Pointer OffsetVectorPointer;
00116 typedef typename OffsetVector::ConstPointer OffsetVectorConstPointer;
00117
00118 typedef typename NumericTraits<PixelType>::RealType MeasurementType;
00119
00120 typedef Histogram< MeasurementType, 2, THistogramFrequencyContainer >
00121 HistogramType;
00122 typedef typename HistogramType::Pointer HistogramPointer;
00123 typedef typename HistogramType::ConstPointer HistogramConstPointer;
00124 typedef typename HistogramType::MeasurementVectorType MeasurementVectorType;
00125
00126
00127 itkStaticConstMacro(DefaultBinsPerAxis, unsigned int, 256);
00128
00130 void Compute( void );
00131
00133 void SetInput( const ImagePointer );
00134
00137 void SetOffset( const OffsetType );
00138 void SetOffsets( const OffsetVectorPointer );
00139
00143 HistogramPointer GetOutput( void ) const;
00144
00146 void SetNumberOfBinsPerAxis( unsigned int numberOfBins );
00147
00149 void SetPixelValueMinMax( PixelType min, PixelType max );
00150
00153 itkSetMacro(Normalize, bool);
00154 itkGetMacro(Normalize, bool);
00155 itkBooleanMacro(Normalize);
00156
00157 protected:
00158 ScalarImageToGreyLevelCooccurrenceMatrixGenerator();
00159 virtual ~ScalarImageToGreyLevelCooccurrenceMatrixGenerator() {};
00160 void PrintSelf(std::ostream& os, Indent indent) const;
00161 virtual void FillHistogram( RadiusType radius, RegionType region );
00162
00163 itkGetMacro(Image,ImagePointer);
00164 itkGetMacro(Histogram,HistogramPointer);
00165 itkGetMacro(Offsets,OffsetVectorPointer);
00166 itkGetMacro(Min,PixelType);
00167 itkGetMacro(Max,PixelType);
00168
00169 private:
00170 void NormalizeHistogram( void );
00171
00172 ImagePointer m_Image;
00173 HistogramPointer m_Histogram;
00174 OffsetVectorPointer m_Offsets;
00175 PixelType m_Min, m_Max;
00176
00177 unsigned int m_BinsPerAxis;
00178 MeasurementVectorType m_LowerBound, m_UpperBound;
00179 bool m_Normalize;
00180
00181 };
00182
00183
00184 }
00185 }
00186
00187 #ifndef ITK_MANUAL_INSTANTIATION
00188 #include "itkScalarImageToGreyLevelCooccurrenceMatrixGenerator.txx"
00189 #endif
00190
00191 #endif