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