00001 /*========================================================================= 00002 00003 Program: Insight Segmentation & Registration Toolkit 00004 Module: $RCSfile: itkLevelSetFunctionWithRefitTerm.h,v $ 00005 Language: C++ 00006 Date: $Date: 2008-10-16 17:40:09 $ 00007 Version: $Revision: 1.8 $ 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: 00054 00056 typedef LevelSetFunctionWithRefitTerm Self; 00057 typedef LevelSetFunction<TImageType> Superclass; 00058 typedef SmartPointer<Self> Pointer; 00059 typedef SmartPointer<const Self> ConstPointer; 00060 00062 itkTypeMacro( LevelSetFunctionWithRefitTerm, LevelSetFunction ); 00063 00065 itkNewMacro (Self); 00066 00068 typedef typename Superclass::ImageType ImageType; 00069 typedef typename Superclass::FloatOffsetType FloatOffsetType; 00070 typedef typename Superclass::ScalarValueType ScalarValueType; 00071 typedef typename Superclass::GlobalDataStruct GlobalDataStruct; 00072 typedef typename Superclass::NeighborhoodType NeighborhoodType; 00073 typedef typename Superclass::NeighborhoodScalesType NeighborhoodScalesType; 00074 typedef typename Superclass::TimeStepType TimeStepType; 00075 00077 typedef typename ImageType::IndexType IndexType; 00078 00080 typedef TSparseImageType SparseImageType; 00081 00083 typedef typename SparseImageType::NodeType NodeType; 00084 00086 typedef typename NodeType::NodeDataType NormalVectorType; 00087 00089 void SetRefitWeight( const ScalarValueType w ) 00090 { 00091 m_RefitWeight = w; 00092 } 00093 00096 void SetOtherPropagationWeight( const ScalarValueType w ) 00097 { 00098 m_OtherPropagationWeight = w; 00099 } 00100 00103 void SetSparseTargetImage( SparseImageType *im ) 00104 { m_SparseTargetImage = im; } 00105 00107 SparseImageType* GetSparseTargetImage() const 00108 { return m_SparseTargetImage; } 00109 00114 virtual TimeStepType ComputeGlobalTimeStep( void *GlobalData ) const; 00115 00116 protected: 00118 ScalarValueType m_RefitWeight; 00119 00122 ScalarValueType m_OtherPropagationWeight; 00123 00124 LevelSetFunctionWithRefitTerm (); 00125 void PrintSelf(std::ostream& os, Indent indent) const; 00126 00129 ScalarValueType ComputeCurvature( const NeighborhoodType & ) const; 00130 00134 virtual ScalarValueType PropagationSpeed(const NeighborhoodType& , 00135 const FloatOffsetType &, 00136 GlobalDataStruct * = 0 ) const; 00137 00141 virtual ScalarValueType OtherPropagationSpeed(const NeighborhoodType& , 00142 const FloatOffsetType &, 00143 GlobalDataStruct * = 0) const 00144 { 00145 return NumericTraits<ScalarValueType>::Zero; 00146 } 00147 00148 private: 00149 LevelSetFunctionWithRefitTerm(const Self&); //purposely not implemented 00150 void operator=(const Self&); //purposely not implemented 00151 00153 typename SparseImageType::Pointer m_SparseTargetImage; 00154 00156 ScalarValueType m_MinVectorNorm; 00157 00159 static const unsigned long m_NumVertex; 00160 static const ScalarValueType m_DimConst; 00161 }; 00162 00163 } // end namespace itk 00164 00165 #ifndef ITK_MANUAL_INSTANTIATION 00166 #include "itkLevelSetFunctionWithRefitTerm.txx" 00167 #endif 00168 00169 #endif 00170