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: 2003/09/10 14:28:39 $
00007   Version:   $Revision: 1.12 $
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; }
00089 
00090   virtual void CalculateSpeedImage();
00091 
00092   virtual void Initialize(const RadiusType &r)
00093   {
00094     Superclass::Initialize(r);
00095     
00096     this->SetAdvectionWeight( NumericTraits<ScalarValueType>::Zero);
00097     this->SetPropagationWeight(-1.0 * NumericTraits<ScalarValueType>::One);
00098     this->SetCurvatureWeight(NumericTraits<ScalarValueType>::One);
00099   }
00100 
00103   void SetEdgeWeight(const ScalarValueType p)
00104   {
00105     m_EdgeWeight = p;
00106   }
00107   ScalarValueType GetEdgeWeight() const
00108   {
00109     return m_EdgeWeight;
00110   }
00111   
00115   void SetSmoothingConductance(const ScalarValueType p)
00116   {
00117     m_SmoothingConductance = p;
00118   }
00119   ScalarValueType GetSmoothingConductance() const
00120   {
00121     return m_SmoothingConductance;
00122   }
00123   
00127   void SetSmoothingIterations(const int p)
00128   {
00129     m_SmoothingIterations = p;
00130   }
00131   int GetSmoothingIterations() const
00132   {
00133     return m_SmoothingIterations;
00134   }
00135 
00139   void SetSmoothingTimeStep(const ScalarValueType i)
00140   {
00141     m_SmoothingTimeStep = i;
00142   }
00143   ScalarValueType GetSmoothingTimeStep() const
00144   {
00145     return m_SmoothingTimeStep;
00146   }
00147 
00148 protected:
00149   ThresholdSegmentationLevelSetFunction()
00150   {
00151     m_UpperThreshold = NumericTraits<FeatureScalarType>::max();
00152     m_LowerThreshold = NumericTraits<FeatureScalarType>::NonpositiveMin();
00153     this->SetAdvectionWeight(0.0);
00154     this->SetPropagationWeight(1.0);
00155     this->SetCurvatureWeight(1.0);
00156     this->SetSmoothingIterations(5);
00157     this->SetSmoothingConductance(0.8);
00158     this->SetSmoothingTimeStep(0.1);
00159     this->SetEdgeWeight(0.0);
00160   }
00161   virtual ~ThresholdSegmentationLevelSetFunction(){}
00162 
00163   ThresholdSegmentationLevelSetFunction(const Self&); //purposely not implemented
00164   void operator=(const Self&); //purposely not implemented
00165   
00166   void PrintSelf(std::ostream& os, Indent indent) const
00167   {
00168     Superclass::PrintSelf(os, indent );
00169     os << indent << "UpperThreshold: " << m_UpperThreshold << std::endl;
00170     os << indent << "LowerThreshold: " << m_LowerThreshold << std::endl;
00171     os << indent << "EdgeWeight: " << m_EdgeWeight << std::endl;
00172     os << indent << "SmoothingTimeStep: " << m_SmoothingTimeStep << std::endl;
00173     os << indent << "SmoothingIterations: " << m_SmoothingIterations << std::endl;
00174     os << indent << "SmoothingConductance: " << m_SmoothingConductance << std::endl;
00175   }
00176   
00177   FeatureScalarType m_UpperThreshold;
00178   FeatureScalarType m_LowerThreshold;
00179   ScalarValueType   m_EdgeWeight;
00180   ScalarValueType   m_SmoothingConductance;
00181   int               m_SmoothingIterations;
00182   ScalarValueType   m_SmoothingTimeStep;
00183 };
00184   
00185 } // end namespace itk
00186 
00187 #ifndef ITK_MANUAL_INSTANTIATION
00188 #include "itkThresholdSegmentationLevelSetFunction.txx"
00189 #endif
00190 
00191 #endif

Generated at Thu May 25 00:08:43 2006 for ITK by doxygen 1.3.5 written by Dimitri van Heesch, © 1997-2000