ITK  5.0.0
Insight Segmentation and Registration Toolkit
itkScalarImageToRunLengthMatrixFilter.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright Insight Software Consortium
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 
105 template<typename TImageType, typename THistogramFrequencyContainer =
106  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 
137  using HistogramType =
142 
144  static constexpr unsigned int ImageDimension = TImageType::ImageDimension;
145 
147  static constexpr unsigned int DefaultBinsPerAxis = 256;
148 
158  itkSetObjectMacro( Offsets, OffsetVector );
159 
169  void SetOffset( const OffsetType offset );
170 
174  itkGetModifiableObjectMacro(Offsets, OffsetVector );
175 
177  itkSetMacro( NumberOfBinsPerAxis, unsigned int );
178 
180  itkGetConstMacro( NumberOfBinsPerAxis, unsigned int );
181 
186  void SetPixelValueMinMax( PixelType min, PixelType max );
187 
189  itkGetConstMacro( Min, PixelType );
190 
192  itkGetConstMacro( Max, PixelType );
193 
198  void SetDistanceValueMinMax( RealType min, RealType max );
199 
203  itkGetConstMacro( MinDistance, RealType );
204 
208  itkGetConstMacro( MaxDistance, RealType );
209 
211  using Superclass::SetInput;
212  void SetInput( const ImageType *image );
213 
215  const ImageType * GetInput() const;
216 
218  void SetMaskImage( const ImageType *image );
219 
221  const ImageType * GetMaskImage() const;
222 
224  const HistogramType * GetOutput() const;
225 
230  itkSetMacro( InsidePixelValue, PixelType );
231  itkGetConstMacro( InsidePixelValue, PixelType );
233 
234 protected:
236  ~ScalarImageToRunLengthMatrixFilter() override = default;
237  void PrintSelf( std::ostream& os, Indent indent ) const override;
238 
241 
243  using Superclass::MakeOutput;
244  DataObjectPointer MakeOutput( DataObjectPointerArraySizeType idx ) override;
245 
247  void GenerateData() override;
248 
256  void NormalizeOffsetDirection(OffsetType &offset);
257 
258 private:
259 
260  unsigned int m_NumberOfBinsPerAxis;
266 
270 
271 };
272 } // end of namespace Statistics
273 } // end of namespace itk
274 
275 #ifndef ITK_MANUAL_INSTANTIATION
276 #include "itkScalarImageToRunLengthMatrixFilter.hxx"
277 #endif
278 
279 #endif
Light weight base class for most itk classes.
DataObjectPointerArray::size_type DataObjectPointerArraySizeType
Define numeric traits for std::vector.
This class stores measurement vectors in the context of n-dimensional histogram.
Definition: itkHistogram.h:77
The base class for all process objects (source, filters, mappers) in the Insight data processing pipe...
class ITK_FORWARD_EXPORT ProcessObject
Definition: itkDataObject.h:40
This class computes a run length matrix (histogram) from a given image and a mask image if provided...
typename HistogramType::MeasurementVectorType MeasurementVectorType
Define a front-end to the STL &quot;vector&quot; container that conforms to the IndexedContainerInterface.
Control indentation during Print() invocation.
Definition: itkIndent.h:49
typename Superclass::MeasurementVectorType MeasurementVectorType
Definition: itkHistogram.h:102
SmartPointer< Self > Pointer