[Insight-developers] Gaussian filter performance
Luis Ibanez
luis.ibanez@kitware.com
Fri, 09 May 2003 11:10:41 -0400
Hi Paul,
As Bill pointed out, the RecursiveGaussian applies the blurring only
in one dimension. When you use it in 3D you need to concatenate three
of these filters, each blurring along one axis.
Did you do this for your test ?
Otherwise the times may have to be multiplied by 3 (roughtly)...
For convenience a filter was recently added for smoothing with the
recursive gaussians. It just creates a minipipeline with N filters:
http://www.itk.org/Insight/Doxygen/html/classitk_1_1SmoothingRecursiveGaussianImageFilter.html
An example is available in Insight/Examples/Filtering.
The computing time of the DiscreteGaussian depends on the error
threshold that you select with SetMaximumError(). This filters adapts
the kernel size in order to approximate the gaussian to the precision
required by the user. The lower the threshold, the larger the kernel
size will be. You can limit how far the kernel can grow by using the
SetMaximumKernelWidth.
So, the tricky thing here is that there is no "a single"
DiscreteGaussian but any number of them, and their performance will
depend on the precision you select. The only fair comparision will
require to figure out the precision of the gaussian approximation in
the IIR filters of the Recursive gaussian, and then use the same quality
criterion for the Discrete gaussian. Only then we may be comparing the
computational burden required for producing a similar output (all this
with the same sigma, of course).
One factor that you may want to add to the trade-off, is memory
consumption. The RecursiveGaussians are faster in general, but also
require N times more memory (N = image dimension) since they concatenate
N filters. In the SmoothingRecursiveGaussian filter, the
ReleaseDataFlag is set ON, so in principle the filters in this case
will only use one image copy.
Luis
------------------------
Paul Yushkevich wrote:
> I have been trying to choose an appropriate Gaussian blurring filter to
> use in the SnAP project. While doing so, I tried to compare the
> performance of three candidates from ITK and VTK on a sample image. The
> candidates were itk::DiscreteGaussianImageFilter,
> itk::RecursiveGaussianImageFilter and vtkImageGaussianSmooth . I ran
> the filters with default parameters, only changing the standard deviation.
>
> Perhaps the result is useful to others, so I post it here. For one
> thing, it shows that the recursive gaussian filter seems to perform
> better on even very small sigmas. What is the error of the recursive
> filter w.r.t to the true solution for subpixel values of sigma?
>
> The times listed below are for VC6 Release program running on a
> two-month old machine.
>
> Loaded image : image01.mha
> Image size : 7109137 bytes
> Image dimensions : 181 x 217 x 181
> Component count : 1
> File type : Binary
> File byte order : Little Endian
>
> Standard Deviation: 0.5
> ITK Discrete Gaussian : 3688ms.
> ITK Recursive Gaussian : 515ms.
> VTK Gaussian : 1907ms.
>
> Standard Deviation: 1.5
> ITK Discrete Gaussian : 4578ms.
> ITK Recursive Gaussian : 484ms.
> VTK Gaussian : 2281ms.
>
> Standard Deviation: 2.5
> ITK Discrete Gaussian : 5672ms.
> ITK Recursive Gaussian : 485ms.
> VTK Gaussian : 2406ms.
>
> Standard Deviation: 3.5
> ITK Discrete Gaussian : 7079ms.
> ITK Recursive Gaussian : 500ms.
> VTK Gaussian : 2781ms.
>
> Standard Deviation: 4.5
> ITK Discrete Gaussian : 8578ms.
> ITK Recursive Gaussian : 484ms.
> VTK Gaussian : 3078ms.
>
> Paul.
>
>
> _______________________________________________
> Insight-developers mailing list
> Insight-developers@public.kitware.com
> http://public.kitware.com/mailman/listinfo/insight-developers
>