00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef __itkNormalVectorDiffusionFunction_h_
00018 #define __itkNormalVectorDiffusionFunction_h_
00019
00020 #include "itkNormalVectorFunctionBase.h"
00021 #include "itkNumericTraits.h"
00022 #include <math.h>
00023
00024 namespace itk {
00025
00057 template <class TSparseImageType>
00058 class ITK_EXPORT NormalVectorDiffusionFunction
00059 :public NormalVectorFunctionBase <TSparseImageType>
00060 {
00061 public:
00063 typedef NormalVectorDiffusionFunction Self;
00064 typedef NormalVectorFunctionBase <TSparseImageType> Superclass;
00065 typedef SmartPointer<Self> Pointer;
00066 typedef SmartPointer<const Self> ConstPointer;
00067
00069 itkTypeMacro( NormalVectorDiffusionFunction, NormalVectorFunctionBase);
00070
00072 itkStaticConstMacro(ImageDimension, unsigned int, Superclass::ImageDimension);
00073
00075 itkNewMacro(Self);
00076
00078 typedef typename Superclass::TimeStepType TimeStepType;
00079 typedef typename Superclass::RadiusType RadiusType;
00080 typedef typename Superclass::NeighborhoodType NeighborhoodType;
00081 typedef typename Superclass::FloatOffsetType FloatOffsetType;
00082 typedef typename Superclass::IndexType IndexType;
00083 typedef typename Superclass::SparseImageType SparseImageType;
00084 typedef typename Superclass::NodeType NodeType;
00085 typedef typename Superclass::NodeValueType NodeValueType;
00086 typedef typename Superclass::NormalVectorType NormalVectorType;
00087
00092 void SetNormalProcessType( int npt )
00093 { m_NormalProcessType = npt; }
00094
00096 int GetNormalProcessType() const
00097 { return m_NormalProcessType; }
00098
00104 void SetConductanceParameter( NodeValueType cp )
00105 {
00106 m_ConductanceParameter = cp + static_cast<NodeValueType> (0.001);
00107
00108
00109 m_FluxStopConstant = static_cast<NodeValueType>
00110 (-1.0/(m_ConductanceParameter*m_ConductanceParameter));
00111 }
00113
00115 NodeValueType GetConductanceParameter() const
00116 { return m_ConductanceParameter; }
00117
00119 NodeValueType GetFluxStopConstant() const
00120 { return m_FluxStopConstant; }
00121
00126 virtual void PrecomputeSparseUpdate( NeighborhoodType &it ) const;
00127
00129 virtual NormalVectorType ComputeSparseUpdate (NeighborhoodType &neighborhood,
00130 void *globalData,
00131 const FloatOffsetType &offset) const;
00132
00133 private:
00135 NodeValueType m_ConductanceParameter;
00136
00139 NodeValueType m_FluxStopConstant;
00140
00141 protected:
00142 NormalVectorDiffusionFunction();
00143 ~NormalVectorDiffusionFunction() {}
00144 void PrintSelf(std::ostream& os, Indent indent) const;
00145
00148 NodeValueType FluxStopFunction( const NodeValueType v ) const
00149 {
00150
00151 if (v<=0.0) return NumericTraits<NodeValueType>::One;
00152 else return static_cast<NodeValueType>(::exp(m_FluxStopConstant*v));
00153 }
00155
00156 private:
00158 int m_NormalProcessType;
00159
00160 NormalVectorDiffusionFunction(const Self&);
00161 void operator=(const Self&);
00162 };
00163
00164 }
00165
00166 #ifndef ITK_MANUAL_INSTANTIATION
00167 #include "itkNormalVectorDiffusionFunction.txx"
00168 #endif
00169
00170 #endif
00171