Main Page   Groups   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Concepts

itkCannySegmentationLevelSetFunction.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Insight Segmentation & Registration Toolkit
00004   Module:    $RCSfile: itkCannySegmentationLevelSetFunction.h,v $
00005   Language:  C++
00006   Date:      $Date: 2004/06/17 20:51:52 $
00007   Version:   $Revision: 1.7 $
00008 
00009   Copyright (c) Insight Software Consortium. All rights reserved.
00010   See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
00011 
00012      This software is distributed WITHOUT ANY WARRANTY; without even 
00013      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
00014      PURPOSE.  See the above copyright notices for more information.
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&); //purposely not implemented
00109   void operator=(const Self&); //purposely not implemented
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 } // end namespace itk
00122 
00123 #ifndef ITK_MANUAL_INSTANTIATION
00124 #include "itkCannySegmentationLevelSetFunction.txx"
00125 #endif
00126 
00127 #endif

Generated at Wed May 24 22:54:08 2006 for ITK by doxygen 1.3.5 written by Dimitri van Heesch, © 1997-2000