Modules | Functions

Gauss Filters
[Linear Filters]

This module contains two implementations of zero-mean Gaussian filters, the FIR and the IIR versions. More...

Modules

 Gauss support
 ANI Gauss support
 oriented Gauss Filters

Functions

template<class VOXEL >
void ApplyGauss (i3d::Image3d< VOXEL > const &In, i3d::Image3d< VOXEL > &Out, const VOXEL Sigma, const float Width=3.0)
template<class VOXEL >
void ApplyGauss (i3d::Image3d< VOXEL > const &In, i3d::Image3d< VOXEL > &Out, const VOXEL SigmaX, const VOXEL SigmaY, const VOXEL SigmaZ, const float WidthX=3.0, const float WidthY=3.0, const float WidthZ=3.0)
template<class VOXEL >
void ApplyGaussZeroBorder (i3d::Image3d< VOXEL > const &In, i3d::Image3d< VOXEL > &Out, const VOXEL Sigma, const float Width=3.0)
template<class VOXEL >
void ApplyGaussZeroBorder (i3d::Image3d< VOXEL > const &In, i3d::Image3d< VOXEL > &Out, const VOXEL SigmaX, const VOXEL SigmaY, const VOXEL SigmaZ, const float WidthX=3.0, const float WidthY=3.0, const float WidthZ=3.0)
template<class VOXEL >
void ApplyIIRGauss (i3d::Image3d< VOXEL > const &In, i3d::Image3d< VOXEL > &Out, const VOXEL Sigma)
template<class VOXEL >
void ApplyIIRGauss (i3d::Image3d< VOXEL > const &In, i3d::Image3d< VOXEL > &Out, const VOXEL SigmaX, const VOXEL SigmaY, const VOXEL SigmaZ)
template<class VOXEL >
void ApplyIIRGauss2 (i3d::Image3d< VOXEL > const &In, i3d::Image3d< VOXEL > &Out, const VOXEL Sigma)
template<class VOXEL >
void ApplyIIRGauss2 (i3d::Image3d< VOXEL > const &In, i3d::Image3d< VOXEL > &Out, const VOXEL SigmaX, const VOXEL SigmaY, const VOXEL SigmaZ)
template<class VOXEL >
void ApplyIIRGauss3 (i3d::Image3d< VOXEL > const &In, i3d::Image3d< VOXEL > &Out, const VOXEL Sigma)
template<class VOXEL >
void ApplyIIRGauss3 (i3d::Image3d< VOXEL > const &In, i3d::Image3d< VOXEL > &Out, const VOXEL SigmaX, const VOXEL SigmaY, const VOXEL SigmaZ)
template<class VOXEL >
int ApplyANIGaussL (i3d::Image3d< VOXEL > const &in, i3d::Image3d< VOXEL > &out, const double xyPhi, const double xzPsi, const double sigmaX, const double sigmaY, const double sigmaZ=0.0)
template<class VOXEL >
int ApplyANIGaussU (i3d::Image3d< VOXEL > const &in, i3d::Image3d< VOXEL > &out, const double xyPhi, const double xzPsi, const double sigmaX, const double sigmaY, const double sigmaZ=0.0)
template<class VOXEL >
int ApplyANIGaussU2 (i3d::Image3d< VOXEL > const &in, i3d::Image3d< VOXEL > &out, const double xyPhi, const double xzPsi, const double sigmaX, const double sigmaY, const double sigmaZ=0.0)
template<class VOXEL , typename FLOAT >
int FullGaussFiltering (i3d::Image3d< VOXEL > const &in, i3d::Image3d< VOXEL > &out, const FLOAT Phi, const FLOAT Psi, const FLOAT xSigma, const FLOAT ySigma, const FLOAT zSigma, const int xL=0, const int yL=0, const int zL=0)
template<class VOXEL >
int GetGaussianImpulseResponse (i3d::Image3d< VOXEL > &res, const VOXEL impulse, const double xyPhi, const double xzPsi, const double sigmaX, const double sigmaY, const double sigmaZ, const int xL=51, const int yL=51, const int zL=51)

Detailed Description

This module contains two implementations of zero-mean Gaussian filters, the FIR and the IIR versions.

The FIR implementation is classical convolution performed by SeparableFilterConvolution(Image3d<>,Image3d<>,Separable3DFilter,BorderPaddings) while IIR implementations use recursive variants of SeparableFilterConvolution() or its own optimized routines (a faster option).

The "ANI" functions allows for the computation of arbitrary Gauss filter. Arbitrary means that the Gaussian can be anisotropic with its main axis arbitrarily oriented. Moreover, these functions utilize recursive filtering.

Note:
Several helper functions are present in submodules. However, these are not made available outside the library currently. Their documentation is provided for library developers.

Function Documentation

template<class VOXEL >
void ApplyGauss ( i3d::Image3d< VOXEL > const &  In,
i3d::Image3d< VOXEL > &  Out,
const VOXEL  Sigma,
const float  Width = 3.0 
)

Apply gaussian blur on image.

This is a convolution with classical FIR (Finite Impulse Response) filter. Border is mirrored in the extension.

The Sigma is the same for all involved directions of Gaussian. Also, the span of the filter along each direction is proportional to the value of the same single Sigma and Width. The selection of axes involved in the filtering depends on the respective dimensions of input image. Default Width value is 3.0.

The filter shape is computed using EstimateGaussianKernel() with dim appropriately selected.

Note:
Attention: In and Out images must be different! If both references point to the same image (memory) the result of filtering is not valid!
Parameters:
[in] In input Image3d<>
[out] Out output (Gaussian blurred) Image3d<>
[in] Sigma Sigma of the Gauss filter
[in] Width Width of the Gauss filter
Author:
Jan Hubený (xhubeny@fi.muni.cz)
Date:
2006
template<class VOXEL >
void ApplyGauss ( i3d::Image3d< VOXEL > const &  In,
i3d::Image3d< VOXEL > &  Out,
const VOXEL  SigmaX,
const VOXEL  SigmaY,
const VOXEL  SigmaZ,
const float  WidthX = 3.0,
const float  WidthY = 3.0,
const float  WidthZ = 3.0 
)

Apply gaussian blur on image.

This is a convolution with classical FIR (Finite Impulse Response) filter. Border is mirrored in the extension.

The function uses different Sigma for filtering of each axis. Also, the span of the filter along each direction is proportional to the value of the respective Sigma and Width. Axes are selected according to the values of respective sigmas and according to the size of input image along direction in question. Non-zero value of given Sigma indicates the wish to filter along respective axis. Default Width values are 3.0.

The filter shape is computed using EstimateGaussianKernel().

Note:
Attention: In and Out images must be different! If both references point to the same image (memory) the result of filtering is not valid!
Parameters:
[in] In input Image3d<>
[out] Out output (Gaussian blurred) Image3d<>
[in] SigmaX Sigma of the Gauss filter along x-axis
[in] SigmaY Sigma of the Gauss filter along y-axis
[in] SigmaZ Sigma of the Gauss filter along z-axis
[in] WidthX Width of the Gauss filter along x-axis
[in] WidthY Width of the Gauss filter along y-axis
[in] WidthZ Width of the Gauss filter along z-axis
Author:
Vladimír Ulman (xulman@fi.muni.cz)
Date:
2007
template<class VOXEL >
void ApplyGaussZeroBorder ( i3d::Image3d< VOXEL > const &  In,
i3d::Image3d< VOXEL > &  Out,
const VOXEL  Sigma,
const float  Width = 3.0 
)

Apply gaussian blur on image.

This is a convolution with classical FIR (Finite Impulse Response) filter. Border is extended by zeros.

The Sigma is the same for all involved directions of Gaussian. Also, the span of the filter along each direction is proportional to the value of the same single Sigma and Width. The selection of axes involved in the filtering depends on the respective dimensions of input image. Default Width value is 3.0.

The filter shape is computed using EstimateGaussianKernel() with dim appropriately selected.

Note:
Attention: In and Out images must be different! If both references point to the same image (memory) the result of filtering is not valid!
Parameters:
[in] In input Image3d<>
[out] Out output (Gaussian blurred) Image3d<>
[in] Sigma Sigma of the Gauss filter
[in] Width Width of the Gauss filter
Author:
Vladimír Ulman (xulman@fi.muni.cz)
Date:
2007
template<class VOXEL >
void ApplyGaussZeroBorder ( i3d::Image3d< VOXEL > const &  In,
i3d::Image3d< VOXEL > &  Out,
const VOXEL  SigmaX,
const VOXEL  SigmaY,
const VOXEL  SigmaZ,
const float  WidthX = 3.0,
const float  WidthY = 3.0,
const float  WidthZ = 3.0 
)

Apply gaussian blur on image.

This is a convolution with classical FIR (Finite Impulse Response) filter. Border is extended by zeros.

The function uses different Sigma for filtering of each axis. Also, the span of the filter along each direction is proportional to the value of the respective Sigma and Width. Axes are selected according to the values of respective sigmas and according to the size of input image along direction in question. Non-zero value of given Sigma indicates the wish to filter along respective axis. Default Width values are 3.0.

The filter shape is computed using EstimateGaussianKernel().

Note:
Attention: In and Out images must be different! If both references point to the same image (memory) the result of filtering is not valid!
Parameters:
[in] In input Image3d<>
[out] Out output (Gaussian blurred) Image3d<>
[in] SigmaX Sigma of the Gauss filter along x-axis
[in] SigmaY Sigma of the Gauss filter along y-axis
[in] SigmaZ Sigma of the Gauss filter along z-axis
[in] WidthX Width of the Gauss filter along x-axis
[in] WidthY Width of the Gauss filter along y-axis
[in] WidthZ Width of the Gauss filter along z-axis
Author:
Vladimír Ulman (xulman@fi.muni.cz)
Date:
2007
template<class VOXEL >
void ApplyIIRGauss ( i3d::Image3d< VOXEL > const &  In,
i3d::Image3d< VOXEL > &  Out,
const VOXEL  Sigma 
)

Apply gaussian blur on image when gauss filter is aproximated by IIR filter.

This is a recursive convolution with IIR (Infinite Impulse Response) filter. The filter is estimated according to [Young and Vliet, 1995]. There is no special treatment for borders what results in something similar to extending the input image with zeros.

The Sigma is the same for all involved directions of Gaussian. The selection of axes involved in the filtering depends on the respective dimensions of input image.

Sigma shouldn't be smaller than 0.5.

Parameters:
[in] In input Image3d<>
[out] Out output (Gaussian blurred) Image3d<>
[in] Sigma Sigma of the Gauss filter

Literature: I. T. Young and L. J. van Vliet. Recursive implementation of the Gaussian filter. In Signal processing 44, 2. Pages 139-151. 1995.

Note:
This is a basic IIR implementation. It is faster then FIR Gauss. The difference becomes even more substantional as Sigma increases roughly over 3. The other ApplyIIRGauss[23]() functions are better.
Attention: In and Out images must be different! If both references point to the same image (memory) the result of filtering is not valid! If you need to have In and Out the very same image, please, use then i3d::GaussIIR() (from filters.h of I3D library) which is excatly the same code with the same function call except that it uses one parameter for input and output image.
This routine utilizes the following pattern for both forwad nad backward filtering: out=B*in + b1*(out-1) + b2*(out-2) + b3*(out-3). This is the essential difference between the IIR versions of the Gauss.
This is a programing one. Unlike in ApplyIIRGauss3(), this function lacks the advanced x-direction convolution as well as improved boundary handling. We don't support this function anymore.
Author:
Vladimír Ulman (xulman@fi.muni.cz)
Date:
2007
template<class VOXEL >
void ApplyIIRGauss ( i3d::Image3d< VOXEL > const &  In,
i3d::Image3d< VOXEL > &  Out,
const VOXEL  SigmaX,
const VOXEL  SigmaY,
const VOXEL  SigmaZ 
)

Apply gaussian blur on image when gauss filter is aproximated by IIR filter.

This is a recursive convolution with IIR (Infinite Impulse Response) filter. The filter is estimated according to [Young and Vliet, 1995]. There is no special treatment for borders what results in something similar to extending the input image with zeros.

The function uses different Sigma for filtering of each axis. Axes are selected according to the values of respective sigmas and according to the size of input image along direction in question. Non-zero value of given Sigma indicates the wish to filter along respective axis.

Sigma shouldn't be smaller than 0.5. Or should be exactly zero to show along which axis filtering shouldn't take place.

Parameters:
[in] In input Image3d<>
[out] Out output (Gaussian blurred) Image3d<>
[in] SigmaX Sigma of the Gauss filter along x-axis
[in] SigmaY Sigma of the Gauss filter along y-axis
[in] SigmaZ Sigma of the Gauss filter along z-axis

Literature: I. T. Young and L. J. van Vliet. Recursive implementation of the Gaussian filter. In Signal processing 44, 2. Pages 139-151. 1995.

Note:
This is a basic IIR implementation. It is faster then FIR Gauss. The difference becomes even more substantional as Sigma increases roughly over 3. The other ApplyIIRGauss[23]() functions are better.
Attention: In and Out images must be different! If both references point to the same image (memory) the result of filtering is not valid! If you need to have In and Out the very same image, please, use then i3d::GaussIIR() (from filters.h of I3D library) which is excatly the same code with the same function call except that it uses one parameter for input and output image.
This routine utilizes the following pattern for both forwad nad backward filtering: out=B*in + b1*(out-1) + b2*(out-2) + b3*(out-3). This is the essential difference between the IIR versions of the Gauss.
This is a programing one. Unlike in ApplyIIRGauss3(), this function lacks the advanced x-direction convolution as well as improved boundary handling. We don't support this function anymore.
Author:
Vladimír Ulman (xulman@fi.muni.cz)
Date:
2007
template<class VOXEL >
void ApplyIIRGauss2 ( i3d::Image3d< VOXEL > const &  In,
i3d::Image3d< VOXEL > &  Out,
const VOXEL  Sigma 
)

Apply gaussian blur on image when gauss filter is aproximated by IIR filter.

This is a recursive convolution with IIR (Infinite Impulse Response) filter. The filter is estimated according to [Vliet and Young, 1998]. The borders are treated by extending the boundary value as neccessary.

The Sigma is the same for all involved directions of Gaussian. The selection of axes involved in the filtering depends on the respective dimensions of input image.

Sigma shouldn't be smaller than 1.0.

Parameters:
[in] In input Image3d<>
[out] Out output (Gaussian blurred) Image3d<>
[in] Sigma Sigma of the Gauss filter

Literature: I. T. Young and L. J. van Vliet. Recursive Gaussian derivative filter. Proceedings of 14th International Conference on Pattern Recognition (ICPR'98), Vol. I. Pages 509-514. 1998.

Note:
It is faster then FIR Gauss. The difference becomes even more substantional as Sigma increases roughly over 3. It is also faster and more accurate then ApplyIIRGauss().
Attention: In and Out images must be different! If both references point to the same image (memory) the result of filtering is not valid!
This routine utilizes the following pattern for both forwad nad backward filtering: out=A*in - b1*(out-1) - b2*(out-2) - b3*(out-3). This is the essential difference between the IIR versions of the Gauss.
This is a programing one. Unlike in ApplyIIRGauss3(), this function lacks the advanced x-direction convolution as well as improved boundary handling. We don't support this function anymore.
Author:
Vladimír Ulman (xulman@fi.muni.cz)
Date:
2007
template<class VOXEL >
void ApplyIIRGauss2 ( i3d::Image3d< VOXEL > const &  In,
i3d::Image3d< VOXEL > &  Out,
const VOXEL  SigmaX,
const VOXEL  SigmaY,
const VOXEL  SigmaZ 
)

Apply gaussian blur on image when gauss filter is aproximated by IIR filter.

This is a recursive convolution with IIR (Infinite Impulse Response) filter. The filter is estimated according to [Vliet and Young, 1998]. The borders are treated by extending the boundary value as neccessary.

The function uses different Sigma for filtering of each axis. Axes are selected according to the values of respective sigmas and according to the size of input image along direction in question. Non-zero value of given Sigma indicates the wish to filter along respective axis.

Sigma shouldn't be smaller than 1.0. Or should be exactly zero to show along which axis filtering shouldn't take place.

Parameters:
[in] In input Image3d<>
[out] Out output (Gaussian blurred) Image3d<>
[in] SigmaX Sigma of the Gauss filter along x-axis
[in] SigmaY Sigma of the Gauss filter along y-axis
[in] SigmaZ Sigma of the Gauss filter along z-axis

Literature: I. T. Young and L. J. van Vliet. Recursive Gaussian derivative filter. Proceedings of 14th International Conference on Pattern Recognition (ICPR'98), Vol. I. Pages 509-514. 1998.

Note:
It is faster then FIR Gauss. The difference becomes even more substantional as Sigma increases roughly over 3. It is also faster and more accurate then ApplyIIRGauss().
Attention: In and Out images must be different! If both references point to the same image (memory) the result of filtering is not valid!
This routine utilizes the following pattern for both forwad nad backward filtering: out=A*in - b1*(out-1) - b2*(out-2) - b3*(out-3). This is the essential difference between the IIR versions of the Gauss.
This is a programing one. Unlike in ApplyIIRGauss3(), this function lacks the advanced x-direction convolution as well as improved boundary handling. We don't support this function anymore.
Author:
Vladimír Ulman (xulman@fi.muni.cz)
Date:
2007
template<class VOXEL >
void ApplyIIRGauss3 ( i3d::Image3d< VOXEL > const &  In,
i3d::Image3d< VOXEL > &  Out,
const VOXEL  Sigma 
)

Apply gaussian blur on image when gauss filter is aproximated by IIR filter.

This is a recursive convolution with IIR (Infinite Impulse Response) filter. The filter is estimated according to [Vliet, Young and Ginkel, 2002]. The borders are treated by extending the boundary value as neccessary, according to [Triggs and Sdika, 2006].

The Sigma is the same for all involved directions of Gaussian. The selection of axes involved in the filtering depends on the respective dimensions of input image.

Sigma shouldn't be smaller than 1.0.

Parameters:
[in] In input Image3d<>
[out] Out output (Gaussian blurred) Image3d<>
[in] Sigma Sigma of the Gauss filter

Literature: I. T. Young, L. J. van Vliet and M. van Ginkel. Recursive Gabor filtering. In Signal processing 50, 11. Pages 2798-2805. 2002.

Literature: B. Triggs and M. Sdika. Boundary conditions for Young-van Vliet recursive filtering. In Signal processing 54, 5. 2006.

Note:
This is the prefered IIR implementation. It is faster then FIR Gauss. The difference becomes even more substantional as Sigma increases roughly over 3. It is even faster and more accurate then ApplyIIRGauss() and ApplyIIRGauss2().
Attention: In and Out images must be different! If both references point to the same image (memory) the result of filtering is not valid!
This routine utilizes the pattern out=in - b1*(out-1) - b2*(out-2) - b3*(out-3) for the forward filtering while out=B*in - b1*(out-1) - b2*(out-2) - b3*(out-3) for the backward filtering. This is the essential difference between the IIR versions of the Gauss.
This is a programing one. This function uses advanced x-direction convolution (3 xLines are computed in paralel) what introduces almost 3x faster processing of convolution along x-axis. Also boundary initialization for the backward phase has been improved what results in a slightly different convolution results due to different evaluation of arithmetic.
Author:
Vladimír Ulman (xulman@fi.muni.cz)
Date:
2007
template<class VOXEL >
void ApplyIIRGauss3 ( i3d::Image3d< VOXEL > const &  In,
i3d::Image3d< VOXEL > &  Out,
const VOXEL  SigmaX,
const VOXEL  SigmaY,
const VOXEL  SigmaZ 
)

Apply gaussian blur on image when gauss filter is aproximated by IIR filter.

This is a recursive convolution with IIR (Infinite Impulse Response) filter. The filter is estimated according to [Vliet, Young and Ginkel, 2002]. The borders are treated by extending the boundary value as neccessary, according to [Triggs and Sdika, 2006].

The function uses different Sigma for filtering of each axis. Axes are selected according to the values of respective sigmas and according to the size of input image along direction in question. Non-zero value of given Sigma indicates the wish to filter along respective axis.

Sigma shouldn't be smaller than 1.0. Or should be exactly zero to show along which axis filtering shouldn't take place.

Parameters:
[in] In input Image3d<>
[out] Out output (Gaussian blurred) Image3d<>
[in] SigmaX Sigma of the Gauss filter along x-axis
[in] SigmaY Sigma of the Gauss filter along y-axis
[in] SigmaZ Sigma of the Gauss filter along z-axis

Literature: I. T. Young, L. J. van Vliet and M. van Ginkel. Recursive Gabor filtering. In Signal processing 50, 11. Pages 2798-2805. 2002.

Literature: B. Triggs and M. Sdika. Boundary conditions for Young-van Vliet recursive filtering. In Signal processing 54, 5. 2006.

Note:
This is the prefered IIR implementation. It is faster then FIR Gauss. The difference becomes even more substantional as Sigma increases roughly over 3. It is even faster and more accurate then ApplyIIRGauss() and ApplyIIRGauss2().
Attention: In and Out images must be different! If both references point to the same image (memory) the result of filtering is not valid!
This routine utilizes the pattern out=in - b1*(out-1) - b2*(out-2) - b3*(out-3) for the forward filtering while out=B*in - b1*(out-1) - b2*(out-2) - b3*(out-3) for the backward filtering. This is the essential difference between the IIR versions of the Gauss.
This is a programing one. This function uses advanced x-direction convolution (3 xLines are computed in paralel) what introduces almost 3x faster processing of convolution along x-axis. Also boundary initialization for the backward phase has been improved what results in a slightly different convolution results due to different evaluation of arithmetic.
Author:
Vladimír Ulman (xulman@fi.muni.cz)
Date:
2007
template<class VOXEL >
int ApplyANIGaussL ( i3d::Image3d< VOXEL > const &  in,
i3d::Image3d< VOXEL > &  out,
const double  xyPhi,
const double  xzPsi,
const double  sigmaX,
const double  sigmaY,
const double  sigmaZ = 0.0 
)

Compute arbitrarily oriented anisotropic Gauss. The implementation is based on the paper by [Lampert and Wirjadi, 2006]. Basically, given 3D Gaussian filter is computed using a cascade of three 1D convolutions, two of them runs along some directional vector. Linear and bilinear interpolation is involved due to non-integer definition of both directional vectors.

Technically, this function is a wrapper to the ComputeLampertParams() and ApplyIIRGauss*() calling sequence.

Parameters:
[in] in input image
[out] out output image, its size will be adjusted
[in] xyPhi orientation of filter's main axis (in radians)
[in] xzPsi orientation of filter's main axis (in radians)
[in] sigmaX sigma along main axis
[in] sigmaY sigma along axis perpendicular to the main axis in the xyPlane
[in] sigmaZ sigma along axis perpendicular to both previous axes

The orientation is driven by the xyPhi and xzPsi parameters. Originally, the base filter is oriented along main Euclidean axis XYZ with X being the main directions axis. The filter, that is to be computed, is imaginary created by steering the base filter in the xyPlane by xyPhi radians clockwise. The filter is then tilted (rotated along newly positioned axis Y) by xzPsi radians. The span of the filter is given by its sigma[XYZ].

The filter is computed using 3 convolutions running along specialy oriented axes. Each convolution is 1D internally and is realized by the IIR filter as suggested by [Vliet, Young and Ginkel, 2002].

The function can handle both 2D and 3D images. The following three cases are accepted:

  • a truly 3D task when input image is 3D and all sigma[XYZ] are non-zero: A proper 3D convolution is computed in this case.
  • a pseudo-3D task when input image is 3D and sigmaZ is zero: The image is considered as a stack of 2D images and so many plane-wise 2D convolutions are computed.
  • a truly 2D task when input image is 2D and sigmaZ is zero.

In the latter two cases, the parameter xzPsi is ignored.

Literature: Ch. H. Lampert and O. Wirjadi. An Optimal Nonorthogonal Separation of the Anisotropic Gaussian Convolution Filter. In IEEE Transactions on Image Processing 15, 11. Pages 3501-3513. 2006.

Literature: I. T. Young, L. J. van Vliet and M. van Ginkel. Recursive Gabor filtering. In Signal processing 50, 11. Pages 2798-2805. 2002.

Note:
Attention: In and Out images must be different! If both references point to the same image (memory) the result of filtering is not valid!
Returns:
  • 0 when image was filtered
  • 1 when negative sigmas were supplied
  • 2 when suitable parameters for filtering were not found
  • 3 when wrong configuration of input parameters
Author:
Vladimír Ulman (xulman@fi.muni.cz)
Date:
2008
template<class VOXEL >
int ApplyANIGaussU ( i3d::Image3d< VOXEL > const &  in,
i3d::Image3d< VOXEL > &  out,
const double  xyPhi,
const double  xzPsi,
const double  sigmaX,
const double  sigmaY,
const double  sigmaZ = 0.0 
)

Compute arbitrarily oriented anisotropic Gauss. The implementation is an extension of the ideas of [Lam and Shi, 2007]. Basically, given 3D Gaussian filter is computed using a cascade of six 1D convolutions, each runs along integer-defined directional vector. Hence the need for interpolation is diminished.

Technically, this function is a wrapper to the GetParamsANIGaussU() and ApplyBaseConvolutions() calling sequence.

Parameters:
[in] in input image
[out] out output image, its size will be adjusted
[in] xyPhi orientation of filter's main axis (in radians)
[in] xzPsi orientation of filter's main axis (in radians)
[in] sigmaX sigma along main axis
[in] sigmaY sigma along axis perpendicular to the main axis in the xyPlane
[in] sigmaZ sigma along axis perpendicular to both previous axes

The orientation is driven by the xyPhi and xzPsi parameters. Originally, the base filter is oriented along main Euclidean axis XYZ with X being the main directions axis. The filter, that is to be computed, is imaginary created by steering the base filter in the xyPlane by xyPhi radians clockwise. The filter is then tilted (rotated along newly positioned axis Y) by xzPsi radians. The span of the filter is given by its sigma[XYZ].

The filter is computed using 6 convolutions running along specialy oriented axes. Each convolution is 1D internally and is realized by the IIR filter as suggested by [Vliet, Young and Ginkel, 2002].

The function can handle both 2D and 3D images. The following three cases are accepted:

  • a truly 3D task when input image is 3D and all sigma[XYZ] are non-zero: A proper 3D convolution is computed in this case.
  • a pseudo-3D task when input image is 3D and sigmaZ is zero: The image is considered as a stack of 2D images and so many plane-wise 2D convolutions are computed.
  • a truly 2D task when input image is 2D and sigmaZ is zero.

In the latter two cases, the parameter xzPsi is ignored.

Literature: I. T. Young, L. J. van Vliet and M. van Ginkel. Recursive Gabor filtering. In Signal processing 50, 11. Pages 2798-2805. 2002.

Literature: S. Y. M. Lam and B. E. Shi. Recursive Anisotropic 2-D Gaussian Filtering Based on a Triple-axis Decomposition. In IEEE Transactions on Image Processing 16, 7. Pages 1925-1930. 2007.

Note:
Attention: In and Out images must be different! If both references point to the same image (memory) the result of filtering is not valid!
Returns:
  • 0 when image was filtered
  • 1 when negative sigmas were supplied
  • 2 when suitable bases were not found
  • 3 when wrong configuration of input parameters
Author:
Vladimír Ulman (xulman@fi.muni.cz)
Date:
2008
template<class VOXEL >
int ApplyANIGaussU2 ( i3d::Image3d< VOXEL > const &  in,
i3d::Image3d< VOXEL > &  out,
const double  xyPhi,
const double  xzPsi,
const double  sigmaX,
const double  sigmaY,
const double  sigmaZ = 0.0 
)

Computes arbitrarily oriented anisotropic Gauss.

In fact, it is the same function as ApplyANIGaussU() except for 3D filtering in which different initial base sets are used. The GetParamsANIGaussU2() is used instead of GetParamsANIGaussU(). Otherwise, it is again just a wrapper to the GetParamsANIGaussU2() and ApplyBaseConvolutions() calling sequence.

Parameters:
[in] in input image
[out] out output image, its size will be adjusted
[in] xyPhi orientation of filter's main axis (in radians)
[in] xzPsi orientation of filter's main axis (in radians)
[in] sigmaX sigma along main axis
[in] sigmaY sigma along axis perpendicular to the main axis in the xyPlane
[in] sigmaZ sigma along axis perpendicular to both previous axes

Look here for detailed explanation of input parameters.

Note:
Attention: In and Out images must be different! If both references point to the same image (memory) the result of filtering is not valid!
Returns:
  • 0 when image was filtered
  • 1 when negative sigmas were supplied
  • 2 when suitable bases were not found
  • 3 when wrong configuration of input parameters
Author:
Vladimír Ulman (xulman@fi.muni.cz)
Date:
2008
template<class VOXEL , typename FLOAT >
int FullGaussFiltering ( i3d::Image3d< VOXEL > const &  in,
i3d::Image3d< VOXEL > &  out,
const FLOAT  Phi,
const FLOAT  Psi,
const FLOAT  xSigma,
const FLOAT  ySigma,
const FLOAT  zSigma,
const int  xL = 0,
const int  yL = 0,
const int  zL = 0 
)

A naive-convolution for 3D Gaussian.

This computes the time-demanding full 3D convolution. Firstly, the kernel image is created and filled. Secondly, the full convolution of input image in with kernel image is computed. The result is stored in the out image.

The size of kernel image is given by xL, yL and zL. If some of these is zero, an automagical size determination is applied what amounts to setting the length to ceil(6*sigma) where sigma is xSigma when xL is zero and so on.

The input arbitrary (orientention and anisotropy) 3D zero-mean Gaussian is given by Phi and Psi, xSigma, ySigma and zSigma as expected. The convolution kernel is filled from the covariance matrix which is established accordingly beforehand.

Parameters:
[in] in input image
[out] out output image, its size will be adjusted
[in] Phi orientation of filter's main axis
[in] Psi orientation of filter's main axis
[in] xSigma sigma along main axis
[in] ySigma sigma along axis perpendicular to the main axis in the xyPlane
[in] zSigma sigma along axis perpendicular to both previous axes
[in] xL the length of the convolution kernel along x-axis
[in] yL the length of the convolution kernel along y-axis
[in] zL the length of the convolution kernel along z-axis
Returns:
  • 0 on success
  • 1 on wrong input parameters
Author:
Vladimír Ulman (xulman@fi.muni.cz)
Date:
2008
template<class VOXEL >
int GetGaussianImpulseResponse ( i3d::Image3d< VOXEL > &  res,
const VOXEL  impulse,
const double  xyPhi,
const double  xzPsi,
const double  sigmaX,
const double  sigmaY,
const double  sigmaZ,
const int  xL = 51,
const int  yL = 51,
const int  zL = 51 
)

Compute a sample impulse response image.

An output image of (xL,yL,zL) will be created. A hypothetical 3D Gaussian, given by this function's parameters with mean 0.0, will be applied on the impulse of magnitude impulse. The Gaussian equation will be multiplied by the impulse to simulate the real convolution. Results of such evaluation will be stored in the output image. Note that no convolution will take place at all. Hence, one will usually get the result very fast.

If impulse is negative, then only the exponential term in the Gaussian equation will be computed, multiplied by -impulse and stored in the output image. This disables the normalization factor in the Gaussian.

Obviously, xL, yL and zL shall not be negative or zero. Moreover, each must be an odd number owing to the simulation of the convolution in which an input impulse is located directly in the centre of the convolved image. Computing the centre of even-sized image is somewhat troublesome. The output image will have set the resolution to (1,1,1) and the offset to (0,0,0).

Parameters:
[out] res output image with correct/expected impulse response
[in] impulse the impulse's value
[in] xyPhi orientation of filter's main axis (in radians)
[in] xzPsi orientation of filter's main axis (in radians)
[in] sigmaX sigma along main axis
[in] sigmaY sigma along axis perpendicular to the main axis in the xyPlane
[in] sigmaZ sigma along axis perpendicular to both previous axes
[in] xL the size of output image
[in] yL the size of output image
[in] zL the size of output image
Note:
2D response in xy-plane may be obtained by setting: xzPsi=0, sigmaZ=0 and zL=1.
1D response in x-row may be obtained by setting: xyPhi=xzPsi=0, sigmaY=sigmaZ=0 and yL=zL=1.
The filter and its mirror are the same (owing to the zero mean and Gaussian's symmetry). Hence, it can be used to generate kernel for some convolution or give directly filter's sample response on a single impulse.
Returns:
  • 0 on success
  • 1 on wrong input parameters
Author:
Vladimír Ulman (xulman@fi.muni.cz)
Date:
2008