00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef __itkShapePriorSegmentationLevelSetFunction_h
00018 #define __itkShapePriorSegmentationLevelSetFunction_h
00019
00020 #include "itkSegmentationLevelSetFunction.h"
00021 #include "itkShapeSignedDistanceFunction.h"
00022
00023 namespace itk {
00024
00052 template <class TImageType, class TFeatureImageType = TImageType>
00053 class ITK_EXPORT ShapePriorSegmentationLevelSetFunction
00054 : public SegmentationLevelSetFunction<TImageType, TFeatureImageType>
00055 {
00056 public:
00058 typedef ShapePriorSegmentationLevelSetFunction Self;
00059 typedef SegmentationLevelSetFunction<TImageType,TFeatureImageType>
00060 Superclass;
00061 typedef SmartPointer<Self> Pointer;
00062 typedef SmartPointer<const Self> ConstPointer;
00063 typedef TFeatureImageType FeatureImageType;
00064
00066 itkNewMacro(Self);
00067
00069 itkTypeMacro( ShapePriorSegmentationLevelSetFunction, SegmentationLevelSetFunction );
00070
00072 typedef typename Superclass::ImageType ImageType;
00073 typedef typename Superclass::NeighborhoodType NeighborhoodType;
00074 typedef typename Superclass::ScalarValueType ScalarValueType;
00075 typedef typename Superclass::FeatureScalarType FeatureScalarType;
00076 typedef typename Superclass::RadiusType RadiusType;
00077 typedef typename Superclass::FloatOffsetType FloatOffsetType;
00078 typedef typename Superclass::VectorImageType VectorImageType;
00079 typedef typename Superclass::PixelType PixelType;
00080 typedef typename Superclass::TimeStepType TimeStepType;
00081 typedef typename Superclass::IndexType IndexType;
00082 typedef typename Superclass::ContinuousIndexType ContinuousIndexType;
00083
00085 itkStaticConstMacro(ImageDimension, unsigned int,
00086 Superclass::ImageDimension);
00087
00089 typedef ShapeSignedDistanceFunction<double,
00090 itkGetStaticConstMacro(ImageDimension)> ShapeFunctionType;
00091 typedef typename ShapeFunctionType::ConstPointer ShapeFunctionPointer;
00092
00094 void SetShapePriorWeight( const ScalarValueType p )
00095 { m_ShapePriorWeight = p; }
00096 ScalarValueType GetShapePriorWeight() const
00097 { return m_ShapePriorWeight; }
00099
00102 void SetShapeFunction( const ShapeFunctionType * ptr )
00103 { m_ShapeFunction = ptr; }
00104 const ShapeFunctionType * GetShapeFunction() const
00105 { return m_ShapeFunction; }
00107
00108
00110 virtual PixelType ComputeUpdate(const NeighborhoodType &neighborhood,
00111 void *globalData,
00112 const FloatOffsetType& = FloatOffsetType(0.0));
00113
00115 virtual TimeStepType ComputeGlobalTimeStep( void *globalData ) const;
00116
00118 typedef typename Superclass::GlobalDataStruct GlobalDataStruct;
00119 struct ShapePriorGlobalDataStruct : public GlobalDataStruct
00120 {
00121 ScalarValueType m_MaxShapePriorChange;
00122 };
00123
00125 virtual void *GetGlobalDataPointer() const
00126 {
00127 ShapePriorGlobalDataStruct *ans = new ShapePriorGlobalDataStruct();
00128 ans->m_MaxAdvectionChange = NumericTraits<ScalarValueType>::Zero;
00129 ans->m_MaxPropagationChange = NumericTraits<ScalarValueType>::Zero;
00130 ans->m_MaxCurvatureChange = NumericTraits<ScalarValueType>::Zero;
00131 ans->m_MaxShapePriorChange = NumericTraits<ScalarValueType>::Zero;
00132 return ans;
00133 }
00135
00137 virtual void ReleaseGlobalDataPointer(void *GlobalData) const
00138 { delete (ShapePriorGlobalDataStruct *) GlobalData; }
00139
00140 protected:
00141 ShapePriorSegmentationLevelSetFunction();
00142 virtual ~ShapePriorSegmentationLevelSetFunction() {}
00143
00144 ShapePriorSegmentationLevelSetFunction(const Self&);
00145 void operator=(const Self&);
00146
00147 void PrintSelf(std::ostream& os, Indent indent) const;
00148
00149 private:
00150
00151 ShapeFunctionPointer m_ShapeFunction;
00152 ScalarValueType m_ShapePriorWeight;
00153
00154 };
00155
00156 }
00157
00158 #ifndef ITK_MANUAL_INSTANTIATION
00159 #include "itkShapePriorSegmentationLevelSetFunction.txx"
00160 #endif
00161
00162 #endif
00163