00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef __itkCannySegmentationLevelSetFunction_h_
00018 #define __itkCannySegmentationLevelSetFunction_h_
00019
00020 #include "itkSegmentationLevelSetFunction.h"
00021 #include "itkCastImageFilter.h"
00022 #include "itkCannyEdgeDetectionImageFilter.h"
00023 #include "itkDanielssonDistanceMapImageFilter.h"
00024
00025 namespace itk {
00026
00032 template <class TImageType, class TFeatureImageType = TImageType>
00033 class ITK_EXPORT CannySegmentationLevelSetFunction
00034 : public SegmentationLevelSetFunction<TImageType, TFeatureImageType>
00035 {
00036 public:
00038 typedef CannySegmentationLevelSetFunction Self;
00039 typedef SegmentationLevelSetFunction<TImageType, TFeatureImageType> Superclass;
00040 typedef SmartPointer<Self> Pointer;
00041 typedef SmartPointer<const Self> ConstPointer;
00042 typedef TFeatureImageType FeatureImageType;
00043
00045 itkNewMacro(Self);
00046
00048 itkTypeMacro( CannySegmentationLevelSetFunction, SegmentationLevelSetFunction );
00049
00051 typedef typename Superclass::ImageType ImageType;
00052 typedef typename Superclass::ScalarValueType ScalarValueType;
00053 typedef typename Superclass::VectorImageType VectorImageType;
00054 typedef typename Superclass::FeatureScalarType FeatureScalarType;
00055 typedef typename Superclass::RadiusType RadiusType;
00056
00058 itkStaticConstMacro(ImageDimension, unsigned int,
00059 Superclass::ImageDimension);
00060
00062 void SetThreshold(ScalarValueType v)
00063 { m_Threshold = v; }
00064 ScalarValueType GetThreshold() const
00065 { return m_Threshold; }
00066
00068 void SetVariance(double v)
00069 { m_Variance = v; }
00070 double GetVariance() const
00071 { return m_Variance; }
00072
00075 virtual void CalculateSpeedImage();
00076
00079 virtual void CalculateAdvectionImage();
00080
00083 virtual void CalculateDistanceImage();
00084
00085 virtual void Initialize(const RadiusType &r)
00086 {
00087 Superclass::Initialize(r);
00088
00089 this->SetAdvectionWeight(-1.0 * NumericTraits<ScalarValueType>::One);
00090 this->SetPropagationWeight(-1.0 * NumericTraits<ScalarValueType>::One);
00091 this->SetCurvatureWeight(NumericTraits<ScalarValueType>::One);
00092 }
00093
00094 ImageType *GetCannyImage()
00095 { return m_Canny->GetOutput(); }
00096
00097 protected:
00098 CannySegmentationLevelSetFunction()
00099 {
00100 m_Variance = 0.0;
00101 m_Threshold = NumericTraits<ScalarValueType>::Zero;
00102 m_Caster = CastImageFilter<FeatureImageType,ImageType>::New();
00103 m_Canny = CannyEdgeDetectionImageFilter<ImageType,ImageType>::New();
00104 m_Distance = DanielssonDistanceMapImageFilter<ImageType,ImageType>::New();
00105 }
00106 virtual ~CannySegmentationLevelSetFunction() {}
00107
00108 CannySegmentationLevelSetFunction(const Self&);
00109 void operator=(const Self&);
00110
00111 private:
00112 ScalarValueType m_Variance;
00113 double m_Threshold;
00114 typename CannyEdgeDetectionImageFilter<ImageType,ImageType>::Pointer m_Canny;
00115 typename DanielssonDistanceMapImageFilter<ImageType,ImageType>::Pointer m_Distance;
00116 typename CastImageFilter<FeatureImageType, ImageType>::Pointer m_Caster;
00117
00118
00119 };
00120
00121 }
00122
00123 #ifndef ITK_MANUAL_INSTANTIATION
00124 #include "itkCannySegmentationLevelSetFunction.txx"
00125 #endif
00126
00127 #endif