T
- the type of the target image.public class AnisotropicDiffusion<T extends RealType<T>> extends MultiThreadedBenchmarkAlgorithm
http://en.wikipedia.org/wiki/Anisotropic_diffusion
, and the original paper:
Perona and Malik. Scale-Space and Edge Detection Using Anisotropic Diffusion. IEEE Transactions on Pattern Analysis and Machine Intelligence (1990) vol. 12 pp. 629-639
process()
method does only one iteration of the process on the given
image. This allow to change all parameters at each iteration if desired.
This implementation is dimension generic: the filtering is done considering a 3x3 neighborhood for a 2D image, a 3x3x3 neighborhood for a 3D image, and so on.
For every pixel of the image, the contribution
of all close neighbors in a cube (whatever is the dimensionality) around the central pixel
is considered. Image gradient is evaluated by finite differences in direction of the neighbor
currently inspected. The value of this component of the gradient is used to compute the
diffusion coefficient, through a function that must implements the AnisotropicDiffusion.DiffusionFunction
interface. Users can specify their own function. Two functions are offered, taken from
Perona and Malik original paper: AnisotropicDiffusion.StrongEdgeEnhancer
and AnisotropicDiffusion.WideRegionEnhancer
.
On top of that, one can specify what dimensions to parse when calculating laplacian and gradient.
This allow to do smoothin only in some directions. See setDimensions(int[])
.
This implementation is multithreaded; the number of used thread can
be specified with the MultiThreadedAlgorithm.setNumThreads(int)
or MultiThreadedAlgorithm.setNumThreads()
methods.
Modifier and Type | Class and Description |
---|---|
static interface |
AnisotropicDiffusion.DiffusionFunction
The interface that function suitable to be diffusion function must implement.
|
static class |
AnisotropicDiffusion.StrongEdgeEnhancer
The first diffusion function proposed by Perona & Malik.
|
static class |
AnisotropicDiffusion.WideRegionEnhancer
The second diffusion function proposed by Perona & Malik.
|
processingTime
errorMessage, numThreads
Constructor and Description |
---|
AnisotropicDiffusion(Image<T> image,
double deltat,
AnisotropicDiffusion.DiffusionFunction function)
Instantiate the Perona & Malik anisotropic diffusion process, with a custom diffusion function.
|
AnisotropicDiffusion(Image<T> image,
double deltat,
double kappa)
Instantiate the Perona & Malik anisotropic diffusion process, with the default strong-edge
diffusion function.
|
Modifier and Type | Method and Description |
---|---|
boolean |
checkInput() |
boolean |
process()
Execute one step of the numerical integration scheme.
|
void |
setDeltaT(float deltat)
Set the integration constant value for the numerical integration scheme.
|
void |
setDiffusionFunction(AnisotropicDiffusion.DiffusionFunction function)
Set the diffusion function used to compute conduction coefficients.
|
void |
setDimensions(int[] dimensions)
Set the dimensions to be considered in neighborhood.
|
getProcessingTime
getErrorMessage, getNumThreads, setNumThreads, setNumThreads
public AnisotropicDiffusion(Image<T> image, double deltat, AnisotropicDiffusion.DiffusionFunction function)
image
- the target image, will be modified in placedeltat
- the integration constant for the numerical integration scheme. Typically less that 1.function
- the custom diffusion function.AnisotropicDiffusion.DiffusionFunction
public AnisotropicDiffusion(Image<T> image, double deltat, double kappa)
image
- the target image, will be modified in placedeltat
- the integration constant for the numerical integration scheme. Typically less that 1.kappa
- the constant for the diffusion function that sets its gradient thresholdAnisotropicDiffusion.StrongEdgeEnhancer
public boolean checkInput()
public boolean process()
public void setDeltaT(float deltat)
deltat
- public void setDiffusionFunction(AnisotropicDiffusion.DiffusionFunction function)
function
- AnisotropicDiffusion.DiffusionFunction
,
AnisotropicDiffusion.StrongEdgeEnhancer
,
AnisotropicDiffusion.WideRegionEnhancer
public void setDimensions(int[] dimensions)
By default, all dimensions are parsed when iterating around a pixel to compute gradient and laplacian. However, there might be situations where one wants to limit that. For instance, when given a 3D volume that is a 2D+time movie, it is sometimes desirable to do the anisotropic diffusion in the 2D planes, and not to incorporate the derivatives in the time direction. It is possible to do that by specifying the desired dimensions with this method. In the aforementioned example, to limit the diffusion in the X & Y directions only, the array {0, 1} has to be given.
Copyright © 2015–2021 Fiji. All rights reserved.