PYME.contrib.aniso.aniso module

PYME.contrib.aniso.aniso.anisodiff(img, niter=1, kappa=50, gamma=0.1, step=(1.0, 1.0), option=1, ploton=False)

Anisotropic diffusion.

Usage: imgout = anisodiff(im, niter, kappa, gamma, option)

Arguments:

img - input image niter - number of iterations kappa - conduction coefficient 20-100 ? gamma - max value of .25 for stability step - tuple, the distance between adjacent pixels in (y,x) option - 1 Perona Malik diffusion equation No 1

2 Perona Malik diffusion equation No 2

ploton - if True, the image will be plotted on every iteration

Returns:
imgout - diffused image.

kappa controls conduction as a function of gradient. If kappa is low small intensity gradients are able to block conduction and hence diffusion across step edges. A large value reduces the influence of intensity gradients on conduction.

gamma controls speed of diffusion (you usually want it at a maximum of 0.25)

step is used to scale the gradients in case the spacing between adjacent pixels differs in the x and y axes

Diffusion equation 1 favours high contrast edges over low contrast ones. Diffusion equation 2 favours wide regions over smaller ones.

Reference: P. Perona and J. Malik. Scale-space and edge detection using ansotropic diffusion. IEEE Transactions on Pattern Analysis and Machine Intelligence, 12(7):629-639, July 1990.

Original MATLAB code by Peter Kovesi School of Computer Science & Software Engineering The University of Western Australia pk @ csse uwa edu au <http://www.csse.uwa.edu.au>

Translated to Python and optimised by Alistair Muldal Department of Pharmacology University of Oxford <alistair.muldal@pharm.ox.ac.uk>

June 2000 original version. March 2002 corrected diffusion eqn No 2. July 2012 translated to Python

PYME.contrib.aniso.aniso.anisodiff3(stack, niter=1, kappa=50, gamma=0.1, step=(1.0, 1.0, 1.0), option=1, ploton=False)

3D Anisotropic diffusion.

Usage: stackout = anisodiff(stack, niter, kappa, gamma, option)

Arguments:

stack - input stack niter - number of iterations kappa - conduction coefficient 20-100 ? gamma - max value of .25 for stability step - tuple, the distance between adjacent pixels in (z,y,x) option - 1 Perona Malik diffusion equation No 1

2 Perona Malik diffusion equation No 2
ploton - if True, the middle z-plane will be plotted on every
iteration
Returns:
stackout - diffused stack.

kappa controls conduction as a function of gradient. If kappa is low small intensity gradients are able to block conduction and hence diffusion across step edges. A large value reduces the influence of intensity gradients on conduction.

gamma controls speed of diffusion (you usually want it at a maximum of 0.25)

step is used to scale the gradients in case the spacing between adjacent pixels differs in the x,y and/or z axes

Diffusion equation 1 favours high contrast edges over low contrast ones. Diffusion equation 2 favours wide regions over smaller ones.

Reference: P. Perona and J. Malik. Scale-space and edge detection using ansotropic diffusion. IEEE Transactions on Pattern Analysis and Machine Intelligence, 12(7):629-639, July 1990.

Original MATLAB code by Peter Kovesi School of Computer Science & Software Engineering The University of Western Australia pk @ csse uwa edu au <http://www.csse.uwa.edu.au>

Translated to Python and optimised by Alistair Muldal Department of Pharmacology University of Oxford <alistair.muldal@pharm.ox.ac.uk>

June 2000 original version. March 2002 corrected diffusion eqn No 2. July 2012 translated to Python