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,
00091 class THistogramFrequencyContainer = DenseFrequencyContainer >
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 itkSetConstObjectMacro( Input, ImageType );
00134 itkGetConstObjectMacro( Input, ImageType );
00135
00138 itkSetConstObjectMacro( Offsets, OffsetVector );
00139 itkGetConstObjectMacro( Offsets, OffsetVector );
00140 void SetOffset( const OffsetType offset )
00141 {
00142 OffsetVectorPointer offsetVector = OffsetVector::New();
00143 offsetVector->push_back(offset);
00144 this->SetOffsets(offsetVector);
00145 }
00146
00150 itkGetObjectMacro( Output, HistogramType );
00151
00153 itkSetMacro( NumberOfBinsPerAxis, unsigned int );
00154 itkGetMacro( NumberOfBinsPerAxis, unsigned int );
00155
00157 void SetPixelValueMinMax( PixelType min, PixelType max );
00158 itkGetMacro(Min, PixelType);
00159 itkGetMacro(Max, PixelType);
00160
00163 itkSetMacro(Normalize, bool);
00164 itkGetMacro(Normalize, bool);
00165 itkBooleanMacro(Normalize);
00166
00167 protected:
00168 ScalarImageToGreyLevelCooccurrenceMatrixGenerator();
00169 virtual ~ScalarImageToGreyLevelCooccurrenceMatrixGenerator() {};
00170 void PrintSelf(std::ostream& os, Indent indent) const;
00171 virtual void FillHistogram( RadiusType radius, RegionType region );
00172
00173 private:
00174 void NormalizeHistogram( void );
00175
00176 ImageConstPointer m_Input;
00177 HistogramPointer m_Output;
00178 OffsetVectorConstPointer m_Offsets;
00179 PixelType m_Min, m_Max;
00180
00181 unsigned int m_NumberOfBinsPerAxis;
00182 MeasurementVectorType m_LowerBound, m_UpperBound;
00183 bool m_Normalize;
00184
00185 };
00186
00187
00188 }
00189 }
00190
00191 #ifndef ITK_MANUAL_INSTANTIATION
00192 #include "itkScalarImageToGreyLevelCooccurrenceMatrixGenerator.txx"
00193 #endif
00194
00195 #endif