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: 2009-11-22 13:36:06 $
00007   Version:   $Revision: 1.15 $
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>
00060                                                 Superclass;
00061   typedef SmartPointer<Self>                    Pointer;
00062   typedef SmartPointer<const Self>              ConstPointer;
00063   typedef TFeatureImageType                     FeatureImageType;
00064 
00066   itkNewMacro(Self);
00067 
00069   itkTypeMacro( ThresholdSegmentationLevelSetFunction, SegmentationLevelSetFunction );
00070 
00072   typedef typename Superclass::ImageType         ImageType;
00073   typedef typename Superclass::ScalarValueType   ScalarValueType;
00074   typedef typename Superclass::FeatureScalarType FeatureScalarType;
00075   typedef typename Superclass::RadiusType        RadiusType;
00076 
00078   itkStaticConstMacro(ImageDimension, unsigned int,
00079                       Superclass::ImageDimension);
00080 
00082   void SetUpperThreshold(FeatureScalarType f)
00083     { m_UpperThreshold = f; }
00084   FeatureScalarType GetUpperThreshold() const
00085     { return m_UpperThreshold; }
00086   void SetLowerThreshold(FeatureScalarType f)
00087     { m_LowerThreshold = f; }
00088   FeatureScalarType GetLowerThreshold() const
00089     { return m_LowerThreshold; }
00091 
00092   virtual void CalculateSpeedImage();
00093 
00094   virtual void Initialize(const RadiusType &r)
00095     {
00096     Superclass::Initialize(r);
00097     
00098     this->SetAdvectionWeight( NumericTraits<ScalarValueType>::Zero);
00099     this->SetPropagationWeight(-1.0 * NumericTraits<ScalarValueType>::One);
00100     this->SetCurvatureWeight(NumericTraits<ScalarValueType>::One);
00101     }
00102 
00105   void SetEdgeWeight(const ScalarValueType p)
00106     {
00107     m_EdgeWeight = p;
00108     }
00109   ScalarValueType GetEdgeWeight() const
00110     {
00111     return m_EdgeWeight;
00112     }
00114 
00118   void SetSmoothingConductance(const ScalarValueType p)
00119     {
00120     m_SmoothingConductance = p;
00121     }
00122   ScalarValueType GetSmoothingConductance() const
00123     {
00124     return m_SmoothingConductance;
00125     }
00127 
00131   void SetSmoothingIterations(const int p)
00132     {
00133     m_SmoothingIterations = p;
00134     }
00135   int GetSmoothingIterations() const
00136     {
00137     return m_SmoothingIterations;
00138     }
00140 
00144   void SetSmoothingTimeStep(const ScalarValueType i)
00145     {
00146     m_SmoothingTimeStep = i;
00147     }
00148   ScalarValueType GetSmoothingTimeStep() const
00149     {
00150     return m_SmoothingTimeStep;
00151     }
00153 
00154 protected:
00155   ThresholdSegmentationLevelSetFunction()
00156     {
00157     m_UpperThreshold = NumericTraits<FeatureScalarType>::max();
00158     m_LowerThreshold = NumericTraits<FeatureScalarType>::NonpositiveMin();
00159     this->SetAdvectionWeight(0.0);
00160     this->SetPropagationWeight(1.0);
00161     this->SetCurvatureWeight(1.0);
00162     this->SetSmoothingIterations(5);
00163     this->SetSmoothingConductance(0.8);
00164     this->SetSmoothingTimeStep(0.1);
00165     this->SetEdgeWeight(0.0);
00166     }
00167   virtual ~ThresholdSegmentationLevelSetFunction(){}
00168 
00169   ThresholdSegmentationLevelSetFunction(const Self&); //purposely not implemented
00170   void operator=(const Self&); //purposely not implemented
00171   
00172   void PrintSelf(std::ostream& os, Indent indent) const
00173     {
00174     Superclass::PrintSelf(os, indent );
00175     os << indent << "UpperThreshold: " << m_UpperThreshold << std::endl;
00176     os << indent << "LowerThreshold: " << m_LowerThreshold << std::endl;
00177     os << indent << "EdgeWeight: " << m_EdgeWeight << std::endl;
00178     os << indent << "SmoothingTimeStep: " << m_SmoothingTimeStep << std::endl;
00179     os << indent << "SmoothingIterations: " << m_SmoothingIterations << std::endl;
00180     os << indent << "SmoothingConductance: " << m_SmoothingConductance << std::endl;
00181     }
00182   
00183   FeatureScalarType m_UpperThreshold;
00184   FeatureScalarType m_LowerThreshold;
00185   ScalarValueType   m_EdgeWeight;
00186   ScalarValueType   m_SmoothingConductance;
00187   int               m_SmoothingIterations;
00188   ScalarValueType   m_SmoothingTimeStep;
00189 };
00190   
00191 } // end namespace itk
00192 
00193 #ifndef ITK_MANUAL_INSTANTIATION
00194 #include "itkThresholdSegmentationLevelSetFunction.txx"
00195 #endif
00196 
00197 #endif
00198 

Generated at Mon Jul 12 2010 20:02:18 for ITK by doxygen 1.7.1 written by Dimitri van Heesch, © 1997-2000