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

itkVectorThresholdSegmentationLevelSetFunction.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Insight Segmentation & Registration Toolkit
00004   Module:    $RCSfile: itkVectorThresholdSegmentationLevelSetFunction.h,v $
00005   Language:  C++
00006   Date:      $Date: 2003/12/23 18:33:14 $
00007   Version:   $Revision: 1.6 $
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 __itkVectorThresholdSegmentationLevelSetFunction_h_
00018 #define __itkVectorThresholdSegmentationLevelSetFunction_h_
00019 
00020 #include "itkSegmentationLevelSetFunction.h"
00021 #include "itkNumericTraits.h"
00022 #include "itkMahalanobisDistanceMembershipFunction.h"
00023 namespace itk {
00024 
00054 template <class TImageType, class TFeatureImageType>
00055 class ITK_EXPORT VectorThresholdSegmentationLevelSetFunction
00056   : public SegmentationLevelSetFunction<TImageType, TFeatureImageType>
00057 {
00058 public:
00060   typedef VectorThresholdSegmentationLevelSetFunction Self;
00061   typedef SegmentationLevelSetFunction<TImageType, TFeatureImageType> Superclass;
00062   typedef SmartPointer<Self> Pointer;
00063   typedef SmartPointer<const Self> ConstPointer;
00064   typedef TFeatureImageType FeatureImageType;
00065 
00066   
00067 
00069   itkNewMacro(Self);
00070 
00072   itkTypeMacro( VectorThresholdSegmentationLevelSetFunction, SegmentationLevelSetFunction );
00073 
00075   typedef typename Superclass::ImageType ImageType;
00076   typedef typename Superclass::ScalarValueType ScalarValueType;
00077   typedef typename Superclass::FeatureScalarType FeatureScalarType;
00078   typedef typename Superclass::RadiusType RadiusType;
00079 
00081   itkStaticConstMacro(ImageDimension, unsigned int,
00082                       Superclass::ImageDimension);
00083 
00085   typedef typename FeatureImageType::PixelType FeatureImagePixelType;
00086   itkStaticConstMacro(NumberOfComponents, unsigned int,
00087                         FeatureImagePixelType::Dimension);
00088 
00089 
00090   typedef Statistics::MahalanobisDistanceMembershipFunction<FeatureScalarType> MahalanobisFunctionType;
00091   typedef typename MahalanobisFunctionType::Pointer MahalanobisFunctionPointer;
00092   typedef typename MahalanobisFunctionType::MeanVectorType MeanVectorType;
00093   typedef typename MahalanobisFunctionType::CovarianceMatrixType CovarianceMatrixType;
00094   
00096   void SetMean(const MeanVectorType &mean) 
00097   {  m_Mahalanobis->SetMean(mean); }
00098   const MeanVectorType & GetMean() const 
00099   {  return m_Mahalanobis->GetMean(); }
00101 
00102   
00103   void SetCovariance(const CovarianceMatrixType &cov) 
00104   { m_Mahalanobis->SetCovariance(cov); }
00105   const CovarianceMatrixType & GetCovariance() const
00106   { return m_Mahalanobis->GetCovariance(); }
00107   
00109   void SetThreshold(ScalarValueType thr) 
00110   {
00111   m_Threshold = thr;
00112 
00113   }
00114   ScalarValueType GetThreshold() 
00115   {
00116   return m_Threshold;
00117   }
00118   
00119 
00120 
00121   virtual void CalculateSpeedImage();
00122 
00123   virtual void Initialize(const RadiusType &r)
00124   {
00125     Superclass::Initialize(r);
00126     
00127     this->SetAdvectionWeight( NumericTraits<ScalarValueType>::Zero);
00128     this->SetPropagationWeight(-1.0 * NumericTraits<ScalarValueType>::One);
00129     this->SetCurvatureWeight(NumericTraits<ScalarValueType>::One);
00130   }
00131 
00132   
00133 protected:
00134   VectorThresholdSegmentationLevelSetFunction()
00135   {
00136     MeanVectorType mean( NumberOfComponents );
00137     CovarianceMatrixType covariance( NumberOfComponents, NumberOfComponents );
00138     
00139     mean.fill(NumericTraits<ITK_TYPENAME FeatureScalarType::ValueType>::Zero);
00140     covariance.fill(NumericTraits<ITK_TYPENAME FeatureScalarType::ValueType>::Zero);
00141   
00142     m_Mahalanobis = MahalanobisFunctionType::New();
00143     m_Mahalanobis->SetMean(mean);
00144     m_Mahalanobis->SetCovariance(covariance);
00145     
00146     
00147     this->SetAdvectionWeight(0.0);
00148     this->SetPropagationWeight(1.0);
00149     this->SetThreshold(1.8);
00150   }
00151   virtual ~VectorThresholdSegmentationLevelSetFunction(){}
00152 
00153   VectorThresholdSegmentationLevelSetFunction(const Self&); //purposely not implemented
00154   void operator=(const Self&); //purposely not implemented
00155   
00156   void PrintSelf(std::ostream& os, Indent indent) const
00157   {
00158     Superclass::PrintSelf(os, indent );
00159     os << indent << "MahalanobisFunction: " << m_Mahalanobis << std::endl;
00160   os << indent << "ThresholdValue: " << m_Threshold << std::endl;
00161   }
00162   
00163   
00164   MahalanobisFunctionPointer m_Mahalanobis;
00165   ScalarValueType  m_Threshold;
00166   
00167 };
00168   
00169 } // end namespace itk
00170 
00171 #ifndef ITK_MANUAL_INSTANTIATION
00172 #include "itkVectorThresholdSegmentationLevelSetFunction.txx"
00173 #endif
00174 
00175 #endif
00176 

Generated at Sun Sep 23 14:38:02 2007 for ITK by doxygen 1.5.1 written by Dimitri van Heesch, © 1997-2000