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> Superclass;
00060 typedef SmartPointer<Self> Pointer;
00061 typedef SmartPointer<const Self> ConstPointer;
00062 typedef TFeatureImageType FeatureImageType;
00063
00065 itkNewMacro(Self);
00066
00068 itkTypeMacro( ShapePriorSegmentationLevelSetFunction, SegmentationLevelSetFunction );
00069
00071 typedef typename Superclass::ImageType ImageType;
00072 typedef typename Superclass::NeighborhoodType NeighborhoodType;
00073 typedef typename Superclass::ScalarValueType ScalarValueType;
00074 typedef typename Superclass::FeatureScalarType FeatureScalarType;
00075 typedef typename Superclass::RadiusType RadiusType;
00076 typedef typename Superclass::FloatOffsetType FloatOffsetType;
00077 typedef typename Superclass::VectorImageType VectorImageType;
00078 typedef typename Superclass::PixelType PixelType;
00079 typedef typename Superclass::TimeStepType TimeStepType;
00080 typedef typename Superclass::IndexType IndexType;
00081 typedef typename Superclass::ContinuousIndexType ContinuousIndexType;
00082
00084 itkStaticConstMacro(ImageDimension, unsigned int,
00085 Superclass::ImageDimension);
00086
00088 typedef ShapeSignedDistanceFunction<double,
00089 itkGetStaticConstMacro(ImageDimension)> ShapeFunctionType;
00090 typedef typename ShapeFunctionType::ConstPointer ShapeFunctionPointer;
00091
00093 void SetShapePriorWeight( const ScalarValueType p )
00094 { m_ShapePriorWeight = p; }
00095 ScalarValueType GetShapePriorWeight() const
00096 { return m_ShapePriorWeight; }
00097
00100 void SetShapeFunction( const ShapeFunctionType * ptr )
00101 { m_ShapeFunction = ptr; }
00102 const ShapeFunctionType * GetShapeFunction() const
00103 { return m_ShapeFunction; }
00104
00105
00107 virtual PixelType ComputeUpdate(const NeighborhoodType &neighborhood,
00108 void *globalData,
00109 const FloatOffsetType& = FloatOffsetType(0.0));
00110
00112 virtual TimeStepType ComputeGlobalTimeStep( void *globalData ) const;
00113
00115 typedef typename Superclass::GlobalDataStruct GlobalDataStruct;
00116 struct ShapePriorGlobalDataStruct : public GlobalDataStruct
00117 {
00118 ScalarValueType m_MaxShapePriorChange;
00119 };
00120
00122 virtual void *GetGlobalDataPointer() const
00123 {
00124 ShapePriorGlobalDataStruct *ans = new ShapePriorGlobalDataStruct();
00125 ans->m_MaxAdvectionChange = NumericTraits<ScalarValueType>::Zero;
00126 ans->m_MaxPropagationChange = NumericTraits<ScalarValueType>::Zero;
00127 ans->m_MaxCurvatureChange = NumericTraits<ScalarValueType>::Zero;
00128 ans->m_MaxShapePriorChange = NumericTraits<ScalarValueType>::Zero;
00129 return ans;
00130 }
00131
00133 virtual void ReleaseGlobalDataPointer(void *GlobalData) const
00134 { delete (ShapePriorGlobalDataStruct *) GlobalData; }
00135
00136 protected:
00137 ShapePriorSegmentationLevelSetFunction();
00138 virtual ~ShapePriorSegmentationLevelSetFunction() {}
00139
00140 ShapePriorSegmentationLevelSetFunction(const Self&);
00141 void operator=(const Self&);
00142
00143 void PrintSelf(std::ostream& os, Indent indent) const;
00144
00145 private:
00146
00147 ShapeFunctionPointer m_ShapeFunction;
00148 ScalarValueType m_ShapePriorWeight;
00149
00150 };
00151
00152 }
00153
00154 #ifndef ITK_MANUAL_INSTANTIATION
00155 #include "itkShapePriorSegmentationLevelSetFunction.txx"
00156 #endif
00157
00158 #endif