Medical Imaging Interaction Toolkit  2026.06.00
Medical Imaging Interaction Toolkit
itkEnhancedScalarImageToRunLengthMatrixFilter.h
Go to the documentation of this file.
1 /*============================================================================
2 
3 The Medical Imaging Interaction Toolkit (MITK)
4 
5 Copyright (c) German Cancer Research Center (DKFZ)
6 All rights reserved.
7 
8 Use of this source code is governed by a 3-clause BSD license that can be
9 found in the LICENSE file.
10 
11 ============================================================================*/
12 
13 /*=========================================================================
14 *
15 * Copyright Insight Software Consortium
16 *
17 * Licensed under the Apache License, Version 2.0 (the "License");
18 * you may not use this file except in compliance with the License.
19 * You may obtain a copy of the License at
20 *
21 * https://www.apache.org/licenses/LICENSE-2.0.txt
22 *
23 * Unless required by applicable law or agreed to in writing, software
24 * distributed under the License is distributed on an "AS IS" BASIS,
25 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
26 * See the License for the specific language governing permissions and
27 * limitations under the License.
28 *
29 *=========================================================================*/
30 #ifndef itkEnhancedScalarImageToRunLengthMatrixFilter_h
31 #define itkEnhancedScalarImageToRunLengthMatrixFilter_h
32 
33 #include <itkImage.h>
34 #include <itkHistogram.h>
35 #include <itkNumericTraits.h>
36 #include <itkVectorContainer.h>
37 
38 namespace itk
39 {
40  namespace Statistics
41  {
114  template<typename TImageType, typename THistogramFrequencyContainer =
115  DenseFrequencyContainer2>
116  class EnhancedScalarImageToRunLengthMatrixFilter : public ProcessObject
117  {
118  public:
121  typedef ProcessObject Superclass;
124 
126  itkTypeMacro( EnhancedScalarImageToRunLengthMatrixFilter, ProcessObject );
127 
129  itkNewMacro( Self );
130 
131  typedef TImageType ImageType;
132  typedef typename ImageType::Pointer ImagePointer;
133  typedef typename ImageType::ConstPointer ImageConstPointer;
134  typedef typename ImageType::PixelType PixelType;
135  typedef typename ImageType::IndexType IndexType;
136  typedef typename ImageType::RegionType RegionType;
137  typedef typename ImageType::SizeType RadiusType;
138  typedef typename ImageType::OffsetType OffsetType;
139  typedef VectorContainer<unsigned char, OffsetType> OffsetVector;
140  typedef typename OffsetVector::Pointer OffsetVectorPointer;
141  typedef typename ImageType::PointType PointType;
142 
143  typedef typename NumericTraits<PixelType>::RealType MeasurementType;
144  typedef typename NumericTraits<PixelType>::RealType RealType;
145 
146  typedef Histogram<MeasurementType, THistogramFrequencyContainer>
148  typedef typename HistogramType::Pointer HistogramPointer;
149  typedef typename HistogramType::ConstPointer HistogramConstPointer;
150  typedef typename HistogramType::MeasurementVectorType MeasurementVectorType;
151 
153  itkStaticConstMacro( ImageDimension, unsigned int,
154  TImageType::ImageDimension );
155 
157  itkStaticConstMacro( DefaultBinsPerAxis, unsigned int, 256 );
158 
168  itkSetObjectMacro( Offsets, OffsetVector );
169 
179  void SetOffset( const OffsetType offset );
180 
185 
187  itkSetMacro( NumberOfBinsPerAxis, unsigned int );
188 
190  itkGetConstMacro( NumberOfBinsPerAxis, unsigned int );
191 
197 
199  itkGetConstMacro( Min, PixelType );
200 
202  itkGetConstMacro( Max, PixelType );
203 
209 
213  itkGetConstMacro( MinDistance, RealType );
214 
218  itkGetConstMacro( MaxDistance, RealType );
219 
221  using Superclass::SetInput;
222  void SetInput( const ImageType *image );
223 
225  const ImageType * GetInput() const;
226 
228  void SetMaskImage( const ImageType *image );
229 
231  const ImageType * GetMaskImage() const;
232 
234  const HistogramType * GetOutput() const;
235 
240  itkSetMacro( InsidePixelValue, PixelType );
241  itkGetConstMacro( InsidePixelValue, PixelType );
242 
243  protected:
246  void PrintSelf( std::ostream& os, Indent indent ) const ITK_OVERRIDE;
247 
249  typedef DataObject::Pointer DataObjectPointer;
250 
251  typedef ProcessObject::DataObjectPointerArraySizeType DataObjectPointerArraySizeType;
252  using Superclass::MakeOutput;
254 
256  void GenerateData() ITK_OVERRIDE;
257 
266 
267  private:
268 
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 <itkEnhancedScalarImageToRunLengthMatrixFilter.tpp>
285 #endif
286 
287 #endif
This class computes a run length matrix (histogram) from a given image and a mask image if provided....
void PrintSelf(std::ostream &os, Indent indent) const ITK_OVERRIDE
itkStaticConstMacro(DefaultBinsPerAxis, unsigned int, 256)
Histogram< MeasurementType, THistogramFrequencyContainer > HistogramType
itkStaticConstMacro(ImageDimension, unsigned int, TImageType::ImageDimension)
DataObjectPointer MakeOutput(DataObjectPointerArraySizeType idx) ITK_OVERRIDE
void SetPixelValueMinMax(PixelType min, PixelType max)