ITK  5.3.0
Insight Toolkit
itkAnisotropicDiffusionFunction.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright NumFOCUS
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 itkAnisotropicDiffusionFunction_h
19 #define itkAnisotropicDiffusionFunction_h
20 
22 
23 namespace itk
24 {
138 template <typename TImage>
139 class ITK_TEMPLATE_EXPORT AnisotropicDiffusionFunction : public FiniteDifferenceFunction<TImage>
140 {
141 public:
142  ITK_DISALLOW_COPY_AND_MOVE(AnisotropicDiffusionFunction);
144 
150 
153 
155  using typename Superclass::ImageType;
156  using typename Superclass::PixelType;
158  using typename Superclass::RadiusType;
159  using typename Superclass::NeighborhoodType;
160  using typename Superclass::TimeStepType;
161  using typename Superclass::FloatOffsetType;
162 
164  static constexpr unsigned int ImageDimension = Superclass::ImageDimension;
165 
171  virtual void
172  CalculateAverageGradientMagnitudeSquared(ImageType *) = 0;
173 
177  void
179  {
180  m_TimeStep = t;
181  }
182 
183  const TimeStepType &
184  GetTimeStep() const
185  {
186  return m_TimeStep;
187  }
188 
190  void
191  SetConductanceParameter(const double & c)
192  {
193  m_ConductanceParameter = c;
194  }
195 
196  const double &
198  {
199  return m_ConductanceParameter;
200  }
201 
203  const double &
205  {
206  return m_AverageGradientMagnitudeSquared;
207  }
208 
209  void
211  {
212  m_AverageGradientMagnitudeSquared = c;
213  }
214 
217  TimeStepType
218  ComputeGlobalTimeStep(void * itkNotUsed(GlobalData)) const override
219  {
220  return this->GetTimeStep();
221  }
222 
225  void *
226  GetGlobalDataPointer() const override
227  {
228  return nullptr;
229  }
230 
232  void
233  ReleaseGlobalDataPointer(void * itkNotUsed(GlobalData)) const override
234  {
235  /* do nothing */
236  }
237 
238 protected:
240  {
241  m_AverageGradientMagnitudeSquared = 0.0;
242  m_ConductanceParameter = 1.0; // default value
243  m_TimeStep = 0.125f; // default value
244  }
245 
246  ~AnisotropicDiffusionFunction() override = default;
247 
248  void
249  PrintSelf(std::ostream & os, Indent indent) const override
250  {
251  Superclass::PrintSelf(os, indent);
252  os << indent << "TimeStep: " << m_TimeStep << std::endl;
253  os << indent << "ConductanceParameter: " << m_ConductanceParameter << std::endl;
254  }
255 
256 private:
260 };
261 } // end namespace itk
262 
263 #endif
itk::FiniteDifferenceFunction< TImage >::RadiusType
typename ConstNeighborhoodIterator< TImage >::RadiusType RadiusType
Definition: itkFiniteDifferenceFunction.h:97
itk::AnisotropicDiffusionFunction::m_TimeStep
TimeStepType m_TimeStep
Definition: itkAnisotropicDiffusionFunction.h:259
itk::AnisotropicDiffusionFunction::GetTimeStep
const TimeStepType & GetTimeStep() const
Definition: itkAnisotropicDiffusionFunction.h:184
itk::Vector
A templated class holding a n-Dimensional vector.
Definition: itkVector.h:62
itk::FiniteDifferenceFunction< TImage >::PixelRealType
double PixelRealType
Definition: itkFiniteDifferenceFunction.h:84
itk::AnisotropicDiffusionFunction::GetAverageGradientMagnitudeSquared
const double & GetAverageGradientMagnitudeSquared() const
Definition: itkAnisotropicDiffusionFunction.h:204
itk::AnisotropicDiffusionFunction::SetConductanceParameter
void SetConductanceParameter(const double &c)
Definition: itkAnisotropicDiffusionFunction.h:191
itk::SmartPointer< Self >
itk::Indent
Control indentation during Print() invocation.
Definition: itkIndent.h:49
itk::FiniteDifferenceFunction< TImage >::ImageType
TImage ImageType
Definition: itkFiniteDifferenceFunction.h:82
itk::AnisotropicDiffusionFunction::GetConductanceParameter
const double & GetConductanceParameter() const
Definition: itkAnisotropicDiffusionFunction.h:197
itkFiniteDifferenceFunction.h
itk::AnisotropicDiffusionFunction::GetGlobalDataPointer
void * GetGlobalDataPointer() const override
Definition: itkAnisotropicDiffusionFunction.h:226
itk::LightObject
Light weight base class for most itk classes.
Definition: itkLightObject.h:59
itk::AnisotropicDiffusionFunction::PixelrealType
typename Superclass::PixelRealType PixelrealType
Definition: itkAnisotropicDiffusionFunction.h:157
itk::AnisotropicDiffusionFunction
Definition: itkAnisotropicDiffusionFunction.h:139
itk::FiniteDifferenceFunction< TImage >::PixelType
typename ImageType::PixelType PixelType
Definition: itkFiniteDifferenceFunction.h:83
itk::AnisotropicDiffusionFunction::ReleaseGlobalDataPointer
void ReleaseGlobalDataPointer(void *) const override
Definition: itkAnisotropicDiffusionFunction.h:233
itk::AnisotropicDiffusionFunction::SetTimeStep
void SetTimeStep(const TimeStepType &t)
Definition: itkAnisotropicDiffusionFunction.h:178
itk::AnisotropicDiffusionFunction::m_AverageGradientMagnitudeSquared
double m_AverageGradientMagnitudeSquared
Definition: itkAnisotropicDiffusionFunction.h:257
itk::AnisotropicDiffusionFunction::SetAverageGradientMagnitudeSquared
void SetAverageGradientMagnitudeSquared(const double &c)
Definition: itkAnisotropicDiffusionFunction.h:210
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnnulusOperator.h:24
itk::ConstNeighborhoodIterator
Const version of NeighborhoodIterator, defining iteration of a local N-dimensional neighborhood of pi...
Definition: itkConstNeighborhoodIterator.h:51
itk::AnisotropicDiffusionFunction::AnisotropicDiffusionFunction
AnisotropicDiffusionFunction()
Definition: itkAnisotropicDiffusionFunction.h:239
itk::AnisotropicDiffusionFunction::ComputeGlobalTimeStep
TimeStepType ComputeGlobalTimeStep(void *) const override
Definition: itkAnisotropicDiffusionFunction.h:218
itk::FiniteDifferenceFunction
Definition: itkFiniteDifferenceFunction.h:66
itk::AnisotropicDiffusionFunction::m_ConductanceParameter
double m_ConductanceParameter
Definition: itkAnisotropicDiffusionFunction.h:258
itk::AnisotropicDiffusionFunction::PrintSelf
void PrintSelf(std::ostream &os, Indent indent) const override
Definition: itkAnisotropicDiffusionFunction.h:249
itk::FiniteDifferenceFunction< TImage >::TimeStepType
double TimeStepType
Definition: itkFiniteDifferenceFunction.h:90