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

itkGaussianBlurImageFunction.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Insight Segmentation & Registration Toolkit
00004   Module:    $RCSfile: itkGaussianBlurImageFunction.h,v $
00005   Language:  C++
00006   Date:      $Date: 2007/02/08 18:55:54 $
00007   Version:   $Revision: 1.13 $
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 __itkGaussianBlurImageFunction_h
00018 #define __itkGaussianBlurImageFunction_h
00019 
00020 #include "itkNeighborhoodOperatorImageFunction.h"
00021 #include "itkGaussianOperator.h"
00022 #include "itkGaussianSpatialFunction.h"
00023 #include "itkImageFunction.h"
00024 #include "itkCastImageFilter.h"
00025 
00026 namespace itk
00027 {
00028 
00038 template <class TInputImage,class TOutput=double>
00039 class ITK_EXPORT GaussianBlurImageFunction :
00040   public ImageFunction< TInputImage, TOutput >
00041 {
00042 public:
00043 
00045   typedef GaussianBlurImageFunction Self;
00046 
00048   typedef ImageFunction<TInputImage, TOutput> Superclass;
00049 
00051   typedef SmartPointer<Self> Pointer;
00052   typedef SmartPointer<const Self>  ConstPointer;
00053 
00055   itkNewMacro(Self);
00056 
00058   itkTypeMacro( GaussianBlurImageFunction, ImageFunction );
00059 
00061   typedef TInputImage                                 InputImageType;
00062   typedef typename InputImageType::PixelType          InputPixelType;
00063   typedef typename Superclass::IndexType              IndexType;
00064   typedef typename Superclass::ContinuousIndexType    ContinuousIndexType;
00065 
00066 
00068   itkStaticConstMacro(ImageDimension, unsigned int,
00069                       InputImageType::ImageDimension);
00070 
00071   typedef GaussianOperator<TOutput,
00072                            itkGetStaticConstMacro(ImageDimension)> 
00073                                                       GaussianOperatorType;
00074   typedef Neighborhood<TOutput, itkGetStaticConstMacro(ImageDimension)> NeighborhoodType;
00075   typedef FixedArray<NeighborhoodType,itkGetStaticConstMacro(ImageDimension)> OperatorArrayType;
00076   
00077   typedef GaussianSpatialFunction<TOutput,1>  GaussianFunctionType;
00078   typedef typename GaussianFunctionType::Pointer GaussianFunctionPointer;
00079   typedef itk::Image<double,itkGetStaticConstMacro(ImageDimension)> InternalImageType;
00080   typedef typename InternalImageType::Pointer InternalImagePointer;
00081 
00082   typedef NeighborhoodOperatorImageFunction<InternalImageType,
00083                                              TOutput> OperatorImageFunctionType;
00084   typedef typename OperatorImageFunctionType::Pointer OperatorImageFunctionPointer;
00085 
00086   typedef itk::CastImageFilter<InputImageType,InternalImageType> CastImageFilterType;
00087   typedef typename CastImageFilterType::Pointer CastImageFilterPointer;
00088 
00089   typedef itk::FixedArray< double, 
00090                   itkGetStaticConstMacro(ImageDimension) >   ErrorArrayType;
00091 
00092   typedef itk::FixedArray< double, 
00093                   itkGetStaticConstMacro(ImageDimension) >   ExtentArrayType;
00094 
00095   typedef itk::FixedArray< double, 
00096                   itkGetStaticConstMacro(ImageDimension) >   SigmaArrayType;
00097 
00099   typedef typename Superclass::PointType PointType;
00100 
00102    virtual TOutput Evaluate(const PointType& point) const;
00103 
00104 
00106   virtual TOutput EvaluateAtIndex( const IndexType & index ) const;
00107 
00109   virtual TOutput EvaluateAtContinuousIndex( 
00110     const ContinuousIndexType & index ) const;
00111 
00118   void SetSigma( const double* sigma);
00119   void SetSigma( const float* sigma);
00120   void SetSigma( const double sigma);
00121   itkSetMacro( Sigma, SigmaArrayType );
00122   itkGetConstReferenceMacro( Sigma, SigmaArrayType );
00124 
00129   virtual void SetInputImage( const InputImageType * ptr );
00130 
00134   itkSetMacro( Extent, ExtentArrayType );
00135   itkGetConstReferenceMacro( Extent, ExtentArrayType );
00136   void SetExtent( const double* extent);
00137   void SetExtent( const double extent);
00139 
00143   itkSetMacro( MaximumError, ErrorArrayType );
00144   itkGetConstReferenceMacro( MaximumError, ErrorArrayType );
00146 
00151   itkSetMacro( MaximumKernelWidth, int );
00152   itkGetMacro( MaximumKernelWidth, int );
00154 
00160   itkSetMacro( UseImageSpacing, bool );
00161   itkGetMacro( UseImageSpacing, bool );
00162   itkBooleanMacro( UseImageSpacing );
00164 
00165 
00166 protected:
00167   GaussianBlurImageFunction();
00168   GaussianBlurImageFunction( const Self& ){};
00169 
00170   ~GaussianBlurImageFunction(){};
00171 
00172   void operator=( const Self& ){};
00173   void PrintSelf(std::ostream& os, Indent indent) const;
00174 
00175   void RecomputeGaussianKernel();
00176   void RecomputeContinuousGaussianKernel(const double* offset) const;
00177 
00178 private:
00179   
00180   SigmaArrayType                m_Sigma;
00181   OperatorImageFunctionPointer  m_OperatorImageFunction;
00182   mutable OperatorArrayType     m_OperatorArray;
00183   mutable OperatorArrayType     m_ContinuousOperatorArray;
00184   InternalImagePointer          m_InternalImage;
00185   CastImageFilterPointer        m_Caster;
00186 
00190   ErrorArrayType                m_MaximumError;
00191   ExtentArrayType               m_Extent;
00192 
00195   int m_MaximumKernelWidth;
00196 
00198   unsigned int m_FilterDimensionality;
00199 
00201   bool m_UseImageSpacing;
00202 
00204   GaussianFunctionPointer m_GaussianFunction;
00205 };
00206 
00207 } // end namespace itk
00208 
00209 // Define instantiation macro for this template.
00210 #define ITK_TEMPLATE_GaussianBlurImageFunction(_, EXPORT, x, y) namespace itk { \
00211   _(2(class EXPORT GaussianBlurImageFunction< ITK_TEMPLATE_2 x >)) \
00212   namespace Templates { typedef GaussianBlurImageFunction< ITK_TEMPLATE_2 x > \
00213                                                   GaussianBlurImageFunction##y; } \
00214   }
00215 
00216 #if ITK_TEMPLATE_EXPLICIT
00217 # include "Templates/itkGaussianBlurImageFunction+-.h"
00218 #endif
00219 
00220 #if ITK_TEMPLATE_TXX
00221 # include "itkGaussianBlurImageFunction.txx"
00222 #endif
00223 
00224 #endif
00225 
00226 

Generated at Mon Mar 12 00:25:50 2007 for ITK by doxygen 1.5.1 written by Dimitri van Heesch, © 1997-2000