ITK  5.2.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  * 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 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 
106 template <typename TImageType, typename THistogramFrequencyContainer = DenseFrequencyContainer2>
107 class ITK_TEMPLATE_EXPORT ScalarImageToRunLengthMatrixFilter : public ProcessObject
108 {
109 public:
115 
118 
120  itkNewMacro(Self);
121 
122  using ImageType = TImageType;
123  using ImagePointer = typename ImageType::Pointer;
124  using ImageConstPointer = typename ImageType::ConstPointer;
125  using PixelType = typename ImageType::PixelType;
126  using IndexType = typename ImageType::IndexType;
128  using RadiusType = typename ImageType::SizeType;
129  using OffsetType = typename ImageType::OffsetType;
132  using PointType = typename ImageType::PointType;
133 
136 
141 
143  static constexpr unsigned int ImageDimension = TImageType::ImageDimension;
144 
146  static constexpr unsigned int DefaultBinsPerAxis = 256;
147 
157  itkSetObjectMacro(Offsets, OffsetVector);
158 
168  void
169  SetOffset(const OffsetType offset);
170 
174  itkGetModifiableObjectMacro(Offsets, OffsetVector);
175 
177  itkSetMacro(NumberOfBinsPerAxis, unsigned int);
178 
180  itkGetConstMacro(NumberOfBinsPerAxis, unsigned int);
181 
186  void
187  SetPixelValueMinMax(PixelType min, PixelType max);
188 
190  itkGetConstMacro(Min, PixelType);
191 
193  itkGetConstMacro(Max, PixelType);
194 
199  void
200  SetDistanceValueMinMax(RealType min, RealType max);
201 
205  itkGetConstMacro(MinDistance, RealType);
206 
210  itkGetConstMacro(MaxDistance, RealType);
211 
213  using Superclass::SetInput;
214  void
215  SetInput(const ImageType * image);
216 
218  const ImageType *
219  GetInput() const;
220 
222  void
223  SetMaskImage(const ImageType * image);
224 
226  const ImageType *
227  GetMaskImage() const;
228 
230  const HistogramType *
231  GetOutput() const;
232 
237  itkSetMacro(InsidePixelValue, PixelType);
238  itkGetConstMacro(InsidePixelValue, PixelType);
240 
241 protected:
243  ~ScalarImageToRunLengthMatrixFilter() override = default;
244  void
245  PrintSelf(std::ostream & os, Indent indent) const override;
246 
249 
251  using Superclass::MakeOutput;
253  MakeOutput(DataObjectPointerArraySizeType idx) override;
254 
256  void
257  GenerateData() override;
258 
266  void
267  NormalizeOffsetDirection(OffsetType & offset);
268 
269 private:
270  unsigned int m_NumberOfBinsPerAxis;
276 
280 };
281 } // end of namespace Statistics
282 } // end of namespace itk
283 
284 #ifndef ITK_MANUAL_INSTANTIATION
285 # include "itkScalarImageToRunLengthMatrixFilter.hxx"
286 #endif
287 
288 #endif
itk::Statistics::ScalarImageToRunLengthMatrixFilter
This class computes a run length matrix (histogram) from a given image and a mask image if provided....
Definition: itkScalarImageToRunLengthMatrixFilter.h:107
itk::Statistics::ScalarImageToRunLengthMatrixFilter::RealType
typename NumericTraits< PixelType >::RealType RealType
Definition: itkScalarImageToRunLengthMatrixFilter.h:135
itk::Statistics::ScalarImageToRunLengthMatrixFilter::m_NumberOfBinsPerAxis
unsigned int m_NumberOfBinsPerAxis
Definition: itkScalarImageToRunLengthMatrixFilter.h:270
itk::Statistics::ScalarImageToRunLengthMatrixFilter::m_LowerBound
MeasurementVectorType m_LowerBound
Definition: itkScalarImageToRunLengthMatrixFilter.h:277
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:131
itk::SmartPointer< Self >
itk::Indent
Control indentation during Print() invocation.
Definition: itkIndent.h:49
itk::Statistics::ScalarImageToRunLengthMatrixFilter::m_Min
PixelType m_Min
Definition: itkScalarImageToRunLengthMatrixFilter.h:271
itk::ProcessObject::DataObjectPointerArraySizeType
DataObjectPointerArray::size_type DataObjectPointerArraySizeType
Definition: itkProcessObject.h:193
itk::Statistics::ScalarImageToRunLengthMatrixFilter::m_Offsets
OffsetVectorPointer m_Offsets
Definition: itkScalarImageToRunLengthMatrixFilter.h:279
itk::Statistics::ScalarImageToRunLengthMatrixFilter::PixelType
typename ImageType::PixelType PixelType
Definition: itkScalarImageToRunLengthMatrixFilter.h:125
itk::Statistics::ScalarImageToRunLengthMatrixFilter::m_MinDistance
RealType m_MinDistance
Definition: itkScalarImageToRunLengthMatrixFilter.h:273
itk::Statistics::ScalarImageToRunLengthMatrixFilter::IndexType
typename ImageType::IndexType IndexType
Definition: itkScalarImageToRunLengthMatrixFilter.h:126
itk::Statistics::ScalarImageToRunLengthMatrixFilter::PointType
typename ImageType::PointType PointType
Definition: itkScalarImageToRunLengthMatrixFilter.h:132
itk::Statistics::ScalarImageToRunLengthMatrixFilter::m_MaxDistance
RealType m_MaxDistance
Definition: itkScalarImageToRunLengthMatrixFilter.h:274
itk::GTest::TypedefsAndConstructors::Dimension2::IndexType
ImageBaseType::IndexType IndexType
Definition: itkGTestTypedefsAndConstructors.h:50
itk::Statistics::ScalarImageToRunLengthMatrixFilter::MeasurementVectorType
typename HistogramType::MeasurementVectorType MeasurementVectorType
Definition: itkScalarImageToRunLengthMatrixFilter.h:140
itk::Statistics::Histogram::MeasurementVectorType
typename Superclass::MeasurementVectorType MeasurementVectorType
Definition: itkHistogram.h:101
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:122
itk::LightObject
Light weight base class for most itk classes.
Definition: itkLightObject.h:59
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:123
itk::Statistics::ScalarImageToRunLengthMatrixFilter::HistogramPointer
typename HistogramType::Pointer HistogramPointer
Definition: itkScalarImageToRunLengthMatrixFilter.h:138
itk::Statistics::ScalarImageToRunLengthMatrixFilter::m_Max
PixelType m_Max
Definition: itkScalarImageToRunLengthMatrixFilter.h:272
itk::Statistics::ScalarImageToRunLengthMatrixFilter::HistogramConstPointer
typename HistogramType::ConstPointer HistogramConstPointer
Definition: itkScalarImageToRunLengthMatrixFilter.h:139
itk::Statistics::ScalarImageToRunLengthMatrixFilter::m_UpperBound
MeasurementVectorType m_UpperBound
Definition: itkScalarImageToRunLengthMatrixFilter.h:278
itk::NumericTraits
Define additional traits for native types such as int or float.
Definition: itkNumericTraits.h:58
itkVectorContainer.h
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnnulusOperator.h:24
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
itkNumericTraits.h
itk::Statistics::ScalarImageToRunLengthMatrixFilter::RegionType
typename ImageType::RegionType RegionType
Definition: itkScalarImageToRunLengthMatrixFilter.h:127
itk::Statistics::ScalarImageToRunLengthMatrixFilter::OffsetType
typename ImageType::OffsetType OffsetType
Definition: itkScalarImageToRunLengthMatrixFilter.h:129
itk::Statistics::ScalarImageToRunLengthMatrixFilter::MeasurementType
typename NumericTraits< PixelType >::RealType MeasurementType
Definition: itkScalarImageToRunLengthMatrixFilter.h:134
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
itk::Statistics::ScalarImageToRunLengthMatrixFilter::m_InsidePixelValue
PixelType m_InsidePixelValue
Definition: itkScalarImageToRunLengthMatrixFilter.h:275
itk::Statistics::ScalarImageToRunLengthMatrixFilter::ImageConstPointer
typename ImageType::ConstPointer ImageConstPointer
Definition: itkScalarImageToRunLengthMatrixFilter.h:124
itk::Statistics::ScalarImageToRunLengthMatrixFilter::RadiusType
typename ImageType::SizeType RadiusType
Definition: itkScalarImageToRunLengthMatrixFilter.h:128