Medical Imaging Interaction Toolkit  2018.4.99-07c45cb1
Medical Imaging Interaction Toolkit
itkEnhancedScalarImageToNeighbourhoodGreyLevelDifferenceMatrixFilter.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 __itkEnhancedScalarImageToNeighbourhoodGreyLevelDifferenceMatrixFilter_h
31 #define __itkEnhancedScalarImageToNeighbourhoodGreyLevelDifferenceMatrixFilter_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>
118  {
119  public:
122  typedef ProcessObject Superclass;
125 
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 
182  void AddOffsets( const std::vector<OffsetType> offset );
183 
187  itkGetModifiableObjectMacro(Offsets, OffsetVector );
188 
190  itkSetMacro( NumberOfBinsPerAxis, unsigned int );
191 
193  itkGetConstMacro( NumberOfBinsPerAxis, unsigned int );
194 
199  void SetPixelValueMinMax( PixelType min, PixelType max );
200 
202  itkGetConstMacro( Min, PixelType );
203 
205  itkGetConstMacro( Max, PixelType );
206 
211  void SetDistanceValueMinMax( RealType min, RealType max );
212 
216  itkGetConstMacro( MinDistance, RealType );
217 
221  itkGetConstMacro( MaxDistance, RealType );
222 
224  using Superclass::SetInput;
225  void SetInput( const ImageType *image );
226 
228  const ImageType * GetInput() const;
229 
231  void SetMaskImage( const ImageType *image );
232 
234  const ImageType * GetMaskImage() const;
235 
237  const HistogramType * GetOutput() const;
238 
240  double* GetSiMatrix() const;
241 
246  itkSetMacro( InsidePixelValue, PixelType );
247  itkGetConstMacro( InsidePixelValue, PixelType );
248 
249  protected:
252  void PrintSelf( std::ostream& os, Indent indent ) const ITK_OVERRIDE;
253 
255  typedef DataObject::Pointer DataObjectPointer;
256 
257  typedef ProcessObject::DataObjectPointerArraySizeType DataObjectPointerArraySizeType;
258  using Superclass::MakeOutput;
259  DataObjectPointer MakeOutput( DataObjectPointerArraySizeType idx ) ITK_OVERRIDE;
260 
262  void GenerateData() ITK_OVERRIDE;
263 
271  void NormalizeOffsetDirection(OffsetType &offset);
272 
273  private:
274 
275  unsigned int m_NumberOfBinsPerAxis;
276  PixelType m_Min;
277  PixelType m_Max;
278  RealType m_MinDistance;
279  RealType m_MaxDistance;
280  PixelType m_InsidePixelValue;
281 
282  MeasurementVectorType m_LowerBound;
283  MeasurementVectorType m_UpperBound;
284  OffsetVectorPointer m_Offsets;
285 
286  double * m_siMatrix;
287  };
288  } // end of namespace Statistics
289 } // end of namespace itk
290 
291 #ifndef ITK_MANUAL_INSTANTIATION
292 #include "itkEnhancedScalarImageToNeighbourhoodGreyLevelDifferenceMatrixFilter.hxx"
293 #endif
294 
295 #endif
This class computes a run length matrix (histogram) from a given image and a mask image if provided...
#define Max(x, y)
Definition: AnnotationP.h:80
DataObjectPointer MakeOutput(DataObjectPointerArraySizeType idx) ITK_OVERRIDE
itkStaticConstMacro(ImageDimension, unsigned int, TImageType::ImageDimension)
static Vector3D offset
static T max(T x, T y)
Definition: svm.cpp:56
mitk::Image::Pointer image
static T min(T x, T y)
Definition: svm.cpp:53
void PrintSelf(std::ostream &os, Indent indent) const ITK_OVERRIDE
#define Min(x, y)
Definition: AnnotationP.h:77