Orfeo Toolbox  3.16
itkNormalVectorDiffusionFunction.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Insight Segmentation & Registration Toolkit
4  Module: $RCSfile: itkNormalVectorDiffusionFunction.h,v $
5  Language: C++
6  Date: $Date: 2009-04-06 11:15:08 $
7  Version: $Revision: 1.8 $
8 
9  Copyright (c) Insight Software Consortium. All rights reserved.
10  See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
11 
12  This software is distributed WITHOUT ANY WARRANTY; without even
13  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
14  PURPOSE. See the above copyright notices for more information.
15 
16  =========================================================================*/
17 #ifndef __itkNormalVectorDiffusionFunction_h
18 #define __itkNormalVectorDiffusionFunction_h
19 
21 #include "itkNumericTraits.h"
22 #include <math.h>
23 
24 namespace itk {
25 
57 template <class TSparseImageType>
59  :public NormalVectorFunctionBase <TSparseImageType>
60 {
61 public:
67 
70 
72  itkStaticConstMacro(ImageDimension, unsigned int, Superclass::ImageDimension);
73 
75  itkNewMacro(Self);
76 
78  typedef typename Superclass::TimeStepType TimeStepType;
83  typedef typename Superclass::IndexType IndexType;
85  typedef typename Superclass::NodeType NodeType;
88 
93  void SetNormalProcessType( int npt )
94  { m_NormalProcessType = npt; }
95 
97  int GetNormalProcessType() const
98  { return m_NormalProcessType; }
99 
105  void SetConductanceParameter( NodeValueType cp )
106  {
107  m_ConductanceParameter = cp + static_cast<NodeValueType> (0.001);
108  // we add a minimum conductance to avoid divide by zero
109  // can make this a parameter.
110  m_FluxStopConstant = static_cast<NodeValueType>
111  (-1.0/(m_ConductanceParameter*m_ConductanceParameter));
112  }
113 
115  NodeValueType GetConductanceParameter() const
116  { return m_ConductanceParameter; }
117 
119  NodeValueType GetFluxStopConstant() const
120  { return m_FluxStopConstant; }
121 
126  virtual void PrecomputeSparseUpdate( NeighborhoodType &it ) const;
127 
129  virtual NormalVectorType ComputeSparseUpdate (NeighborhoodType &neighborhood,
130  void *globalData,
131  const FloatOffsetType &offset) const;
132 
133 protected:
136  void PrintSelf(std::ostream& os, Indent indent) const;
137 
140  NodeValueType FluxStopFunction( const NodeValueType v ) const
141  {
142  // the slow exp function could be replaced with a lookup table
143  if (v<=0.0) return NumericTraits<NodeValueType>::One;
144  else return static_cast<NodeValueType>(vcl_exp(m_FluxStopConstant*v));
145  }
146 
147 private:
150 
154 
157 
158  NormalVectorDiffusionFunction(const Self&); //purposely not implemented
159  void operator=(const Self&); //purposely not implemented
160 };
161 
162 } // end namespace itk
163 
164 #ifndef ITK_MANUAL_INSTANTIATION
166 #endif
167 
168 #endif

Generated at Sat Feb 2 2013 23:56:47 for Orfeo Toolbox with doxygen 1.8.1.1