ITK  5.2.0
Insight Toolkit
itkScalarImageToCooccurrenceMatrixFilter.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright NumFOCUS
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0.txt
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  *=========================================================================*/
18 #ifndef itkScalarImageToCooccurrenceMatrixFilter_h
19 #define itkScalarImageToCooccurrenceMatrixFilter_h
20 
21 #include "itkImage.h"
22 #include "itkHistogram.h"
23 #include "itkVectorContainer.h"
24 #include "itkNumericTraits.h"
25 #include "itkProcessObject.h"
26 
27 namespace itk
28 {
29 namespace Statistics
30 {
93 template <typename TImageType, typename THistogramFrequencyContainer = DenseFrequencyContainer2>
94 class ITK_TEMPLATE_EXPORT ScalarImageToCooccurrenceMatrixFilter : public ProcessObject
95 {
96 public:
97  ITK_DISALLOW_COPY_AND_MOVE(ScalarImageToCooccurrenceMatrixFilter);
98 
104 
107 
109  itkNewMacro(Self);
110 
111  using ImageType = TImageType;
112  using ImagePointer = typename ImageType::Pointer;
113  using ImageConstPointer = typename ImageType::ConstPointer;
114  using PixelType = typename ImageType::PixelType;
116  using RadiusType = typename ImageType::SizeType;
117  using OffsetType = typename ImageType::OffsetType;
121 
123 
128 
129  static constexpr unsigned int DefaultBinsPerAxis = 256;
130 
133  itkSetConstObjectMacro(Offsets, OffsetVector);
134  itkGetConstObjectMacro(Offsets, OffsetVector);
136 
137  void
138  SetOffset(const OffsetType offset);
139 
141  itkSetMacro(NumberOfBinsPerAxis, unsigned int);
142  itkGetConstMacro(NumberOfBinsPerAxis, unsigned int);
144 
147  void
148  SetPixelValueMinMax(PixelType min, PixelType max);
149 
150  itkGetConstMacro(Min, PixelType);
151  itkGetConstMacro(Max, PixelType);
152 
155  itkSetMacro(Normalize, bool);
156  itkGetConstMacro(Normalize, bool);
157  itkBooleanMacro(Normalize);
159 
161  using Superclass::SetInput;
162  void
163  SetInput(const ImageType * image);
164 
165  const ImageType *
166  GetInput() const;
167 
169  void
170  SetMaskImage(const ImageType * image);
171 
172  const ImageType *
173  GetMaskImage() const;
174 
176  const HistogramType *
177  GetOutput() const;
178 
181  itkSetMacro(InsidePixelValue, PixelType);
182  itkGetConstMacro(InsidePixelValue, PixelType);
184 
185 protected:
187  ~ScalarImageToCooccurrenceMatrixFilter() override = default;
188  void
189  PrintSelf(std::ostream & os, Indent indent) const override;
190 
191  virtual void
192  FillHistogram(RadiusType radius, RegionType region);
193 
194  virtual void
195  FillHistogramWithMask(RadiusType radius, RegionType region, const ImageType * maskImage);
196 
199 
201  using Superclass::MakeOutput;
203  MakeOutput(DataObjectPointerArraySizeType idx) override;
204 
206  void
207  GenerateData() override;
208 
209 private:
210  void
211  NormalizeHistogram();
212 
216 
217  unsigned int m_NumberOfBinsPerAxis;
221 
223 };
224 } // end of namespace Statistics
225 } // end of namespace itk
226 
227 #ifndef ITK_MANUAL_INSTANTIATION
228 # include "itkScalarImageToCooccurrenceMatrixFilter.hxx"
229 #endif
230 
231 #endif
itk::Statistics::ScalarImageToCooccurrenceMatrixFilter::RadiusType
typename ImageType::SizeType RadiusType
Definition: itkScalarImageToCooccurrenceMatrixFilter.h:116
itk::Statistics::ScalarImageToCooccurrenceMatrixFilter::ImagePointer
typename ImageType::Pointer ImagePointer
Definition: itkScalarImageToCooccurrenceMatrixFilter.h:112
itk::Statistics::ScalarImageToCooccurrenceMatrixFilter::MeasurementType
typename NumericTraits< PixelType >::RealType MeasurementType
Definition: itkScalarImageToCooccurrenceMatrixFilter.h:122
itk::Statistics::ScalarImageToCooccurrenceMatrixFilter::m_Normalize
bool m_Normalize
Definition: itkScalarImageToCooccurrenceMatrixFilter.h:220
itk::GTest::TypedefsAndConstructors::Dimension2::SizeType
ImageBaseType::SizeType SizeType
Definition: itkGTestTypedefsAndConstructors.h:49
itk::Statistics::ScalarImageToCooccurrenceMatrixFilter::m_Min
PixelType m_Min
Definition: itkScalarImageToCooccurrenceMatrixFilter.h:214
itkImage.h
itk::SmartPointer< Self >
itk::Indent
Control indentation during Print() invocation.
Definition: itkIndent.h:49
itk::ProcessObject::DataObjectPointerArraySizeType
DataObjectPointerArray::size_type DataObjectPointerArraySizeType
Definition: itkProcessObject.h:193
itk::Statistics::ScalarImageToCooccurrenceMatrixFilter::MeasurementVectorType
typename HistogramType::MeasurementVectorType MeasurementVectorType
Definition: itkScalarImageToCooccurrenceMatrixFilter.h:127
itk::Statistics::ScalarImageToCooccurrenceMatrixFilter::HistogramPointer
typename HistogramType::Pointer HistogramPointer
Definition: itkScalarImageToCooccurrenceMatrixFilter.h:125
itk::Statistics::ScalarImageToCooccurrenceMatrixFilter
This class computes a co-occurrence matrix (histogram) from a given image and a mask image if provide...
Definition: itkScalarImageToCooccurrenceMatrixFilter.h:94
itk::Statistics::ScalarImageToCooccurrenceMatrixFilter::m_Max
PixelType m_Max
Definition: itkScalarImageToCooccurrenceMatrixFilter.h:215
itk::Statistics::Histogram::MeasurementVectorType
typename Superclass::MeasurementVectorType MeasurementVectorType
Definition: itkHistogram.h:101
itk::Statistics::ScalarImageToCooccurrenceMatrixFilter::m_InsidePixelValue
PixelType m_InsidePixelValue
Definition: itkScalarImageToCooccurrenceMatrixFilter.h:222
itk::Statistics::Histogram
This class stores measurement vectors in the context of n-dimensional histogram.
Definition: itkHistogram.h:77
itk::Statistics::ScalarImageToCooccurrenceMatrixFilter::OffsetType
typename ImageType::OffsetType OffsetType
Definition: itkScalarImageToCooccurrenceMatrixFilter.h:117
itk::LightObject
Light weight base class for most itk classes.
Definition: itkLightObject.h:59
itk::Statistics::ScalarImageToCooccurrenceMatrixFilter::m_LowerBound
MeasurementVectorType m_LowerBound
Definition: itkScalarImageToCooccurrenceMatrixFilter.h:218
itkHistogram.h
itk::Statistics::ScalarImageToCooccurrenceMatrixFilter::ImageConstPointer
typename ImageType::ConstPointer ImageConstPointer
Definition: itkScalarImageToCooccurrenceMatrixFilter.h:113
itkProcessObject.h
itk::GTest::TypedefsAndConstructors::Dimension2::RegionType
ImageBaseType::RegionType RegionType
Definition: itkGTestTypedefsAndConstructors.h:54
itk::Statistics::ScalarImageToCooccurrenceMatrixFilter::ImageType
TImageType ImageType
Definition: itkScalarImageToCooccurrenceMatrixFilter.h:111
itk::Statistics::ScalarImageToCooccurrenceMatrixFilter::m_NumberOfBinsPerAxis
unsigned int m_NumberOfBinsPerAxis
Definition: itkScalarImageToCooccurrenceMatrixFilter.h:217
itk::Statistics::ScalarImageToCooccurrenceMatrixFilter::m_Offsets
OffsetVectorConstPointer m_Offsets
Definition: itkScalarImageToCooccurrenceMatrixFilter.h:213
itk::NumericTraits
Define additional traits for native types such as int or float.
Definition: itkNumericTraits.h:58
itkVectorContainer.h
itk::Statistics::ScalarImageToCooccurrenceMatrixFilter::OffsetVectorPointer
typename OffsetVector::Pointer OffsetVectorPointer
Definition: itkScalarImageToCooccurrenceMatrixFilter.h:119
itk::Statistics::ScalarImageToCooccurrenceMatrixFilter::HistogramConstPointer
typename HistogramType::ConstPointer HistogramConstPointer
Definition: itkScalarImageToCooccurrenceMatrixFilter.h:126
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnnulusOperator.h:24
itk::Statistics::ScalarImageToCooccurrenceMatrixFilter::m_UpperBound
MeasurementVectorType m_UpperBound
Definition: itkScalarImageToCooccurrenceMatrixFilter.h:219
itk::Statistics::ScalarImageToCooccurrenceMatrixFilter::PixelType
typename ImageType::PixelType PixelType
Definition: itkScalarImageToCooccurrenceMatrixFilter.h:114
itk::ProcessObject
The base class for all process objects (source, filters, mappers) in the Insight data processing pipe...
Definition: itkProcessObject.h:138
itk::ProcessObject
class ITK_FORWARD_EXPORT ProcessObject
Definition: itkDataObject.h:41
itk::Statistics::ScalarImageToCooccurrenceMatrixFilter::RegionType
typename ImageType::RegionType RegionType
Definition: itkScalarImageToCooccurrenceMatrixFilter.h:115
itk::Statistics::ScalarImageToCooccurrenceMatrixFilter::OffsetVectorConstPointer
typename OffsetVector::ConstPointer OffsetVectorConstPointer
Definition: itkScalarImageToCooccurrenceMatrixFilter.h:120
itkNumericTraits.h
itk::DataObject::Pointer
SmartPointer< Self > Pointer
Definition: itkDataObject.h:301
itk::VectorContainer
Define a front-end to the STL "vector" container that conforms to the IndexedContainerInterface.
Definition: itkVectorContainer.h:48