ITK  6.0.0
Insight Toolkit
itkScalarImageToRunLengthMatrixFilter.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  * https://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 itkScalarImageToRunLengthMatrixFilter_h
19 #define itkScalarImageToRunLengthMatrixFilter_h
20 
21 #include "itkImage.h"
22 #include "itkHistogram.h"
23 #include "itkNumericTraits.h"
24 #include "itkVectorContainer.h"
25 #include "itkProcessObject.h"
26 
27 namespace itk
28 {
29 namespace Statistics
30 {
31 
105 template <typename TImageType, typename THistogramFrequencyContainer = DenseFrequencyContainer2>
106 class ITK_TEMPLATE_EXPORT ScalarImageToRunLengthMatrixFilter : public ProcessObject
107 {
108 public:
114 
116  itkOverrideGetNameOfClassMacro(ScalarImageToRunLengthMatrixFilter);
117 
119  itkNewMacro(Self);
120 
121  using ImageType = TImageType;
124  using PixelType = typename ImageType::PixelType;
125  using IndexType = typename ImageType::IndexType;
127  using RadiusType = typename ImageType::SizeType;
128  using OffsetType = typename ImageType::OffsetType;
131  using PointType = typename ImageType::PointType;
132 
135 
140 
142  static constexpr unsigned int ImageDimension = TImageType::ImageDimension;
143 
145  static constexpr unsigned int DefaultBinsPerAxis = 256;
146 
156  itkSetObjectMacro(Offsets, OffsetVector);
157 
167  void
168  SetOffset(const OffsetType offset);
169 
173  itkGetModifiableObjectMacro(Offsets, OffsetVector);
174 
176  itkSetMacro(NumberOfBinsPerAxis, unsigned int);
177 
179  itkGetConstMacro(NumberOfBinsPerAxis, unsigned int);
180 
185  void
186  SetPixelValueMinMax(PixelType min, PixelType max);
187 
189  itkGetConstMacro(Min, PixelType);
190 
192  itkGetConstMacro(Max, PixelType);
193 
198  void
199  SetDistanceValueMinMax(RealType min, RealType max);
200 
204  itkGetConstMacro(MinDistance, RealType);
205 
209  itkGetConstMacro(MaxDistance, RealType);
210 
212  using Superclass::SetInput;
213  void
214  SetInput(const ImageType * image);
215 
217  const ImageType *
218  GetInput() const;
219 
221  void
222  SetMaskImage(const ImageType * image);
223 
225  const ImageType *
226  GetMaskImage() const;
227 
229  const HistogramType *
230  GetOutput() const;
231 
236  itkSetMacro(InsidePixelValue, PixelType);
237  itkGetConstMacro(InsidePixelValue, PixelType);
240 protected:
242  ~ScalarImageToRunLengthMatrixFilter() override = default;
243  void
244  PrintSelf(std::ostream & os, Indent indent) const override;
245 
248 
250  using Superclass::MakeOutput;
252  MakeOutput(DataObjectPointerArraySizeType idx) override;
253 
255  void
256  GenerateData() override;
257 
265  void
266  NormalizeOffsetDirection(OffsetType & offset);
267 
268 private:
269  unsigned int m_NumberOfBinsPerAxis{};
270  PixelType m_Min{};
271  PixelType m_Max{};
272  RealType m_MinDistance{};
273  RealType m_MaxDistance{};
274  PixelType m_InsidePixelValue{};
275 
276  MeasurementVectorType m_LowerBound{};
277  MeasurementVectorType m_UpperBound{};
278  OffsetVectorPointer m_Offsets{};
279 };
280 } // end of namespace Statistics
281 } // end of namespace itk
282 
283 #ifndef ITK_MANUAL_INSTANTIATION
284 # include "itkScalarImageToRunLengthMatrixFilter.hxx"
285 #endif
286 
287 #endif
Pointer
SmartPointer< Self > Pointer
Definition: itkAddImageFilter.h:93
itk::Statistics::ScalarImageToRunLengthMatrixFilter
This class computes a run length matrix (histogram) from a given image and a mask image if provided....
Definition: itkScalarImageToRunLengthMatrixFilter.h:106
ConstPointer
SmartPointer< const Self > ConstPointer
Definition: itkAddImageFilter.h:94
itk::Statistics::ScalarImageToRunLengthMatrixFilter::RealType
typename NumericTraits< PixelType >::RealType RealType
Definition: itkScalarImageToRunLengthMatrixFilter.h:134
itk::detail::VectorContainer
Define a front-end to the STL "vector" container that conforms to the IndexedContainerInterface.
Definition: itkVectorContainer.h:51
itk::GTest::TypedefsAndConstructors::Dimension2::PointType
ImageBaseType::PointType PointType
Definition: itkGTestTypedefsAndConstructors.h:51
itk::GTest::TypedefsAndConstructors::Dimension2::SizeType
ImageBaseType::SizeType SizeType
Definition: itkGTestTypedefsAndConstructors.h:49
itkImage.h
itk::Statistics::ScalarImageToRunLengthMatrixFilter::OffsetVectorPointer
typename OffsetVector::Pointer OffsetVectorPointer
Definition: itkScalarImageToRunLengthMatrixFilter.h:130
itk::SmartPointer< Self >
itk::Indent
Control indentation during Print() invocation.
Definition: itkIndent.h:49
itk::ProcessObject::DataObjectPointerArraySizeType
DataObjectPointerArray::size_type DataObjectPointerArraySizeType
Definition: itkProcessObject.h:194
itk::Statistics::ScalarImageToRunLengthMatrixFilter::PixelType
typename ImageType::PixelType PixelType
Definition: itkScalarImageToRunLengthMatrixFilter.h:124
itk::Statistics::ScalarImageToRunLengthMatrixFilter::IndexType
typename ImageType::IndexType IndexType
Definition: itkScalarImageToRunLengthMatrixFilter.h:125
itk::Statistics::ScalarImageToRunLengthMatrixFilter::PointType
typename ImageType::PointType PointType
Definition: itkScalarImageToRunLengthMatrixFilter.h:131
itk::GTest::TypedefsAndConstructors::Dimension2::IndexType
ImageBaseType::IndexType IndexType
Definition: itkGTestTypedefsAndConstructors.h:50
itk::Statistics::ScalarImageToRunLengthMatrixFilter::MeasurementVectorType
typename HistogramType::MeasurementVectorType MeasurementVectorType
Definition: itkScalarImageToRunLengthMatrixFilter.h:139
itk::Statistics::Histogram
This class stores measurement vectors in the context of n-dimensional histogram.
Definition: itkHistogram.h:77
itk::Statistics::ScalarImageToRunLengthMatrixFilter::ImageType
TImageType ImageType
Definition: itkScalarImageToRunLengthMatrixFilter.h:121
itk::LightObject
Light weight base class for most itk classes.
Definition: itkLightObject.h:55
itkHistogram.h
itkProcessObject.h
itk::GTest::TypedefsAndConstructors::Dimension2::RegionType
ImageBaseType::RegionType RegionType
Definition: itkGTestTypedefsAndConstructors.h:54
itk::Statistics::ScalarImageToRunLengthMatrixFilter::ImagePointer
typename ImageType::Pointer ImagePointer
Definition: itkScalarImageToRunLengthMatrixFilter.h:122
itk::Statistics::ScalarImageToRunLengthMatrixFilter::HistogramPointer
typename HistogramType::Pointer HistogramPointer
Definition: itkScalarImageToRunLengthMatrixFilter.h:137
itk::Statistics::ScalarImageToRunLengthMatrixFilter::HistogramConstPointer
typename HistogramType::ConstPointer HistogramConstPointer
Definition: itkScalarImageToRunLengthMatrixFilter.h:138
itk::NumericTraits
Define additional traits for native types such as int or float.
Definition: itkNumericTraits.h:60
itkVectorContainer.h
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnatomicalOrientation.h:29
itk::ProcessObject
The base class for all process objects (source, filters, mappers) in the Insight data processing pipe...
Definition: itkProcessObject.h:139
itk::ProcessObject
class ITK_FORWARD_EXPORT ProcessObject
Definition: itkDataObject.h:41
itk::Array
Array class with size defined at construction time.
Definition: itkArray.h:47
itkNumericTraits.h
itk::Statistics::ScalarImageToRunLengthMatrixFilter::RegionType
typename ImageType::RegionType RegionType
Definition: itkScalarImageToRunLengthMatrixFilter.h:126
itk::Statistics::ScalarImageToRunLengthMatrixFilter::OffsetType
typename ImageType::OffsetType OffsetType
Definition: itkScalarImageToRunLengthMatrixFilter.h:128
itk::Statistics::ScalarImageToRunLengthMatrixFilter::MeasurementType
typename NumericTraits< PixelType >::RealType MeasurementType
Definition: itkScalarImageToRunLengthMatrixFilter.h:133
itk::DataObject::Pointer
SmartPointer< Self > Pointer
Definition: itkDataObject.h:301
itk::Statistics::ScalarImageToRunLengthMatrixFilter::ImageConstPointer
typename ImageType::ConstPointer ImageConstPointer
Definition: itkScalarImageToRunLengthMatrixFilter.h:123
itk::Statistics::ScalarImageToRunLengthMatrixFilter::RadiusType
typename ImageType::SizeType RadiusType
Definition: itkScalarImageToRunLengthMatrixFilter.h:127