00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef __itkLevelSetFunctionBase_h_
00018 #define __itkLevelSetFunctionBase_h_
00019
00020 #include "itkFiniteDifferenceFunction.h"
00021 #include "itkVector.h"
00022
00023 namespace itk {
00024
00033 template <class TImageType>
00034 class LevelSetFunctionBase : public FiniteDifferenceFunction<TImageType>
00035 {
00036 public:
00038 typedef LevelSetFunctionBase Self;
00039 typedef FiniteDifferenceFunction<TImageType> Superclass;
00040 typedef SmartPointer<Self> Pointer;
00041 typedef SmartPointer<const Self> ConstPointer;
00042
00044 itkTypeMacro( LevelSetFunctionBase, FiniteDifferenceFunction );
00045
00047 itkStaticConstMacro(ImageDimension, unsigned int,Superclass::ImageDimension);
00048
00050 typedef double TimeStepType;
00051 typedef typename Superclass::ImageType ImageType;
00052 typedef typename Superclass::PixelType PixelType;
00053 typedef PixelType ScalarValueType;
00054 typedef typename Superclass::RadiusType RadiusType;
00055 typedef typename Superclass::NeighborhoodType NeighborhoodType;
00056 typedef typename Superclass::BoundaryNeighborhoodType
00057 BoundaryNeighborhoodType;
00058 typedef typename Superclass::FloatOffsetType FloatOffsetType;
00059
00061 typedef
00062 Vector<ScalarValueType, itkGetStaticConstMacro(ImageDimension)> VectorType;
00063
00065 virtual VectorType AdvectionField(const NeighborhoodType &neighborhood,
00066 const FloatOffsetType &) const
00067 { return m_ZeroVectorConstant; }
00068 virtual VectorType AdvectionField(const BoundaryNeighborhoodType
00069 &neighborhood, const FloatOffsetType &
00070 ) const
00071 { return m_ZeroVectorConstant; }
00072
00075 virtual ScalarValueType PropagationSpeed(
00076 const NeighborhoodType& neighborhood,
00077 const FloatOffsetType ) const
00078 { return NumericTraits<ScalarValueType>::Zero; }
00079 virtual ScalarValueType PropagationSpeed(
00080 const BoundaryNeighborhoodType
00081 &neighborhood, const FloatOffsetType &) const
00082 { return NumericTraits<ScalarValueType>::Zero; }
00083
00086 virtual ScalarValueType CurvatureSpeed(const NeighborhoodType
00087 &neighborhood, const FloatOffsetType &
00088 ) const
00089 { return NumericTraits<ScalarValueType>::One; }
00090
00091 virtual ScalarValueType CurvatureSpeed(const BoundaryNeighborhoodType
00092 &neighborhood, const FloatOffsetType &
00093 ) const
00094 { return NumericTraits<ScalarValueType>::One; }
00095
00097 void SetAdvectionWeight(const ScalarValueType a)
00098 { m_AdvectionWeight = a; }
00099 ScalarValueType GetAdvectionWeight() const
00100 { return m_AdvectionWeight; }
00101
00103 void SetPropagationWeight(const ScalarValueType p)
00104 { m_PropagationWeight = p; }
00105 ScalarValueType GetPropagationWeight() const
00106 { return m_PropagationWeight; }
00107
00109 void SetCurvatureWeight(const ScalarValueType c)
00110 { m_CurvatureWeight = c; }
00111 ScalarValueType GetCurvatureWeight() const
00112 { return m_CurvatureWeight; }
00113
00115 void SetEpsilonMagnitude(const ScalarValueType e)
00116 { m_EpsilonMagnitude = e; }
00117 ScalarValueType GetEpsilonMagnitude() const
00118 { return m_EpsilonMagnitude; }
00119
00120 virtual void Initialize(const RadiusType &r) =0;
00121
00122 protected:
00123 LevelSetFunctionBase()
00124 {
00125 m_EpsilonMagnitude = 1.0e-5;
00126 m_AdvectionWeight = m_PropagationWeight = m_CurvatureWeight =
00127 NumericTraits<ScalarValueType>::Zero;
00128 }
00129 ~LevelSetFunctionBase() {}
00130
00131 void PrintSelf(std::ostream& os, Indent indent) const;
00132
00135 static VectorType InitializeZeroVectorConstant();
00136
00138 static VectorType m_ZeroVectorConstant;
00139
00141 ScalarValueType m_EpsilonMagnitude;
00142
00144 ScalarValueType m_AdvectionWeight;
00145
00147 ScalarValueType m_PropagationWeight;
00148
00150 ScalarValueType m_CurvatureWeight;
00151
00152 private:
00153 LevelSetFunctionBase(const Self&);
00154 void operator=(const Self&);
00155 };
00156
00157 }
00158
00159 #ifndef ITK_MANUAL_INSTANTIATION
00160 #include "itkLevelSetFunctionBase.txx"
00161 #endif
00162
00163 #endif
00164
00165
00166
00167