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

itkSegmentationLevelSetImageFilter.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Insight Segmentation & Registration Toolkit
00004   Module:    $RCSfile: itkSegmentationLevelSetImageFilter.h,v $
00005   Language:  C++
00006   Date:      $Date: 2003/09/10 14:28:38 $
00007   Version:   $Revision: 1.23 $
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 __itkSegmentationLevelSetImageFilter_h_
00018 #define __itkSegmentationLevelSetImageFilter_h_
00019 
00020 #include "itkSparseFieldLevelSetImageFilter.h"
00021 #include "itkSegmentationLevelSetFunction.h"
00022 
00023 namespace itk {
00024 
00142 template <class TInputImage,
00143           class TFeatureImage,
00144           class TOutputPixelType = float,
00145           class TOutputImage = Image<TOutputPixelType,
00146                                      ::itk::GetImageDimension<TInputImage>::ImageDimension> >
00147 class ITK_EXPORT SegmentationLevelSetImageFilter
00148   : public SparseFieldLevelSetImageFilter<TInputImage, TOutputImage>
00149 {
00150 public:
00152   typedef SegmentationLevelSetImageFilter Self;
00153   typedef SparseFieldLevelSetImageFilter<TInputImage, TOutputImage> Superclass;
00154   typedef SmartPointer<Self>  Pointer;
00155   typedef SmartPointer<const Self>  ConstPointer;
00156 
00158   typedef typename Superclass::ValueType ValueType;
00159   typedef typename Superclass::IndexType IndexType;
00160   typedef typename Superclass::TimeStepType TimeStepType;
00161   typedef typename Superclass::InputImageType  InputImageType;
00162 
00164   typedef TOutputImage   OutputImageType;
00165   typedef TFeatureImage FeatureImageType;
00166 
00168   typedef SegmentationLevelSetFunction<OutputImageType, FeatureImageType>
00169   SegmentationFunctionType;
00170 
00172   typedef typename SegmentationFunctionType::VectorImageType VectorImageType;
00173   
00175   itkTypeMacro(SegmentationLevelSetImageFilter, SparseFieldLevelSetImageFilter);
00176 
00179   itkSetMacro(MaximumRMSError, ValueType);
00180   itkGetMacro(MaximumRMSError, ValueType);
00181 
00184   itkSetMacro(MaximumIterations, unsigned int);
00185   itkGetMacro(MaximumIterations, unsigned int); 
00186 
00189   virtual void SetFeatureImage(const FeatureImageType *f)
00190   {
00191     this->ProcessObject::SetNthInput( 1, const_cast< FeatureImageType * >(f) );
00192     m_SegmentationFunction->SetFeatureImage(f);
00193   }
00194   virtual FeatureImageType * GetFeatureImage()
00195   { return ( static_cast< FeatureImageType *>(this->ProcessObject::GetInput(1)) ); }
00196 
00199   virtual void SetInitialImage(InputImageType *f)
00200   {
00201     this->SetInput(f);
00202   }
00203   
00204   virtual const typename SegmentationFunctionType::ImageType *GetSpeedImage() const
00205   { return m_SegmentationFunction->GetSpeedImage(); }
00206 
00207   virtual const typename SegmentationFunctionType::VectorImageType *GetAdvectionImage() const
00208   { return m_SegmentationFunction->GetAdvectionImage(); }
00209 
00213   void SetUseNegativeFeaturesOn()
00214   {
00215     itkWarningMacro( << "SetUseNegativeFeaturesOn has been deprecated.  Please use ReverseExpansionDirectionOn() instead" );
00216     this->ReverseExpansionDirectionOn();
00217   }
00218   void SetUseNegativeFeaturesOff()
00219   {
00220     itkWarningMacro( << "SetUseNegativeFeaturesOff has been deprecated.  Please use ReverseExpansionDirectionOff() instead" );
00221     this->ReverseExpansionDirectionOff();
00222   }
00223 
00226   void SetUseNegativeFeatures( bool u )
00227   {
00228     itkWarningMacro( << "SetUseNegativeFeatures has been deprecated.  Please use SetReverseExpansionDirection instead" );
00229     if (u == true)
00230       {
00231       this->SetReverseExpansionDirection(false);
00232       }
00233     else
00234       {
00235       this->SetReverseExpansionDirection(true);
00236       }
00237   }
00238   bool GetUseNegativeFeatures() const
00239   {
00240     itkWarningMacro( << "GetUseNegativeFeatures has been deprecated.  Please use GetReverseExpansionDirection() instead" );
00241     if ( m_ReverseExpansionDirection == false)
00242       {
00243       return true;
00244       }
00245     else
00246       {
00247       return false;
00248       }
00249   }
00250 
00259   itkSetMacro(ReverseExpansionDirection, bool);
00260   itkGetMacro(ReverseExpansionDirection, bool);
00261   itkBooleanMacro(ReverseExpansionDirection);
00262   
00267   void SetFeatureScaling(ValueType v)
00268   {
00269     if (v != m_SegmentationFunction->GetPropagationWeight())
00270       {        
00271       this->SetPropagationScaling(v);
00272       }
00273     if (v != m_SegmentationFunction->GetAdvectionWeight())
00274       {
00275       this->SetAdvectionScaling(v);
00276       }
00277   }
00278 
00281   void SetPropagationScaling(ValueType v)
00282   {
00283     if (v != m_SegmentationFunction->GetPropagationWeight())
00284       {        
00285       m_SegmentationFunction->SetPropagationWeight(v);
00286       this->Modified();
00287       }
00288   }
00289   ValueType GetPropagationScaling() const
00290   {
00291     return m_SegmentationFunction->GetPropagationWeight();
00292   }
00293 
00296   void SetAdvectionScaling(ValueType v)
00297   {
00298     if (v != m_SegmentationFunction->GetAdvectionWeight())
00299       {        
00300       m_SegmentationFunction->SetAdvectionWeight(v);
00301       this->Modified();
00302       }
00303   }
00304   ValueType GetAdvectionScaling() const
00305   {
00306     return m_SegmentationFunction->GetAdvectionWeight();
00307   }
00308 
00312   void SetCurvatureScaling(ValueType v)
00313   {
00314     if (v != m_SegmentationFunction->GetCurvatureWeight())
00315       {        
00316       m_SegmentationFunction->SetCurvatureWeight(v);
00317       this->Modified();
00318       }
00319   }
00320   ValueType GetCurvatureScaling() const
00321   {
00322     return m_SegmentationFunction->GetCurvatureWeight();
00323   }
00324 
00325 
00327   void SetUseMinimalCurvature( bool b )
00328   {
00329     if ( m_SegmentationFunction->GetUseMinimalCurvature() != b)
00330       {
00331       m_SegmentationFunction->SetUseMinimalCurvature( b );
00332       this->Modified();
00333       }
00334   }
00335   bool GetUseMinimalCurvature() const
00336   {
00337     return m_SegmentationFunction->GetUseMinimalCurvature();
00338   }
00339   void UseMinimalCurvatureOn()
00340   {
00341     this->SetUseMinimalCurvature(true);
00342   }
00343   void UseMinimalCurvatureOff()
00344   {
00345     this->SetUseMinimalCurvature(false);
00346   }
00347   
00348   
00351   virtual void SetSegmentationFunction(SegmentationFunctionType *s);
00352   virtual SegmentationFunctionType *GetSegmentationFunction()
00353   { return m_SegmentationFunction; }
00354 
00355   
00360   void SetMaximumCurvatureTimeStep(double n)
00361   {
00362     if ( n != m_SegmentationFunction->GetMaximumCurvatureTimeStep() )
00363       {
00364       m_SegmentationFunction->SetMaximumCurvatureTimeStep(n);
00365       this->Modified();
00366       }
00367   }
00368   double GetMaximumCurvatureTimeStep() const
00369   {
00370     return m_SegmentationFunction->GetMaximumCurvatureTimeStep();
00371   }
00372 
00377   void SetMaximumPropagationTimeStep(double n)
00378   {
00379     if (n != m_SegmentationFunction->GetMaximumPropagationTimeStep() )
00380       {
00381       m_SegmentationFunction->SetMaximumPropagationTimeStep(n);
00382       this->Modified();
00383       }
00384   }
00385   double GetMaximumPropagationTimeStep() const
00386   {
00387     return m_SegmentationFunction->GetMaximumPropagationTimeStep();
00388   }
00389 protected:
00390   virtual ~SegmentationLevelSetImageFilter() {}
00391   SegmentationLevelSetImageFilter(const Self&);
00392   SegmentationLevelSetImageFilter();
00393 
00394   virtual void PrintSelf(std::ostream& os, Indent indent) const;
00395 
00397   virtual void InitializeIteration()
00398   {
00399     Superclass::InitializeIteration();
00400     // Estimate the progress of the filter
00401     this->SetProgress( (float) ((float)this->GetElapsedIterations()
00402                                 / (float)this->GetMaximumIterations()) );
00403   }
00404   
00407   void GenerateData();
00408 
00411   bool Halt();
00412 
00415   bool m_ReverseExpansionDirection;
00416 
00417 private:
00418   unsigned int m_MaximumIterations;
00419   SegmentationFunctionType *m_SegmentationFunction;
00420   ValueType m_MaximumRMSError;
00421 };
00422 
00423 } // end namespace itk
00424 
00425 #ifndef ITK_MANUAL_INSTANTIATION
00426 #include "itkSegmentationLevelSetImageFilter.txx"
00427 #endif
00428 
00429 #endif
00430 

Generated at Tue Sep 16 11:32:09 2003 for ITK by doxygen 1.2.15 written by Dimitri van Heesch, © 1997-2000