ITK  5.0.0
Insight Segmentation and Registration Toolkit
itkLinearAnisotropicDiffusionLBRImageFilter.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 //
19 // Created by Jean-Marie Mirebeau on 28/02/2014.
20 //
21 //
22 
23 #ifndef itkLinearAnisotropicDiffusionLBRImageFilter_h
24 #define itkLinearAnisotropicDiffusionLBRImageFilter_h
25 
26 
27 #include "itkImageToImageFilter.h"
29 
30 namespace itk
31 {
46 template< typename TImage, typename TScalar = typename NumericTraits< typename TImage::PixelType >::RealType >
48  public ImageToImageFilter< TImage, TImage >
49 {
50 public:
51  ITK_DISALLOW_COPY_AND_ASSIGN(LinearAnisotropicDiffusionLBRImageFilter);
52 
58 
60  itkNewMacro(Self);
61 
64 
65  using ImageType = TImage;
66  using PixelType = typename ImageType::PixelType;
67 
68  static const int Dimension = ImageType::ImageDimension;
69 
70  using ScalarType = TScalar;
74 
75  void SetInputImage(const ImageType* image);
76  void SetInputTensor(const TensorImageType* tensorImage);
77 
79  itkGetConstMacro(DiffusionTime, ScalarType);
80 
81  void SetMaxNumberOfTimeSteps(int n);
82  itkGetConstMacro(MaxNumberOfTimeSteps, int);
83 
85  itkGetConstMacro(RatioToMaxStableTimeStep, ScalarType);
86 
87  itkGetConstMacro(EffectiveDiffusionTime, ScalarType);
88  itkGetConstMacro(EffectiveNumberOfTimeSteps, int);
89 
90 protected:
93 
94  typename ImageType::ConstPointer GetInputImage();
96 
98 
99  // ******* Containers for the stencils used in the discretization
100  static const unsigned int HalfStencilSize = (Dimension == 2) ? 3 : 6;
101  static const unsigned int StencilSize = 2 * HalfStencilSize;
102 
106 
107  using InternalSizeT = int;
109 
110 
111  // *************** Computation *****************
112  void GenerateData() override;
113  virtual void GenerateStencils();
114  virtual void ImageUpdateLoop();
115 
116  using StencilType = std::pair< StencilBufferIndicesType, StencilCoefficientsType >;
119 
122 
123  virtual ScalarType MaxStableTimeStep();
124 
128 
131 
132  virtual void ImageUpdate(ScalarType delta);
133  typename ImageType::Pointer m_PreviousImage;
134  typename ImageType::Pointer m_NextImage;
135 
136  virtual RegionType GetRequestedRegion(){return GetInputImage()->GetRequestedRegion();}
137 
139 
140  struct StencilFunctor;
141  struct FunctorType;
142 
144  static ScalarType ScalarProduct(const TensorType &, const VectorType &, const VectorType &);
145 
146 };
147 } // end namespace itk
148 
149 
150 #ifndef ITK_MANUAL_INSTANTIATION
151 #include "itkLinearAnisotropicDiffusionLBRImageFilter.hxx"
152 #endif
153 
154 #endif
virtual void ImageUpdateLoop()
Automatically called by GenerateData.
Light weight base class for most itk classes.
virtual void ImageUpdate(ScalarType delta)
void SetRatioToMaxStableTimeStep(ScalarType ratio)
Define numeric traits for std::vector.
Represent a n-dimensional index in a n-dimensional image.
Definition: itkIndex.h:66
Represent a symmetric tensor of second rank.
An image region represents a structured region of data.
void SetInputImage(const ImageType *image)
Anisotropic diffusion using lattice basis reduction.
A templated class holding a n-Dimensional vector.
Definition: itkVector.h:62
TensorImageType::ConstPointer GetInputTensor()
Represent a n-dimensional offset between two n-dimensional indexes of n-dimensional image...
Definition: itkOffset.h:67
SmartPointer< const Self > ConstPointer
Definition: itkImage.h:84
Base class for filters that take an image as input and produce an image as output.
std::pair< StencilBufferIndicesType, StencilCoefficientsType > StencilType
Automatically called by GenerateData.
void SetInputTensor(const TensorImageType *tensorImage)
static ScalarType ScalarProduct(const TensorType &, const VectorType &, const VectorType &)
Templated n-dimensional image class.
Definition: itkImage.h:75