00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
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 TFeatureImageType FeatureImageType;
00062 typedef typename Superclass::FloatOffsetType FloatOffsetType;
00063 typedef typename Superclass::ScalarValueType ScalarValueType;
00064 typedef typename Superclass::NeighborhoodType NeighborhoodType;
00065 typedef typename FeatureImageType::PixelType FeatureScalarType;
00066 typedef typename ImageType::IndexType IndexType;
00067 typedef typename Superclass::VectorType VectorType;
00068 typedef typename Superclass::GlobalDataStruct GlobalDataStruct;
00069
00071 itkStaticConstMacro(ImageDimension, unsigned int,Superclass::ImageDimension);
00072
00074 typedef Image<VectorType, itkGetStaticConstMacro(ImageDimension)> VectorImageType;
00075
00076
00078 typedef LinearInterpolateImageFunction<ImageType> InterpolatorType;
00079
00081 typedef VectorLinearInterpolateImageFunction<VectorImageType> VectorInterpolatorType;
00082
00084 typedef typename InterpolatorType::ContinuousIndexType ContinuousIndexType;
00085
00087 virtual const FeatureImageType *GetFeatureImage() const
00088 { return m_FeatureImage.GetPointer(); }
00089 virtual void SetFeatureImage(const FeatureImageType *f)
00090 { m_FeatureImage = f; }
00091
00093 virtual ImageType *GetSpeedImage()
00094 { return m_SpeedImage.GetPointer(); }
00095 void SetSpeedImage( ImageType *s );
00096
00098 virtual VectorImageType *GetAdvectionImage() const
00099 { return m_AdvectionImage.GetPointer(); }
00100 void SetAdvectionImage( VectorImageType *s );
00101
00102
00106 virtual void Initialize(const RadiusType &r);
00107
00112 virtual void CalculateSpeedImage() {}
00113
00118 virtual void CalculateAdvectionImage() {}
00119
00122 virtual void AllocateSpeedImage();
00123
00126 virtual void AllocateAdvectionImage();
00127
00138 virtual void ReverseExpansionDirection();
00139
00140 protected:
00142 typename FeatureImageType::ConstPointer m_FeatureImage;
00143
00145 typename ImageType::Pointer m_SpeedImage;
00146
00148 typename VectorImageType::Pointer m_AdvectionImage;
00149
00151 Functor::VectorCast< ITK_TYPENAME VectorInterpolatorType::OutputType,
00152 VectorType > m_VectorCast;
00153
00155 virtual ScalarValueType PropagationSpeed(const NeighborhoodType &,
00156 const FloatOffsetType &, GlobalDataStruct *gd) const;
00157
00159 virtual VectorType AdvectionField(const NeighborhoodType &,
00160 const FloatOffsetType &, GlobalDataStruct *gd) const;
00161
00162
00163 virtual ~SegmentationLevelSetFunction() {}
00164 SegmentationLevelSetFunction()
00165 {
00166 m_SpeedImage = ImageType::New();
00167 m_AdvectionImage = VectorImageType::New();
00168 m_Interpolator = InterpolatorType::New();
00169 m_VectorInterpolator = VectorInterpolatorType::New();
00170 }
00171
00172 typename InterpolatorType::Pointer m_Interpolator;
00173 typename VectorInterpolatorType::Pointer m_VectorInterpolator;
00174
00175 };
00176
00177 }
00178
00179 #ifndef ITK_MANUAL_INSTANTIATION
00180 #include "itkSegmentationLevelSetFunction.txx"
00181 #endif
00182
00183 #endif