00001 /*========================================================================= 00002 00003 Program: Insight Segmentation & Registration Toolkit 00004 Module: $RCSfile: itkLevelSetFunctionWithRefitTerm.h,v $ 00005 Language: C++ 00006 Date: $Date: 2003/09/10 14:28:51 $ 00007 Version: $Revision: 1.5 $ 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 __itkLevelSetFunctionWithRefitTerm_h_ 00018 #define __itkLevelSetFunctionWithRefitTerm_h_ 00019 00020 #include "itkLevelSetFunction.h" 00021 #include "itkSparseImage.h" 00022 #include "itkNumericTraits.h" 00023 00024 namespace itk { 00025 00049 template <class TImageType, class TSparseImageType> 00050 class ITK_EXPORT LevelSetFunctionWithRefitTerm 00051 : public LevelSetFunction<TImageType> 00052 { 00053 public: 00055 typedef LevelSetFunctionWithRefitTerm Self; 00056 typedef LevelSetFunction<TImageType> Superclass; 00057 typedef SmartPointer<Self> Pointer; 00058 typedef SmartPointer<const Self> ConstPointer; 00059 00061 itkTypeMacro( LevelSetFunctionWithRefitTerm, LevelSetFunction ); 00062 00064 itkNewMacro (Self); 00065 00067 typedef typename Superclass::ImageType ImageType; 00068 typedef typename Superclass::FloatOffsetType FloatOffsetType; 00069 typedef typename Superclass::ScalarValueType ScalarValueType; 00070 typedef typename Superclass::GlobalDataStruct GlobalDataStruct; 00071 typedef typename Superclass::NeighborhoodType NeighborhoodType; 00072 typedef typename Superclass::TimeStepType TimeStepType; 00073 00075 typedef typename ImageType::IndexType IndexType; 00076 00078 typedef TSparseImageType SparseImageType; 00079 00081 typedef typename SparseImageType::NodeType NodeType; 00082 00084 typedef typename NodeType::NodeDataType NormalVectorType; 00085 00087 void SetRefitWeight( const ScalarValueType w ) 00088 { 00089 m_RefitWeight = w; 00090 } 00091 00094 void SetOtherPropagationWeight( const ScalarValueType w ) 00095 { 00096 m_OtherPropagationWeight = w; 00097 } 00098 00101 void SetSparseTargetImage( SparseImageType *im ) 00102 { m_SparseTargetImage = im; } 00103 00105 SparseImageType* GetSparseTargetImage() const 00106 { return m_SparseTargetImage; } 00107 00112 virtual TimeStepType ComputeGlobalTimeStep( void *GlobalData ) const; 00113 00114 protected: 00116 ScalarValueType m_RefitWeight; 00117 00120 ScalarValueType m_OtherPropagationWeight; 00121 00122 LevelSetFunctionWithRefitTerm (); 00123 void PrintSelf(std::ostream& os, Indent indent) const; 00124 00127 ScalarValueType ComputeCurvature( const NeighborhoodType & ) const; 00128 00132 virtual ScalarValueType PropagationSpeed(const NeighborhoodType& , 00133 const FloatOffsetType &, 00134 GlobalDataStruct * = 0 ) const; 00135 00139 virtual ScalarValueType OtherPropagationSpeed(const NeighborhoodType& , 00140 const FloatOffsetType &, 00141 GlobalDataStruct * = 0) const 00142 { 00143 return NumericTraits<ScalarValueType>::Zero; 00144 } 00145 00146 private: 00148 typename SparseImageType::Pointer m_SparseTargetImage; 00149 00151 ScalarValueType m_MinVectorNorm; 00152 00154 static const unsigned long m_NumVertex; 00155 static const ScalarValueType m_DimConst; 00156 }; 00157 00158 } // end namespace itk 00159 00160 #ifndef ITK_MANUAL_INSTANTIATION 00161 #include "itkLevelSetFunctionWithRefitTerm.txx" 00162 #endif 00163 00164 #endif