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