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

itkSegmentationLevelSetFunction.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Insight Segmentation & Registration Toolkit
00004   Module:    $RCSfile: itkSegmentationLevelSetFunction.h,v $
00005   Language:  C++
00006   Date:      $Date: 2009-03-03 15:09:09 $
00007   Version:   $Revision: 1.19 $
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 __itkSegmentationLevelSetFunction_h
00018 #define __itkSegmentationLevelSetFunction_h
00019 
00020 #include "itkLevelSetFunction.h"
00021 #include "itkLinearInterpolateImageFunction.h"
00022 #include "itkVectorLinearInterpolateImageFunction.h"
00023 #include "itkVectorCastImageFilter.h"
00024 
00025 namespace itk {
00026 
00044 template <class TImageType, class TFeatureImageType = TImageType>
00045 class ITK_EXPORT SegmentationLevelSetFunction
00046   : public LevelSetFunction<TImageType>
00047 {
00048 public:
00050   typedef SegmentationLevelSetFunction Self;
00051   typedef LevelSetFunction<TImageType> Superclass;
00052   typedef SmartPointer<Self>           Pointer;
00053   typedef SmartPointer<const Self>     ConstPointer;
00054 
00056   itkTypeMacro( SegmentationLevelSetFunction, LevelSetFunction );
00057 
00059   typedef typename Superclass::ImageType        ImageType;
00060   typedef typename Superclass::RadiusType       RadiusType;
00061   typedef typename Superclass::PixelRealType    PixelRealType;
00062   typedef TFeatureImageType                     FeatureImageType;
00063   typedef typename Superclass::FloatOffsetType  FloatOffsetType;
00064   typedef typename Superclass::ScalarValueType  ScalarValueType;
00065   typedef typename Superclass::NeighborhoodType NeighborhoodType;
00066   typedef typename FeatureImageType::PixelType  FeatureScalarType;
00067   typedef typename ImageType::IndexType         IndexType;
00068   typedef typename Superclass::VectorType       VectorType;
00069   typedef typename Superclass::GlobalDataStruct GlobalDataStruct;
00070 
00072   itkStaticConstMacro(ImageDimension, unsigned int,Superclass::ImageDimension);
00073 
00075   typedef Image<VectorType, itkGetStaticConstMacro(ImageDimension)> VectorImageType;
00076 
00077 
00079   typedef LinearInterpolateImageFunction<ImageType>  InterpolatorType;
00080 
00082   typedef VectorLinearInterpolateImageFunction<VectorImageType> VectorInterpolatorType;
00083 
00085   typedef typename InterpolatorType::ContinuousIndexType ContinuousIndexType;
00086 
00088   virtual const FeatureImageType *GetFeatureImage() const
00089   { return m_FeatureImage.GetPointer(); }
00090   virtual void SetFeatureImage(const FeatureImageType *f)
00091   {    m_FeatureImage = f;  }
00093 
00095   virtual ImageType *GetSpeedImage() 
00096     { return m_SpeedImage.GetPointer(); }
00097   void SetSpeedImage( ImageType *s );
00099 
00101   virtual VectorImageType *GetAdvectionImage() const
00102   { return m_AdvectionImage.GetPointer(); } 
00103   void SetAdvectionImage( VectorImageType *s );
00105 
00106   
00110   virtual void Initialize(const RadiusType &r);
00111 
00116   virtual void CalculateSpeedImage() {}
00117 
00122   virtual void CalculateAdvectionImage() {}
00123 
00126   virtual void AllocateSpeedImage();
00127 
00130   virtual void AllocateAdvectionImage();
00131 
00142   virtual void ReverseExpansionDirection();
00143 
00144 protected:
00146   typename FeatureImageType::ConstPointer m_FeatureImage;
00147 
00149   typename ImageType::Pointer        m_SpeedImage;
00150 
00152   typename VectorImageType::Pointer  m_AdvectionImage;
00153 
00155   Functor::VectorCast< ITK_TYPENAME VectorInterpolatorType::OutputType,
00156                        VectorType > m_VectorCast;
00157 
00159   virtual ScalarValueType PropagationSpeed(const NeighborhoodType &,
00160                                            const FloatOffsetType &, GlobalDataStruct *gd) const;
00161 
00163   virtual VectorType AdvectionField(const NeighborhoodType &,
00164                                     const FloatOffsetType &, GlobalDataStruct *gd) const;
00165 
00166   
00167   virtual ~SegmentationLevelSetFunction() {}
00168   SegmentationLevelSetFunction()
00169     {
00170     m_SpeedImage = ImageType::New();
00171     m_AdvectionImage = VectorImageType::New();
00172     m_Interpolator = InterpolatorType::New();
00173     m_VectorInterpolator = VectorInterpolatorType::New();
00174     }
00175 
00176   typename InterpolatorType::Pointer       m_Interpolator;
00177   typename VectorInterpolatorType::Pointer m_VectorInterpolator;
00178 
00179  
00180 private:
00181   SegmentationLevelSetFunction(const Self&); //purposely not implemented
00182   void operator=(const Self&); //purposely not implemented
00183 };
00184 
00185 } // end namespace
00186 
00187 // Define instantiation macro for this template.
00188 #define ITK_TEMPLATE_SegmentationLevelSetFunction(_, EXPORT, x, y) namespace itk { \
00189   _(2(class EXPORT SegmentationLevelSetFunction< ITK_TEMPLATE_2 x >)) \
00190   namespace Templates { typedef SegmentationLevelSetFunction< ITK_TEMPLATE_2 x > \
00191                                          SegmentationLevelSetFunction##y; } \
00192   }
00193 
00194 #if ITK_TEMPLATE_EXPLICIT
00195 # include "Templates/itkSegmentationLevelSetFunction+-.h"
00196 #endif
00197 
00198 #if ITK_TEMPLATE_TXX
00199 # include "itkSegmentationLevelSetFunction.txx"
00200 #endif
00201 
00202 
00203 #endif
00204 

Generated at Tue Sep 15 04:50:59 2009 for ITK by doxygen 1.5.8 written by Dimitri van Heesch, © 1997-2000