Medical Imaging Interaction Toolkit  2016.11.0
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,
6 Division of Medical and Biological Informatics.
7 All rights reserved.
8 
9 This software is distributed WITHOUT ANY WARRANTY; without
10 even the implied warranty of MERCHANTABILITY or FITNESS FOR
11 A PARTICULAR PURPOSE.
12 
13 See LICENSE.txt or http://www.mitk.org for details.
14 
15 ===================================================================*/
16 
17 /*=========================================================================
18 *
19 * Copyright Insight Software Consortium
20 *
21 * Licensed under the Apache License, Version 2.0 (the "License");
22 * you may not use this file except in compliance with the License.
23 * You may obtain a copy of the License at
24 *
25 * http://www.apache.org/licenses/LICENSE-2.0.txt
26 *
27 * Unless required by applicable law or agreed to in writing, software
28 * distributed under the License is distributed on an "AS IS" BASIS,
29 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
30 * See the License for the specific language governing permissions and
31 * limitations under the License.
32 *
33 *=========================================================================*/
34 #ifndef __itkEnhancedScalarImageToRunLengthMatrixFilter_h
35 #define __itkEnhancedScalarImageToRunLengthMatrixFilter_h
36 
37 #include "itkImage.h"
38 #include "itkHistogram.h"
39 #include "itkNumericTraits.h"
40 #include "itkVectorContainer.h"
41 
42 namespace itk
43 {
44  namespace Statistics
45  {
119  template<typename TImageType, typename THistogramFrequencyContainer =
120  DenseFrequencyContainer2>
121  class EnhancedScalarImageToRunLengthMatrixFilter : public ProcessObject
122  {
123  public:
126  typedef ProcessObject Superclass;
129 
131  itkTypeMacro( EnhancedScalarImageToRunLengthMatrixFilter, ProcessObject );
132 
134  itkNewMacro( Self );
135 
136  typedef TImageType ImageType;
139  typedef typename ImageType::PixelType PixelType;
140  typedef typename ImageType::IndexType IndexType;
141  typedef typename ImageType::RegionType RegionType;
142  typedef typename ImageType::SizeType RadiusType;
143  typedef typename ImageType::OffsetType OffsetType;
144  typedef VectorContainer<unsigned char, OffsetType> OffsetVector;
146  typedef typename ImageType::PointType PointType;
147 
148  typedef typename NumericTraits<PixelType>::RealType MeasurementType;
149  typedef typename NumericTraits<PixelType>::RealType RealType;
150 
151  typedef Histogram<MeasurementType, THistogramFrequencyContainer>
155  typedef typename HistogramType::MeasurementVectorType MeasurementVectorType;
156 
158  itkStaticConstMacro( ImageDimension, unsigned int,
159  TImageType::ImageDimension );
160 
162  itkStaticConstMacro( DefaultBinsPerAxis, unsigned int, 256 );
163 
173  itkSetObjectMacro( Offsets, OffsetVector );
174 
184  void SetOffset( const OffsetType offset );
185 
189  itkGetModifiableObjectMacro(Offsets, OffsetVector );
190 
192  itkSetMacro( NumberOfBinsPerAxis, unsigned int );
193 
195  itkGetConstMacro( NumberOfBinsPerAxis, unsigned int );
196 
201  void SetPixelValueMinMax( PixelType min, PixelType max );
202 
204  itkGetConstMacro( Min, PixelType );
205 
207  itkGetConstMacro( Max, PixelType );
208 
213  void SetDistanceValueMinMax( RealType min, RealType max );
214 
218  itkGetConstMacro( MinDistance, RealType );
219 
223  itkGetConstMacro( MaxDistance, RealType );
224 
226  using Superclass::SetInput;
227  void SetInput( const ImageType *image );
228 
230  const ImageType * GetInput() const;
231 
233  void SetMaskImage( const ImageType *image );
234 
236  const ImageType * GetMaskImage() const;
237 
239  const HistogramType * GetOutput() const;
240 
245  itkSetMacro( InsidePixelValue, PixelType );
246  itkGetConstMacro( InsidePixelValue, PixelType );
247 
248  protected:
251  virtual void PrintSelf( std::ostream& os, Indent indent ) const ITK_OVERRIDE;
252 
255 
256  typedef ProcessObject::DataObjectPointerArraySizeType DataObjectPointerArraySizeType;
257  using Superclass::MakeOutput;
258  virtual DataObjectPointer MakeOutput( DataObjectPointerArraySizeType idx ) ITK_OVERRIDE;
259 
261  virtual void GenerateData() ITK_OVERRIDE;
262 
270  void NormalizeOffsetDirection(OffsetType &offset);
271 
272  private:
273 
274  unsigned int m_NumberOfBinsPerAxis;
275  PixelType m_Min;
276  PixelType m_Max;
277  RealType m_MinDistance;
278  RealType m_MaxDistance;
279  PixelType m_InsidePixelValue;
280 
281  MeasurementVectorType m_LowerBound;
282  MeasurementVectorType m_UpperBound;
283  OffsetVectorPointer m_Offsets;
284  };
285  } // end of namespace Statistics
286 } // end of namespace itk
287 
288 #ifndef ITK_MANUAL_INSTANTIATION
289 #include "itkEnhancedScalarImageToRunLengthMatrixFilter.hxx"
290 #endif
291 
292 #endif
mitk::Point3D PointType
itk::SmartPointer< Self > Pointer
#define Max(x, y)
Definition: AnnotationP.h:41
itk::SmartPointer< const Self > ConstPointer
static Vector3D offset
itkStaticConstMacro(ImageDimension, unsigned int, TImageType::ImageDimension)
void SetPixelValueMinMax(PixelType min, PixelType max)
virtual DataObjectPointer MakeOutput(DataObjectPointerArraySizeType idx) ITK_OVERRIDE
static T max(T x, T y)
Definition: svm.cpp:70
static T min(T x, T y)
Definition: svm.cpp:67
This class computes a run length matrix (histogram) from a given image and a mask image if provided...
Histogram< MeasurementType, THistogramFrequencyContainer > HistogramType
unsigned short PixelType
#define Min(x, y)
Definition: AnnotationP.h:38
virtual void PrintSelf(std::ostream &os, Indent indent) const ITK_OVERRIDE