i3dlib

Documentation

i3d::AOSPMFilter< VOXELIN, VOXELOUT > Class Template Reference
[Image preprocessing filters]

This class implements the Perona-Malik anisotropic diffusion filter, which was published by Perona and Malik. This filter was historical first published nonlinear diffusion filter and therefore is fundamental. As the other anisotropic filters, this filter smooths the image in the relatively continuos region and do not smooth the significante edges. In the typical output image is suppresed the noise and the edges remain sharp and well localised. The diffused image is the solution of the equation $ u_t = \mathrm{div} (g(|\nabla u|) \nabla u)$. More...

#include <LevelSet.h>

Inheritance diagram for i3d::AOSPMFilter< VOXELIN, VOXELOUT >:

i3d::ImplicitAOSScheme< VOXELIN, VOXELOUT > i3d::PDESolver< VOXELIN, VOXELOUT > List of all members.

Public Member Functions

void SetConductance (VOXELOUT c)
 Set the conductance parameter.
VOXELOUT GetConductance ()
 Get the conductance parameter.
int SetNorm (int type)
 Set the Norm. The int parameter type can vary in {ORIGINALPM, ALTERNATIVEPM, TUKEY}.
virtual void PrepareDiagonals (size_t start, size_t incr, Vector3d< size_t > &size, size_t axe)
 Compute the coefficients on the diagonals of the tridiagonal linear system.
virtual void ComputeDiffusivity ()
 Compute the diffusivity (Here it only approximates the image gradient).

Detailed Description

template<class VOXELIN, class VOXELOUT>
class i3d::AOSPMFilter< VOXELIN, VOXELOUT >

This class implements the Perona-Malik anisotropic diffusion filter, which was published by Perona and Malik. This filter was historical first published nonlinear diffusion filter and therefore is fundamental. As the other anisotropic filters, this filter smooths the image in the relatively continuos region and do not smooth the significante edges. In the typical output image is suppresed the noise and the edges remain sharp and well localised. The diffused image is the solution of the equation $ u_t = \mathrm{div} (g(|\nabla u|) \nabla u)$.

The Perona Malik Filter is the historical first anisotropic diffusion filter. The image is smoothed by finding solution of partial differential equation

\[ u_t = \mathrm{div} (g(|\nabla u|) \nabla u) \]

where $ g(s) $ is decreasing function of the image gradient, and $ u_0$ is the input image (boundary condition of the PDE). The idea of this equation is to smooth the image in regions with almost no gradient and do not diffuse the image near significant edges. The strength of the diffusion is controled by the diffusivity function g. The diffusivity g is in original work of Perona and Malik computed by:

\[ g(s) = \frac{1}{1+\left(\frac{s}{ \lambda}\right )^2} \]

Perona and Malik considered also an alternative diffusion function:

\[ g(s) = \mathrm{exp}(-(s/\lambda)^2) \]

An consequently Black, Sapiro, Marimont, Heeger proposed the usage of Tukey Biweight norm:

\[ \begin{array}[b]{l} g(s) = [1 - 0.25((s/\lambda))^2]^2 \quad |s| \le \lambda\sqrt{5} \\ g(s) = 0 \quad \rm{otherwise} \\ \end{array} \]

See the image bellow, there are displayed all three norms. The meaning of those norms is following: All three enables the diffusion on pixels with the gradient lower than $\lambda $. All three stops the diffusion on pixels with image gradient higher than $\lambda$, but they differ on the strictness of the stopping.

diffusivitypm.gif

Diffusivity g function: lambda = 5.0, left: original PM norm, middle: alternative PM Norm, right: Tukey Biweight Norm

This class completely inherits the AOS numerical scheme from class ImplicitAOSScheme. It only reimplements the ComputeDiffusivity() and the PrepareDiagonals() functions. The discretisation of the equation is not accurate (as in the Perona Malik article), there are some simplifications.

\[ \begin{array}[b]{l} u_t = \mathrm{div} (g(|\nabla u|) \nabla u) \\ u_t = \sum \limits_{Dir \in \{N,S,E,W\}} g_{Dir}|\nabla_{Dir} u|||\\ \end{array} \]

where $ u_W = u_{i-1,j} - u_{i,j} $ and so on, $ g_{Dir} = g(|\nabla u_{Dir}|)$. In contrast to the AOSCLMCFilter is this discretisation quite symplified. Therefore the above mentioned method are reimplemented in this class.

The typical setting of coefficients of g function for biomedical images produced in LOM should be:
$\lambda$ between 1 and 10.
All three norms can be used to produce meaningfull output.
A few of iterations (1 to 10) should be sufficient to to smooth the image. The meaningful time step should be between 0.1 and 5.0 (See also the example code). The numerical scheme which finds the solution of the equation is implemented in ImplicitAOSScheme class. This class inherits the solution.

The implementation of this class is based on the articles
Joachim Weickert, Bart M. ter Haar Romeny, Max A. Viergever, Efficient and Reliable Schemes for Nonlinear Diffusion Filtering , IEEE TRANSACTIONS ON IMAGE PROCESSING, VOL. 6, NO. 3, PP. 398-410, MARCH 1998.
Pietro Perona and Jitendra Malik, Scale-Space and Edge Detection Using Anisotropic Diffusion IEEE Transactions on Pattern Analysis and Machine Intelligence. Vol. 12. No. 7. July 1990. Michael J. Black, Guilermo Sapiro, David H. Marimont, David Heeger, Robust Anisotropic Diffusion , IEEE Transactions on Image Processing, Vol. 7. No. 3. March 1998 The example code uses the AOS implementation of PM diffusion filter.

   .....
   
   Image3d<GRAY8> i;
   Image3d<float> fimg;
   i.ReadImage('input.tif'); // read input image
   AOSPMFilter<GRAY8,float> PM(i,fimg); // instantiate  the filter  (the two parameters are the input and the output image)
   PM.SetMaximumNumberOfIterations(3); // Set the number of iterations to 2
   PM.SetSpacing(1.0,1.0,2.0); // Set the spacing of spatial discretisation to 1,1,2
   PM.SetConductance(3.0); // Set the conductance parameter to 3.0
   PM.SetNorm(ORIGINALPM); // Set norm to original PM norm
   PM.SetGlobalTimeStep(5.0); // Set the global time step
   PM.Execute(); // Perform the work of the filter
   FloatToGray8NoWeight(fimg,i); //Convert the output float image to gray8 image
   i.SaveImage('output.tif'); // save the output of the filter

   ......
  
Author:
Jan Hubený xhubeny@fi.muni.cz
Date:
2005


The documentation for this class was generated from the following files: