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: 2008-10-23 16:15:22 $
00007   Version:   $Revision: 1.8 $
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>
00040                                              Superclass;
00041   typedef SmartPointer<Self>                 Pointer;
00042   typedef SmartPointer<const Self>           ConstPointer;
00043   typedef TFeatureImageType                  FeatureImageType;
00044 
00046   itkNewMacro(Self);
00047 
00049   itkTypeMacro( CannySegmentationLevelSetFunction, SegmentationLevelSetFunction );
00050 
00052   typedef typename Superclass::ImageType         ImageType;
00053   typedef typename Superclass::ScalarValueType   ScalarValueType;
00054   typedef typename Superclass::VectorImageType   VectorImageType;
00055   typedef typename Superclass::FeatureScalarType FeatureScalarType;
00056   typedef typename Superclass::RadiusType        RadiusType;
00057 
00059   itkStaticConstMacro(ImageDimension, unsigned int,
00060                       Superclass::ImageDimension);
00061 
00063   void SetThreshold(ScalarValueType v)
00064     { m_Threshold = v; }
00065   ScalarValueType GetThreshold() const
00066     { return m_Threshold; }
00068 
00070   void SetVariance(double v)
00071     { m_Variance = v; }
00072   double GetVariance() const
00073     { return m_Variance; }
00075 
00078   virtual void CalculateSpeedImage();
00079 
00082   virtual void CalculateAdvectionImage();
00083 
00086   virtual void CalculateDistanceImage();
00087 
00088   virtual void Initialize(const RadiusType &r)
00089     {
00090     Superclass::Initialize(r);
00091     
00092     this->SetAdvectionWeight(-1.0 * NumericTraits<ScalarValueType>::One);
00093     this->SetPropagationWeight(-1.0 * NumericTraits<ScalarValueType>::One);
00094     this->SetCurvatureWeight(NumericTraits<ScalarValueType>::One);
00095     }
00096 
00097   ImageType *GetCannyImage()
00098     { return m_Canny->GetOutput(); }
00099 
00100 protected:
00101   CannySegmentationLevelSetFunction()
00102     {
00103     m_Variance = 0.0;
00104     m_Threshold = NumericTraits<ScalarValueType>::Zero;
00105     m_Caster = CastImageFilter<FeatureImageType,ImageType>::New();
00106     m_Canny = CannyEdgeDetectionImageFilter<ImageType,ImageType>::New();
00107     m_Distance = DanielssonDistanceMapImageFilter<ImageType,ImageType>::New();
00108     }
00109   virtual ~CannySegmentationLevelSetFunction() {}
00110 
00111   CannySegmentationLevelSetFunction(const Self&); //purposely not implemented
00112   void operator=(const Self&); //purposely not implemented
00113 
00114 private:
00115   ScalarValueType m_Variance;
00116   double          m_Threshold;
00117 
00118   typename CannyEdgeDetectionImageFilter<ImageType,ImageType>::Pointer m_Canny;
00119 
00120   typename DanielssonDistanceMapImageFilter<ImageType,ImageType>::Pointer m_Distance;
00121 
00122   typename CastImageFilter<FeatureImageType, ImageType>::Pointer m_Caster;
00123 
00124   
00125 };
00126   
00127 } // end namespace itk
00128 
00129 #ifndef ITK_MANUAL_INSTANTIATION
00130 #include "itkCannySegmentationLevelSetFunction.txx"
00131 #endif
00132 
00133 #endif
00134 

Generated at Mon Jul 12 2010 17:59:54 for ITK by doxygen 1.7.1 written by Dimitri van Heesch, © 1997-2000