Medical Imaging Interaction Toolkit  2018.4.99-07c45cb1
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 * http://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  {
115  template<typename TImageType, typename THistogramFrequencyContainer =
116  DenseFrequencyContainer2>
117  class EnhancedScalarImageToRunLengthMatrixFilter : public ProcessObject
118  {
119  public:
122  typedef ProcessObject Superclass;
125 
127  itkTypeMacro( EnhancedScalarImageToRunLengthMatrixFilter, ProcessObject );
128 
130  itkNewMacro( Self );
131 
132  typedef TImageType ImageType;
133  typedef typename ImageType::Pointer ImagePointer;
134  typedef typename ImageType::ConstPointer ImageConstPointer;
135  typedef typename ImageType::PixelType PixelType;
136  typedef typename ImageType::IndexType IndexType;
137  typedef typename ImageType::RegionType RegionType;
138  typedef typename ImageType::SizeType RadiusType;
139  typedef typename ImageType::OffsetType OffsetType;
140  typedef VectorContainer<unsigned char, OffsetType> OffsetVector;
141  typedef typename OffsetVector::Pointer OffsetVectorPointer;
142  typedef typename ImageType::PointType PointType;
143 
144  typedef typename NumericTraits<PixelType>::RealType MeasurementType;
145  typedef typename NumericTraits<PixelType>::RealType RealType;
146 
147  typedef Histogram<MeasurementType, THistogramFrequencyContainer>
149  typedef typename HistogramType::Pointer HistogramPointer;
150  typedef typename HistogramType::ConstPointer HistogramConstPointer;
151  typedef typename HistogramType::MeasurementVectorType MeasurementVectorType;
152 
154  itkStaticConstMacro( ImageDimension, unsigned int,
155  TImageType::ImageDimension );
156 
158  itkStaticConstMacro( DefaultBinsPerAxis, unsigned int, 256 );
159 
169  itkSetObjectMacro( Offsets, OffsetVector );
170 
180  void SetOffset( const OffsetType offset );
181 
185  itkGetModifiableObjectMacro(Offsets, OffsetVector );
186 
188  itkSetMacro( NumberOfBinsPerAxis, unsigned int );
189 
191  itkGetConstMacro( NumberOfBinsPerAxis, unsigned int );
192 
197  void SetPixelValueMinMax( PixelType min, PixelType max );
198 
200  itkGetConstMacro( Min, PixelType );
201 
203  itkGetConstMacro( Max, PixelType );
204 
209  void SetDistanceValueMinMax( RealType min, RealType max );
210 
214  itkGetConstMacro( MinDistance, RealType );
215 
219  itkGetConstMacro( MaxDistance, RealType );
220 
222  using Superclass::SetInput;
223  void SetInput( const ImageType *image );
224 
226  const ImageType * GetInput() const;
227 
229  void SetMaskImage( const ImageType *image );
230 
232  const ImageType * GetMaskImage() const;
233 
235  const HistogramType * GetOutput() const;
236 
241  itkSetMacro( InsidePixelValue, PixelType );
242  itkGetConstMacro( InsidePixelValue, PixelType );
243 
244  protected:
247  void PrintSelf( std::ostream& os, Indent indent ) const ITK_OVERRIDE;
248 
250  typedef DataObject::Pointer DataObjectPointer;
251 
252  typedef ProcessObject::DataObjectPointerArraySizeType DataObjectPointerArraySizeType;
253  using Superclass::MakeOutput;
254  DataObjectPointer MakeOutput( DataObjectPointerArraySizeType idx ) ITK_OVERRIDE;
255 
257  void GenerateData() ITK_OVERRIDE;
258 
266  void NormalizeOffsetDirection(OffsetType &offset);
267 
268  private:
269 
270  unsigned int m_NumberOfBinsPerAxis;
271  PixelType m_Min;
272  PixelType m_Max;
273  RealType m_MinDistance;
274  RealType m_MaxDistance;
275  PixelType m_InsidePixelValue;
276 
277  MeasurementVectorType m_LowerBound;
278  MeasurementVectorType m_UpperBound;
279  OffsetVectorPointer m_Offsets;
280  };
281  } // end of namespace Statistics
282 } // end of namespace itk
283 
284 #ifndef ITK_MANUAL_INSTANTIATION
285 #include "itkEnhancedScalarImageToRunLengthMatrixFilter.hxx"
286 #endif
287 
288 #endif
#define Max(x, y)
Definition: AnnotationP.h:80
static Vector3D offset
itkStaticConstMacro(ImageDimension, unsigned int, TImageType::ImageDimension)
void PrintSelf(std::ostream &os, Indent indent) const ITK_OVERRIDE
void SetPixelValueMinMax(PixelType min, PixelType max)
static T max(T x, T y)
Definition: svm.cpp:56
mitk::Image::Pointer image
DataObjectPointer MakeOutput(DataObjectPointerArraySizeType idx) ITK_OVERRIDE
static T min(T x, T y)
Definition: svm.cpp:53
This class computes a run length matrix (histogram) from a given image and a mask image if provided...
Histogram< MeasurementType, THistogramFrequencyContainer > HistogramType
#define Min(x, y)
Definition: AnnotationP.h:77