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; }
00098
00101 void SetShapeFunction( const ShapeFunctionType * ptr )
00102 { m_ShapeFunction = ptr; }
00103 const ShapeFunctionType * GetShapeFunction() const
00104 { return m_ShapeFunction; }
00106
00107
00109 virtual PixelType ComputeUpdate(const NeighborhoodType &neighborhood,
00110 void *globalData,
00111 const FloatOffsetType& = FloatOffsetType(0.0));
00112
00114 virtual TimeStepType ComputeGlobalTimeStep( void *globalData ) const;
00115
00117 typedef typename Superclass::GlobalDataStruct GlobalDataStruct;
00118 struct ShapePriorGlobalDataStruct : public GlobalDataStruct
00119 {
00120 ScalarValueType m_MaxShapePriorChange;
00121 };
00122
00124 virtual void *GetGlobalDataPointer() const
00125 {
00126 ShapePriorGlobalDataStruct *ans = new ShapePriorGlobalDataStruct();
00127 ans->m_MaxAdvectionChange = NumericTraits<ScalarValueType>::Zero;
00128 ans->m_MaxPropagationChange = NumericTraits<ScalarValueType>::Zero;
00129 ans->m_MaxCurvatureChange = NumericTraits<ScalarValueType>::Zero;
00130 ans->m_MaxShapePriorChange = NumericTraits<ScalarValueType>::Zero;
00131 return ans;
00132 }
00134
00136 virtual void ReleaseGlobalDataPointer(void *GlobalData) const
00137 { delete (ShapePriorGlobalDataStruct *) GlobalData; }
00138
00139 protected:
00140 ShapePriorSegmentationLevelSetFunction();
00141 virtual ~ShapePriorSegmentationLevelSetFunction() {}
00142
00143 ShapePriorSegmentationLevelSetFunction(const Self&);
00144 void operator=(const Self&);
00145
00146 void PrintSelf(std::ostream& os, Indent indent) const;
00147
00148 private:
00149
00150 ShapeFunctionPointer m_ShapeFunction;
00151 ScalarValueType m_ShapePriorWeight;
00152
00153 };
00154
00155 }
00156
00157 #ifndef ITK_MANUAL_INSTANTIATION
00158 #include "itkShapePriorSegmentationLevelSetFunction.txx"
00159 #endif
00160
00161 #endif
00162