00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef __itkScalarImageToCooccurrenceMatrixFilter_h
00018 #define __itkScalarImageToCooccurrenceMatrixFilter_h
00019
00020 #include "itkImage.h"
00021 #include "itkHistogram.h"
00022 #include "itkDenseFrequencyContainer2.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
00092 template< class TImageType,
00093 class THistogramFrequencyContainer = DenseFrequencyContainer2 >
00094 class ITK_EXPORT ScalarImageToCooccurrenceMatrixFilter : public ProcessObject
00095 {
00096 public:
00098 typedef ScalarImageToCooccurrenceMatrixFilter Self;
00099 typedef ProcessObject Superclass;
00100 typedef SmartPointer<Self> Pointer;
00101 typedef SmartPointer<const Self> ConstPointer;
00102
00104 itkTypeMacro(ScalarImageToCooccurrenceMatrixFilter, ProcessObject);
00105
00107 itkNewMacro(Self);
00108
00109 typedef TImageType ImageType;
00110 typedef typename ImageType::Pointer ImagePointer;
00111 typedef typename ImageType::ConstPointer ImageConstPointer;
00112 typedef typename ImageType::PixelType PixelType;
00113 typedef typename ImageType::RegionType RegionType;
00114 typedef typename ImageType::SizeType RadiusType;
00115 typedef typename ImageType::OffsetType OffsetType;
00116 typedef VectorContainer<unsigned char, OffsetType> OffsetVector;
00117 typedef typename OffsetVector::Pointer OffsetVectorPointer;
00118 typedef typename OffsetVector::ConstPointer OffsetVectorConstPointer;
00119
00120 typedef typename NumericTraits<PixelType>::RealType MeasurementType;
00121
00122 typedef Histogram< MeasurementType, THistogramFrequencyContainer >
00123 HistogramType;
00124 typedef typename HistogramType::Pointer HistogramPointer;
00125 typedef typename HistogramType::ConstPointer HistogramConstPointer;
00126 typedef typename HistogramType::MeasurementVectorType MeasurementVectorType;
00127
00128
00129 itkStaticConstMacro(DefaultBinsPerAxis, unsigned int, 256);
00130
00133 itkSetConstObjectMacro( Offsets, OffsetVector );
00134 itkGetConstObjectMacro( Offsets, OffsetVector );
00135 void SetOffset( const OffsetType offset );
00137
00139 itkSetMacro( NumberOfBinsPerAxis, unsigned int );
00140 itkGetConstMacro( NumberOfBinsPerAxis, unsigned int );
00142
00144 void SetPixelValueMinMax( PixelType min, PixelType max );
00145 itkGetConstMacro(Min, PixelType);
00146 itkGetConstMacro(Max, PixelType);
00148
00151 itkSetMacro(Normalize, bool);
00152 itkGetConstMacro(Normalize, bool);
00153 itkBooleanMacro(Normalize);
00155
00157 void SetInput( const ImageType* image );
00158 const ImageType* GetInput() const;
00160
00162 void SetMaskImage( const ImageType* image );
00163 const ImageType* GetMaskImage() const;
00165
00167 const HistogramType * GetOutput() const;
00168
00171 itkSetMacro( InsidePixelValue, PixelType );
00172 itkGetConstMacro( InsidePixelValue, PixelType );
00174
00175
00176 protected:
00177 ScalarImageToCooccurrenceMatrixFilter();
00178 virtual ~ScalarImageToCooccurrenceMatrixFilter() {};
00179 void PrintSelf(std::ostream& os, Indent indent) const;
00180 virtual void FillHistogram( RadiusType radius, RegionType region );
00181 virtual void FillHistogramWithMask( RadiusType radius, RegionType region, const ImageType * maskImage );
00182
00183
00185 typedef DataObject::Pointer DataObjectPointer;
00186 virtual DataObjectPointer MakeOutput(unsigned int idx);
00187
00189 virtual void GenerateData();
00190
00191 private:
00192 ScalarImageToCooccurrenceMatrixFilter(const Self&);
00193 void operator=(const Self&);
00194
00195 void NormalizeHistogram( void );
00196
00197 OffsetVectorConstPointer m_Offsets;
00198 PixelType m_Min;
00199 PixelType m_Max;
00200
00201 unsigned int m_NumberOfBinsPerAxis;
00202 MeasurementVectorType m_LowerBound;
00203 MeasurementVectorType m_UpperBound;
00204 bool m_Normalize;
00205
00206 PixelType m_InsidePixelValue;
00207
00208 };
00209
00210
00211 }
00212 }
00213
00214 #ifndef ITK_MANUAL_INSTANTIATION
00215 #include "itkScalarImageToCooccurrenceMatrixFilter.txx"
00216 #endif
00217
00218 #endif
00219