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

itkGradientVectorFlowImageFilter.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Insight Segmentation & Registration Toolkit
00004   Module:    $RCSfile: itkGradientVectorFlowImageFilter.h,v $
00005   Language:  C++
00006   Date:      $Date: 2009-04-23 03:53:35 $
00007   Version:   $Revision: 1.15 $
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 __itkGradientVectorFlowImageFilter_h
00018 #define __itkGradientVectorFlowImageFilter_h
00019 
00020 #include "itkImageToImageFilter.h"
00021 #include "vnl/vnl_matrix_fixed.h"
00022 #include "vnl/vnl_math.h"
00023 #include "itkImage.h"
00024 #include "itkVector.h"
00025 #include "itkLaplacianImageFilter.h"
00026 #include "itkImageRegionIterator.h"
00027 #include "itkImageRegionConstIteratorWithIndex.h"
00028 
00029 namespace itk
00030 {
00031 
00041 template <class TInputImage, class TOutputImage, class TInternalPixel=double>
00042 class ITK_EXPORT GradientVectorFlowImageFilter : public ImageToImageFilter<TInputImage, TOutputImage>
00043 {
00044 public:
00046   typedef GradientVectorFlowImageFilter  Self;
00047 
00049   typedef ImageToImageFilter<TInputImage, TOutputImage> Superclass;
00050 
00052   typedef SmartPointer<Self>        Pointer;
00053   typedef SmartPointer<const Self>  ConstPointer;
00054 
00056   itkNewMacro(Self);
00057 
00059   itkTypeMacro(GradientVectorFlowImageFilter, ImageToImageFilter);
00060 
00062   typedef TInputImage  InputImageType;
00063   typedef TOutputImage OutputImageType;
00064 
00065   typedef typename TInputImage::IndexType      IndexType;
00066   typedef typename TInputImage::SizeType       SizeType;
00067   typedef typename TInputImage::PixelType      PixelType;
00068   typedef typename OutputImageType::Pointer    OutputImagePointer;
00069   typedef typename OutputImageType::RegionType RegionType;
00070 
00072 //  typedef ImageRegionConstIterator<InputImageType> InputImageConstIterator;
00073   typedef ImageRegionIterator<InputImageType>                InputImageIterator;
00074   typedef ImageRegionConstIteratorWithIndex<InputImageType>  InputImageConstIterator;
00075   typedef ImageRegionIterator<OutputImageType>               OutputImageIterator;
00076 
00078   itkStaticConstMacro(ImageDimension, unsigned int,
00079                       TInputImage::ImageDimension);
00080   itkStaticConstMacro(OutputImageDimension, unsigned int,
00081                       TOutputImage::ImageDimension);
00083 
00084   typedef TInternalPixel                         InternalPixelType;
00085   typedef itk::Image<InternalPixelType, itkGetStaticConstMacro(ImageDimension)>
00086                                                  InternalImageType;
00087   typedef typename InternalImageType::Pointer    InternalImagePointer;
00088   typedef ImageRegionIterator<InternalImageType> InternalImageIterator;
00089 
00090   typedef LaplacianImageFilter<InternalImageType, InternalImageType>
00091                                                  LaplacianFilterType;
00092   typedef typename LaplacianFilterType::Pointer  LaplacianFilterPointer;
00093 
00096   itkSetMacro(LaplacianFilter, LaplacianFilterPointer);
00097 
00098   itkSetMacro(TimeStep, double);
00099   itkGetConstMacro(TimeStep, double);
00100 
00101   itkSetMacro(NoiseLevel, double);
00102   itkGetConstMacro(NoiseLevel, double);
00103 
00104   itkSetMacro(IterationNum, int);
00105   itkGetConstMacro(IterationNum, int);
00106 
00107 #ifdef ITK_USE_CONCEPT_CHECKING
00108 
00109   itkConceptMacro(SameDimensionCheck,
00110     (Concept::SameDimension<ImageDimension, OutputImageDimension>));
00111   itkConceptMacro(InputHasNumericTraitsCheck,
00112     (Concept::HasNumericTraits<typename PixelType::ValueType>));
00113   itkConceptMacro(OutputHasNumericTraitsCheck,
00114     (Concept::HasNumericTraits<typename TOutputImage::PixelType::ValueType>));
00115 
00117 #endif
00118 
00119 protected:
00120   GradientVectorFlowImageFilter();
00121   ~GradientVectorFlowImageFilter() {}
00122   GradientVectorFlowImageFilter(const Self&) {}
00123   void operator=(const Self&) {}
00124   void PrintSelf(std::ostream& os, Indent indent) const; 
00125 
00126   virtual void GenerateData();
00127 
00128   void InitInterImage();
00129   void UpdateInterImage();
00130   void UpdatePixels();
00131 
00132 private:
00133   // parameters;
00134   double m_TimeStep; //the timestep of each iteration
00135   double m_Steps[Superclass::InputImageDimension]; // set to be 1 in all directions in most cases
00136   double m_NoiseLevel; // the noise level of the image
00137   int    m_IterationNum;  // the iteration number
00138 
00139   LaplacianFilterPointer                 m_LaplacianFilter;
00140   typename Superclass::InputImagePointer m_IntermediateImage;
00141 
00142   InternalImagePointer m_InternalImages[Superclass::InputImageDimension];
00143   InternalImagePointer m_BImage;  // store the "b" value for every pixel
00144 
00145   typename Superclass::InputImagePointer m_CImage; // store the $c_i$ value for every pixel
00146 };
00147 
00148 } // end namespace itk
00149 
00150 #ifndef ITK_MANUAL_INSTANTIATION
00151 #include "itkGradientVectorFlowImageFilter.txx"
00152 #endif
00153 
00154 #endif
00155 

Generated at Mon Jul 12 2010 18:26:23 for ITK by doxygen 1.7.1 written by Dimitri van Heesch, © 1997-2000