Main Page   Groups   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Concepts

itkLevelSetFunction.h

Go to the documentation of this file.
00001 /*========================================================================= 00002 00003 Program: Insight Segmentation & Registration Toolkit 00004 Module: $RCSfile: itkLevelSetFunction.h,v $ 00005 Language: C++ 00006 Date: $Date: 2003/09/10 14:29:14 $ 00007 Version: $Revision: 1.21 $ 00008 00009 Copyright (c) Insight Software 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 __itkLevelSetFunction_h_ 00018 #define __itkLevelSetFunction_h_ 00019 00020 #include "itkFiniteDifferenceFunction.h" 00021 #include "vnl/vnl_matrix_fixed.h" 00022 00023 namespace itk { 00024 00063 template <class TImageType> 00064 class ITK_EXPORT LevelSetFunction 00065 : public FiniteDifferenceFunction<TImageType> 00066 { 00067 public: 00069 typedef LevelSetFunction Self; 00070 typedef FiniteDifferenceFunction<TImageType> Superclass; 00071 typedef SmartPointer<Self> Pointer; 00072 typedef SmartPointer<const Self> ConstPointer; 00073 00075 itkNewMacro(Self); 00076 00078 itkTypeMacro( LevelSetFunction, FiniteDifferenceFunction ); 00079 00081 itkStaticConstMacro(ImageDimension, unsigned int,Superclass::ImageDimension); 00082 00084 typedef double TimeStepType; 00085 typedef typename Superclass::ImageType ImageType; 00086 typedef typename Superclass::PixelType PixelType; 00087 typedef PixelType ScalarValueType; 00088 typedef typename Superclass::RadiusType RadiusType; 00089 typedef typename Superclass::NeighborhoodType NeighborhoodType; 00090 typedef typename Superclass::FloatOffsetType FloatOffsetType; 00091 00093 // typedef 00094 typedef FixedArray<ScalarValueType, itkGetStaticConstMacro(ImageDimension)> VectorType; 00095 00101 struct GlobalDataStruct 00102 { 00103 ScalarValueType m_MaxAdvectionChange; 00104 ScalarValueType m_MaxPropagationChange; 00105 ScalarValueType m_MaxCurvatureChange; 00106 00108 vnl_matrix_fixed<ScalarValueType, 00109 itkGetStaticConstMacro(ImageDimension), 00110 itkGetStaticConstMacro(ImageDimension)> m_dxy; 00111 00113 ScalarValueType m_dx[itkGetStaticConstMacro(ImageDimension)]; 00114 00115 ScalarValueType m_dx_forward[itkGetStaticConstMacro(ImageDimension)]; 00116 ScalarValueType m_dx_backward[itkGetStaticConstMacro(ImageDimension)]; 00117 00118 ScalarValueType m_GradMagSqr; 00119 }; 00120 00122 virtual VectorType AdvectionField(const NeighborhoodType &, 00123 const FloatOffsetType &, GlobalDataStruct * = 0) const 00124 { return m_ZeroVectorConstant; } 00125 00128 virtual ScalarValueType PropagationSpeed( 00129 const NeighborhoodType& , 00130 const FloatOffsetType &, GlobalDataStruct * = 0 ) const 00131 { return NumericTraits<ScalarValueType>::Zero; } 00132 00135 virtual ScalarValueType CurvatureSpeed(const NeighborhoodType &, 00136 const FloatOffsetType &, GlobalDataStruct * = 0 00137 ) const 00138 { return NumericTraits<ScalarValueType>::One; } 00139 00142 virtual ScalarValueType LaplacianSmoothingSpeed( 00143 const NeighborhoodType &, 00144 const FloatOffsetType &, GlobalDataStruct * = 0) const 00145 { return NumericTraits<ScalarValueType>::One; } 00146 00148 void SetAdvectionWeight(const ScalarValueType a) 00149 { m_AdvectionWeight = a; } 00150 ScalarValueType GetAdvectionWeight() const 00151 { return m_AdvectionWeight; } 00152 00154 void SetPropagationWeight(const ScalarValueType p) 00155 { m_PropagationWeight = p; } 00156 ScalarValueType GetPropagationWeight() const 00157 { return m_PropagationWeight; } 00158 00160 void SetCurvatureWeight(const ScalarValueType c) 00161 { m_CurvatureWeight = c; } 00162 ScalarValueType GetCurvatureWeight() const 00163 { return m_CurvatureWeight; } 00164 00166 void SetLaplacianSmoothingWeight(const ScalarValueType c) 00167 { m_LaplacianSmoothingWeight = c; } 00168 ScalarValueType GetLaplacianSmoothingWeight() const 00169 { return m_LaplacianSmoothingWeight; } 00170 00172 void SetEpsilonMagnitude(const ScalarValueType e) 00173 { m_EpsilonMagnitude = e; } 00174 ScalarValueType GetEpsilonMagnitude() const 00175 { return m_EpsilonMagnitude; } 00176 00178 virtual PixelType ComputeUpdate(const NeighborhoodType &neighborhood, 00179 void *globalData, 00180 const FloatOffsetType& = FloatOffsetType(0.0)); 00181 00188 virtual TimeStepType ComputeGlobalTimeStep(void *GlobalData) const; 00189 00197 virtual void *GetGlobalDataPointer() const 00198 { 00199 GlobalDataStruct *ans = new GlobalDataStruct(); 00200 ans->m_MaxAdvectionChange = NumericTraits<ScalarValueType>::Zero; 00201 ans->m_MaxPropagationChange = NumericTraits<ScalarValueType>::Zero; 00202 ans->m_MaxCurvatureChange = NumericTraits<ScalarValueType>::Zero; 00203 return ans; 00204 } 00205 00209 virtual void Initialize(const RadiusType &r); 00210 00215 virtual void ReleaseGlobalDataPointer(void *GlobalData) const 00216 { delete (GlobalDataStruct *) GlobalData; } 00217 00219 virtual ScalarValueType ComputeCurvatureTerm(const NeighborhoodType &, 00220 const FloatOffsetType &, 00221 GlobalDataStruct *gd = 0 00222 ); 00223 virtual ScalarValueType ComputeMeanCurvature(const NeighborhoodType &, 00224 const FloatOffsetType &, 00225 GlobalDataStruct *gd = 0 00226 ); 00227 00228 virtual ScalarValueType ComputeMinimalCurvature(const NeighborhoodType &, 00229 const FloatOffsetType &, 00230 GlobalDataStruct *gd = 0 00231 ); 00232 00233 virtual ScalarValueType Compute3DMinimalCurvature(const NeighborhoodType &, 00234 const FloatOffsetType &, 00235 GlobalDataStruct *gd = 0 00236 ); 00237 00239 void SetUseMinimalCurvature( bool b ) 00240 { 00241 m_UseMinimalCurvature = b; 00242 } 00243 bool GetUseMinimalCurvature() const 00244 { 00245 return m_UseMinimalCurvature; 00246 } 00247 void UseMinimalCurvatureOn() 00248 { 00249 this->SetUseMinimalCurvature(true); 00250 } 00251 void UseMinimalCurvatureOff() 00252 { 00253 this->SetUseMinimalCurvature(false); 00254 } 00255 00260 static void SetMaximumCurvatureTimeStep(double n) 00261 { 00262 m_DT = n; 00263 } 00264 static double GetMaximumCurvatureTimeStep() 00265 { 00266 return m_DT; 00267 } 00268 00273 static void SetMaximumPropagationTimeStep(double n) 00274 { 00275 m_WaveDT = n; 00276 } 00277 static double GetMaximumPropagationTimeStep() 00278 { 00279 return m_WaveDT; 00280 } 00281 00282 protected: 00283 LevelSetFunction() 00284 { 00285 m_EpsilonMagnitude = 1.0e-5; 00286 m_AdvectionWeight = m_PropagationWeight 00287 = m_CurvatureWeight = m_LaplacianSmoothingWeight 00288 = NumericTraits<ScalarValueType>::Zero; 00289 m_UseMinimalCurvature = false; 00290 } 00291 virtual ~LevelSetFunction() {} 00292 void PrintSelf(std::ostream &s, Indent indent) const; 00293 00295 static double m_WaveDT; 00296 static double m_DT; 00297 00299 std::slice x_slice[itkGetStaticConstMacro(ImageDimension)]; 00300 00302 ::size_t m_Center; 00303 00305 ::size_t m_xStride[itkGetStaticConstMacro(ImageDimension)]; 00306 00307 bool m_UseMinimalCurvature; 00308 00311 static VectorType InitializeZeroVectorConstant(); 00312 00314 static VectorType m_ZeroVectorConstant; 00315 00317 ScalarValueType m_EpsilonMagnitude; 00318 00320 ScalarValueType m_AdvectionWeight; 00321 00323 ScalarValueType m_PropagationWeight; 00324 00326 ScalarValueType m_CurvatureWeight; 00327 00329 ScalarValueType m_LaplacianSmoothingWeight; 00330 00331 private: 00332 LevelSetFunction(const Self&); //purposely not implemented 00333 void operator=(const Self&); //purposely not implemented 00334 }; 00335 00336 } // namespace itk 00337 00338 #ifndef ITK_MANUAL_INSTANTIATION 00339 #include "itkLevelSetFunction.txx" 00340 #endif 00341 00342 #endif 00343

Generated at Sat Mar 31 02:23:45 2007 for ITK by doxygen 1.3.8 written by Dimitri van Heesch, © 1997-2000