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

itkThresholdSegmentationLevelSetFunction.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Insight Segmentation & Registration Toolkit
00004   Module:    $RCSfile: itkThresholdSegmentationLevelSetFunction.h,v $
00005   Language:  C++
00006   Date:      $Date: 2006/04/18 19:04:23 $
00007   Version:   $Revision: 1.13 $
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 __itkThresholdSegmentationLevelSetFunction_h_
00018 #define __itkThresholdSegmentationLevelSetFunction_h_
00019 
00020 #include "itkSegmentationLevelSetFunction.h"
00021 #include "itkNumericTraits.h"
00022 namespace itk {
00023 
00052 template <class TImageType, class TFeatureImageType = TImageType>
00053 class ITK_EXPORT ThresholdSegmentationLevelSetFunction
00054   : public SegmentationLevelSetFunction<TImageType, TFeatureImageType>
00055 {
00056 public:
00058   typedef ThresholdSegmentationLevelSetFunction 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( ThresholdSegmentationLevelSetFunction, SegmentationLevelSetFunction );
00069 
00071   typedef typename Superclass::ImageType ImageType;
00072   typedef typename Superclass::ScalarValueType ScalarValueType;
00073   typedef typename Superclass::FeatureScalarType FeatureScalarType;
00074   typedef typename Superclass::RadiusType RadiusType;
00075 
00077   itkStaticConstMacro(ImageDimension, unsigned int,
00078                       Superclass::ImageDimension);
00079 
00081   void SetUpperThreshold(FeatureScalarType f)
00082   { m_UpperThreshold = f; }
00083   FeatureScalarType GetUpperThreshold() const
00084   { return m_UpperThreshold; }
00085   void SetLowerThreshold(FeatureScalarType f)
00086   { m_LowerThreshold = f; }
00087   FeatureScalarType GetLowerThreshold() const
00088   { return m_LowerThreshold; }
00090 
00091   virtual void CalculateSpeedImage();
00092 
00093   virtual void Initialize(const RadiusType &r)
00094   {
00095     Superclass::Initialize(r);
00096     
00097     this->SetAdvectionWeight( NumericTraits<ScalarValueType>::Zero);
00098     this->SetPropagationWeight(-1.0 * NumericTraits<ScalarValueType>::One);
00099     this->SetCurvatureWeight(NumericTraits<ScalarValueType>::One);
00100   }
00101 
00104   void SetEdgeWeight(const ScalarValueType p)
00105   {
00106     m_EdgeWeight = p;
00107   }
00108   ScalarValueType GetEdgeWeight() const
00109   {
00110     return m_EdgeWeight;
00111   }
00113 
00117   void SetSmoothingConductance(const ScalarValueType p)
00118   {
00119     m_SmoothingConductance = p;
00120   }
00121   ScalarValueType GetSmoothingConductance() const
00122   {
00123     return m_SmoothingConductance;
00124   }
00126 
00130   void SetSmoothingIterations(const int p)
00131   {
00132     m_SmoothingIterations = p;
00133   }
00134   int GetSmoothingIterations() const
00135   {
00136     return m_SmoothingIterations;
00137   }
00139 
00143   void SetSmoothingTimeStep(const ScalarValueType i)
00144   {
00145     m_SmoothingTimeStep = i;
00146   }
00147   ScalarValueType GetSmoothingTimeStep() const
00148   {
00149     return m_SmoothingTimeStep;
00150   }
00152 
00153 protected:
00154   ThresholdSegmentationLevelSetFunction()
00155   {
00156     m_UpperThreshold = NumericTraits<FeatureScalarType>::max();
00157     m_LowerThreshold = NumericTraits<FeatureScalarType>::NonpositiveMin();
00158     this->SetAdvectionWeight(0.0);
00159     this->SetPropagationWeight(1.0);
00160     this->SetCurvatureWeight(1.0);
00161     this->SetSmoothingIterations(5);
00162     this->SetSmoothingConductance(0.8);
00163     this->SetSmoothingTimeStep(0.1);
00164     this->SetEdgeWeight(0.0);
00165   }
00166   virtual ~ThresholdSegmentationLevelSetFunction(){}
00167 
00168   ThresholdSegmentationLevelSetFunction(const Self&); //purposely not implemented
00169   void operator=(const Self&); //purposely not implemented
00170   
00171   void PrintSelf(std::ostream& os, Indent indent) const
00172   {
00173     Superclass::PrintSelf(os, indent );
00174     os << indent << "UpperThreshold: " << m_UpperThreshold << std::endl;
00175     os << indent << "LowerThreshold: " << m_LowerThreshold << std::endl;
00176     os << indent << "EdgeWeight: " << m_EdgeWeight << std::endl;
00177     os << indent << "SmoothingTimeStep: " << m_SmoothingTimeStep << std::endl;
00178     os << indent << "SmoothingIterations: " << m_SmoothingIterations << std::endl;
00179     os << indent << "SmoothingConductance: " << m_SmoothingConductance << std::endl;
00180   }
00181   
00182   FeatureScalarType m_UpperThreshold;
00183   FeatureScalarType m_LowerThreshold;
00184   ScalarValueType   m_EdgeWeight;
00185   ScalarValueType   m_SmoothingConductance;
00186   int               m_SmoothingIterations;
00187   ScalarValueType   m_SmoothingTimeStep;
00188 };
00189   
00190 } // end namespace itk
00191 
00192 #ifndef ITK_MANUAL_INSTANTIATION
00193 #include "itkThresholdSegmentationLevelSetFunction.txx"
00194 #endif
00195 
00196 #endif
00197 

Generated at Mon Mar 12 03:12:33 2007 for ITK by doxygen 1.5.1 written by Dimitri van Heesch, © 1997-2000