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 itkStaticConstMacro(OutputImageDimension, unsigned int,
00066 TOutputImage::ImageDimension);
00068
00069 typedef itk::Image<double, itkGetStaticConstMacro(ImageDimension)> InternalImageType;
00070 typedef typename InternalImageType::Pointer InternalImagePointer;
00071 typedef ImageRegionIterator<InternalImageType> InternalImageIterator;
00072
00073 typedef LaplacianImageFilter<InternalImageType, InternalImageType> LaplacianFilterType;
00074 typedef typename LaplacianFilterType::Pointer LaplacianFilterPointer;
00075
00078 itkSetMacro(LaplacianFilter, LaplacianFilterPointer);
00079
00080 itkSetMacro(TimeStep, double);
00081 itkGetMacro(TimeStep, double);
00082
00083 itkSetMacro(NoiseLevel, double);
00084 itkGetMacro(NoiseLevel, double);
00085
00086 itkSetMacro(IterationNum, int);
00087 itkGetMacro(IterationNum, int);
00088
00089 #ifdef ITK_USE_CONCEPT_CHECKING
00090
00091 itkConceptMacro(SameDimensionCheck,
00092 (Concept::SameDimension<ImageDimension, OutputImageDimension>));
00093 itkConceptMacro(InputHasNumericTraitsCheck,
00094 (Concept::HasNumericTraits<typename PixelType::ValueType>));
00095 itkConceptMacro(OutputHasNumericTraitsCheck,
00096 (Concept::HasNumericTraits<typename TOutputImage::PixelType::ValueType>));
00097
00099 #endif
00100
00101 protected:
00102 GradientVectorFlowImageFilter();
00103 ~GradientVectorFlowImageFilter() {}
00104 GradientVectorFlowImageFilter(const Self&) {}
00105 void operator=(const Self&) {}
00106 void PrintSelf(std::ostream& os, Indent indent) const;
00107
00108 virtual void GenerateData();
00109
00110 void InitInterImage();
00111 void UpdateInterImage();
00112 void UpdatePixels();
00113
00114 private:
00115
00116 double m_TimeStep;
00117 double m_Steps[Superclass::InputImageDimension];
00118 double m_NoiseLevel;
00119 int m_IterationNum;
00120
00121 LaplacianFilterPointer m_LaplacianFilter;
00122 typename Superclass::InputImagePointer m_IntermediateImage;
00123 InternalImagePointer m_InternalImages[Superclass::InputImageDimension];
00124 InternalImagePointer m_BImage;
00125 typename Superclass::InputImagePointer m_CImage;
00126 };
00127
00128 }
00129
00130 #ifndef ITK_MANUAL_INSTANTIATION
00131 #include "itkGradientVectorFlowImageFilter.txx"
00132 #endif
00133
00134 #endif
00135