00001 /*========================================================================= 00002 00003 Program: Insight Segmentation & Registration Toolkit 00004 Module: $RCSfile: itkLevelSetFunctionBase.h,v $ 00005 Language: C++ 00006 Date: $Date: 2002/12/17 17:50:35 $ 00007 Version: $Revision: 1.8 $ 00008 00009 Copyright (c) 2002 Insight Consortium. All rights reserved. 00010 See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details. 00011 00012 This software is distributed WITHOUT ANY WARRANTY; without even 00013 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00014 PURPOSE. See the above copyright notices for more information. 00015 00016 =========================================================================*/ 00017 #ifndef __itkLevelSetFunctionBase_h_ 00018 #define __itkLevelSetFunctionBase_h_ 00019 00020 #include "itkFiniteDifferenceFunction.h" 00021 //#include "itkVector.h" 00022 #include "itkFixedArray.h" 00023 00024 namespace itk { 00025 00034 template <class TImageType> 00035 class LevelSetFunctionBase : public FiniteDifferenceFunction<TImageType> 00036 { 00037 public: 00039 typedef LevelSetFunctionBase Self; 00040 typedef FiniteDifferenceFunction<TImageType> Superclass; 00041 typedef SmartPointer<Self> Pointer; 00042 typedef SmartPointer<const Self> ConstPointer; 00043 00045 itkTypeMacro( LevelSetFunctionBase, FiniteDifferenceFunction ); 00046 00048 itkStaticConstMacro(ImageDimension, unsigned int,Superclass::ImageDimension); 00049 00051 typedef double TimeStepType; 00052 typedef typename Superclass::ImageType ImageType; 00053 typedef typename Superclass::PixelType PixelType; 00054 typedef PixelType ScalarValueType; 00055 typedef typename Superclass::RadiusType RadiusType; 00056 typedef typename Superclass::NeighborhoodType NeighborhoodType; 00057 typedef typename Superclass::FloatOffsetType FloatOffsetType; 00058 00060 // typedef 00061 // Vector<ScalarValueType, itkGetStaticConstMacro(ImageDimension)> VectorType; 00062 typedef FixedArray<ScalarValueType, itkGetStaticConstMacro(ImageDimension)> VectorType; 00063 00065 virtual VectorType AdvectionField(const NeighborhoodType &, 00066 const FloatOffsetType &) const 00067 { return m_ZeroVectorConstant; } 00068 00071 virtual ScalarValueType PropagationSpeed( 00072 const NeighborhoodType& , 00073 const FloatOffsetType & ) const 00074 { return NumericTraits<ScalarValueType>::Zero; } 00075 00078 virtual ScalarValueType CurvatureSpeed(const NeighborhoodType &, 00079 const FloatOffsetType & 00080 ) const 00081 { return NumericTraits<ScalarValueType>::One; } 00082 00084 void SetAdvectionWeight(const ScalarValueType a) 00085 { m_AdvectionWeight = a; } 00086 ScalarValueType GetAdvectionWeight() const 00087 { return m_AdvectionWeight; } 00088 00090 void SetPropagationWeight(const ScalarValueType p) 00091 { m_PropagationWeight = p; } 00092 ScalarValueType GetPropagationWeight() const 00093 { return m_PropagationWeight; } 00094 00096 void SetCurvatureWeight(const ScalarValueType c) 00097 { m_CurvatureWeight = c; } 00098 ScalarValueType GetCurvatureWeight() const 00099 { return m_CurvatureWeight; } 00100 00102 void SetEpsilonMagnitude(const ScalarValueType e) 00103 { m_EpsilonMagnitude = e; } 00104 ScalarValueType GetEpsilonMagnitude() const 00105 { return m_EpsilonMagnitude; } 00106 00107 virtual void Initialize(const RadiusType &r) =0; 00108 00109 protected: 00110 LevelSetFunctionBase() 00111 { 00112 m_EpsilonMagnitude = 1.0e-5; 00113 m_AdvectionWeight = m_PropagationWeight = m_CurvatureWeight = 00114 NumericTraits<ScalarValueType>::Zero; 00115 } 00116 ~LevelSetFunctionBase() {} 00117 00118 void PrintSelf(std::ostream& os, Indent indent) const; 00119 00122 static VectorType InitializeZeroVectorConstant(); 00123 00125 static VectorType m_ZeroVectorConstant; 00126 00128 ScalarValueType m_EpsilonMagnitude; 00129 00131 ScalarValueType m_AdvectionWeight; 00132 00134 ScalarValueType m_PropagationWeight; 00135 00137 ScalarValueType m_CurvatureWeight; 00138 00139 private: 00140 LevelSetFunctionBase(const Self&); //purposely not implemented 00141 void operator=(const Self&); //purposely not implemented 00142 }; 00143 00144 } // namespace itk 00145 00146 #ifndef ITK_MANUAL_INSTANTIATION 00147 #include "itkLevelSetFunctionBase.txx" 00148 #endif 00149 00150 #endif 00151 00152 00153 00154