ITK  4.8.0
Insight Segmentation and Registration Toolkit
itkNormalVectorDiffusionFunction.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 #ifndef itkNormalVectorDiffusionFunction_h
19 #define itkNormalVectorDiffusionFunction_h
20 
22 #include "itkNumericTraits.h"
23 #include <cmath>
24 
25 namespace itk
26 {
59 template< typename TSparseImageType >
61  public NormalVectorFunctionBase< TSparseImageType >
62 {
63 public:
69 
72 
74  itkStaticConstMacro(ImageDimension, unsigned int, Superclass::ImageDimension);
75 
77  itkNewMacro(Self);
78 
80  typedef typename Superclass::TimeStepType TimeStepType;
85  typedef typename Superclass::IndexType IndexType;
87  typedef typename Superclass::NodeType NodeType;
90 
95  void SetNormalProcessType(int npt)
96  { m_NormalProcessType = npt; }
97 
100  { return m_NormalProcessType; }
101 
108  {
109  m_ConductanceParameter = cp + static_cast< NodeValueType >( 0.001 );
110  // we add a minimum conductance to avoid divide by zero
111  // can make this a parameter.
112  m_FluxStopConstant = static_cast< NodeValueType >
114  }
116 
119  { return m_ConductanceParameter; }
120 
123  { return m_FluxStopConstant; }
124 
129  virtual void PrecomputeSparseUpdate(NeighborhoodType & it) const ITK_OVERRIDE;
130 
133  void *globalData,
134  const FloatOffsetType & offset) const ITK_OVERRIDE;
135 
136 protected:
139  void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE;
140 
144  {
145  // the slow exp function could be replaced with a lookup table
146  if ( v <= 0.0 ) { return NumericTraits< NodeValueType >::OneValue(); }
147  else { return static_cast< NodeValueType >( std::exp(m_FluxStopConstant * v) ); }
148  }
150 
151 private:
154 
158 
161 
162  NormalVectorDiffusionFunction(const Self &); //purposely not implemented
163  void operator=(const Self &); //purposely not implemented
164 };
165 } // end namespace itk
166 
167 #ifndef ITK_MANUAL_INSTANTIATION
168 #include "itkNormalVectorDiffusionFunction.hxx"
169 #endif
170 
171 #endif
Superclass::SparseImageType SparseImageType
NormalVectorFunctionBase< TSparseImageType > Superclass
void PrintSelf(std::ostream &os, Indent indent) const override
Light weight base class for most itk classes.
Superclass::NeighborhoodScalesType NeighborhoodScalesType
This class defines the common functionality for Sparse Image neighborhoods of unit vectors...
static const unsigned int ImageDimension
ConstNeighborhoodIterator< TSparseImageType >::RadiusType RadiusType
virtual void PrecomputeSparseUpdate(NeighborhoodType &it) const override
Const version of NeighborhoodIterator, defining iteration of a local N-dimensional neighborhood of pi...
NodeValueType FluxStopFunction(const NodeValueType v) const
This class defines all the necessary functionality for performing isotropic and anisotropic diffusion...
A templated class holding a n-Dimensional vector.
Definition: itkVector.h:62
virtual NormalVectorType ComputeSparseUpdate(NeighborhoodType &neighborhood, void *globalData, const FloatOffsetType &offset) const override
Control indentation during Print() invocation.
Definition: itkIndent.h:49