00001 #ifndef __itkGradientVectorFlowImageFilter_h
00002 #define __itkGradientVectorFlowImageFilter_h
00003
00004 #include "itkImageToImageFilter.h"
00005 #include "vnl/vnl_matrix_fixed.h"
00006 #include "vnl/vnl_math.h"
00007 #include "itkImage.h"
00008 #include "itkVector.h"
00009 #include "itkLaplacianImageFilter.h"
00010 #include "itkImageRegionIterator.h"
00011 #include "itkImageRegionConstIteratorWithIndex.h"
00012
00013
00014 namespace itk
00015 {
00016
00026 template <class TInputImage, class TOutputImage>
00027 class ITK_EXPORT GradientVectorFlowImageFilter : public ImageToImageFilter<TInputImage, TOutputImage>
00028 {
00029 public:
00031 typedef GradientVectorFlowImageFilter Self;
00032
00034 typedef ImageToImageFilter<TInputImage, TOutputImage> Superclass;
00035
00037 typedef SmartPointer<Self> Pointer;
00038 typedef SmartPointer<const Self> ConstPointer;
00039
00041 itkNewMacro(Self);
00042
00044 itkTypeMacro(GradientVectorFlowImageFilter, ImageToImageFilter);
00045
00047 typedef TInputImage InputImageType;
00048 typedef TOutputImage OutputImageType;
00049
00050 typedef typename TInputImage::IndexType IndexType;
00051 typedef typename TInputImage::SizeType SizeType;
00052 typedef typename TInputImage::PixelType PixelType;
00053 typedef typename OutputImageType::Pointer OutputImagePointer;
00054 typedef typename OutputImageType::RegionType RegionType;
00055
00057
00058 typedef ImageRegionIterator<InputImageType> InputImageIterator;
00059 typedef ImageRegionConstIteratorWithIndex<InputImageType> InputImageConstIterator;
00060 typedef ImageRegionIterator<OutputImageType> OutputImageIterator;
00061
00063 itkStaticConstMacro(ImageDimension, unsigned int,
00064 TInputImage::ImageDimension);
00065
00066 typedef itk::Image<double, itkGetStaticConstMacro(ImageDimension)> InternalImageType;
00067 typedef typename InternalImageType::Pointer InternalImagePointer;
00068 typedef ImageRegionIterator<InternalImageType> InternalImageIterator;
00069
00070 typedef LaplacianImageFilter<InternalImageType, InternalImageType> LaplacianFilterType;
00071 typedef typename LaplacianFilterType::Pointer LaplacianFilterPointer;
00072
00075 itkSetMacro(LaplacianFilter, LaplacianFilterPointer);
00076
00077 itkSetMacro(TimeStep, double);
00078 itkGetMacro(TimeStep, double);
00079
00080 itkSetMacro(NoiseLevel, double);
00081 itkGetMacro(NoiseLevel, double);
00082
00083 itkSetMacro(IterationNum, int);
00084 itkGetMacro(IterationNum, int);
00085
00086 protected:
00087 GradientVectorFlowImageFilter();
00088 ~GradientVectorFlowImageFilter() {}
00089 GradientVectorFlowImageFilter(const Self&) {}
00090 void operator=(const Self&) {}
00091 void PrintSelf(std::ostream& os, Indent indent) const;
00092
00093 virtual void GenerateData();
00094
00095 void InitInterImage();
00096 void UpdateInterImage();
00097 void UpdatePixels();
00098
00099 private:
00100
00101 double m_TimeStep;
00102 double m_Steps[Superclass::InputImageDimension];
00103 double m_NoiseLevel;
00104 int m_IterationNum;
00105
00106 LaplacianFilterPointer m_LaplacianFilter;
00107 typename Superclass::InputImagePointer m_IntermediateImage;
00108 InternalImagePointer m_InternalImages[Superclass::InputImageDimension];
00109 InternalImagePointer m_BImage;
00110 typename Superclass::InputImagePointer m_CImage;
00111 };
00112
00113 }
00114
00115 #ifndef ITK_MANUAL_INSTANTIATION
00116 #include "itkGradientVectorFlowImageFilter.txx"
00117 #endif
00118
00119 #endif