00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef __itkSegmentationLevelSetFunction_h_
00018 #define __itkSegmentationLevelSetFunction_h_
00019
00020 #include "itkLevelSetFunction.h"
00021
00022 namespace itk {
00023
00041 template <class TImageType, class TFeatureImageType = TImageType>
00042 class ITK_EXPORT SegmentationLevelSetFunction
00043 : public LevelSetFunction<TImageType>
00044 {
00045 public:
00047 typedef SegmentationLevelSetFunction Self;
00048 typedef LevelSetFunction<TImageType> Superclass;
00049 typedef SmartPointer<Self> Pointer;
00050 typedef SmartPointer<const Self> ConstPointer;
00051
00053 itkTypeMacro( SegmentationLevelSetFunction, LevelSetFunction );
00054
00055
00056
00058 typedef typename Superclass::ImageType ImageType;
00059 typedef typename Superclass::RadiusType RadiusType;
00060 typedef TFeatureImageType FeatureImageType;
00061 typedef typename Superclass::BoundaryNeighborhoodType BoundaryNeighborhoodType;
00062 typedef typename Superclass::FloatOffsetType FloatOffsetType;
00063 typedef typename Superclass::ScalarValueType ScalarValueType;
00064 typedef typename Superclass::NeighborhoodType NeighborhoodType;
00065 typedef typename FeatureImageType::PixelType FeatureScalarType;
00066 typedef typename ImageType::IndexType IndexType;
00067
00068
00070 itkStaticConstMacro(ImageDimension, unsigned int,Superclass::ImageDimension);
00071
00073 virtual FeatureImageType *GetFeatureImage() const
00074 { return m_FeatureImage.GetPointer(); }
00075 virtual void SetFeatureImage(FeatureImageType *f)
00076 { m_FeatureImage = f; }
00077
00079 virtual ImageType *GetSpeedImage() const
00080 { return m_SpeedImage.GetPointer(); }
00081
00085 virtual void Initialize(const RadiusType &r);
00086
00091 virtual void CalculateSpeedImage() = 0;
00092
00095 virtual void AllocateSpeedImage();
00096
00097 protected:
00099 typename FeatureImageType::Pointer m_FeatureImage;
00100 typename ImageType::Pointer m_SpeedImage;
00101
00103 virtual ScalarValueType PropagationSpeed(
00104 const NeighborhoodType& neighborhood,
00105 const FloatOffsetType
00106 ) const
00107 {
00108 IndexType idx = neighborhood.GetIndex();
00109 return m_SpeedImage->GetPixel(idx);
00110 }
00111
00113 virtual ScalarValueType PropagationSpeed(const BoundaryNeighborhoodType
00114 &neighborhood, const FloatOffsetType &
00115 ) const
00116 {
00117 IndexType idx = neighborhood.GetIndex();
00118 return m_SpeedImage->GetPixel(idx);
00119 }
00120
00121 virtual ~SegmentationLevelSetFunction() {}
00122 SegmentationLevelSetFunction()
00123 { m_SpeedImage = ImageType::New(); }
00124 };
00125
00126 }
00127
00128 #ifndef ITK_MANUAL_INSTANTIATION
00129 #include "itkSegmentationLevelSetFunction.txx"
00130 #endif
00131
00132 #endif