# Anisotropic Nonlinear Diffusion in Flow Visualization

The applet above is a Java implementation of the Anisotropic Nonlinear Diffusion for vector field visualization. The applets purpose is to demonstrate the algorithm in case of a very simple vector field. Since Java is an interpreted language the, applet is very slow. But let us emphasize that the C implementation is very fast.

## Mathematics of Nonlinear Diffusion in Flow Visualization

The anisotropic nonlinear diffusion visualizes vector fields by solving a parabolic partial differential equation, that is given by

where v is the vector field, u some image and

the diffusion tensor that controls diffusion of the image u via the functions and G. Together with the matrices B(v) we get a linear diffusion along the streamlines of v and a Perona Malik behavior orthogonal to v.

The variable t in the partial differential equation is called the scale parameter, i.e. for each t we get a modified version of the image u0 with which we started the computation. In general we can start with an arbitrary image (a nice gimmick would be to use a picture of yourself...), but we use a randomized pixel image (a white noise image).

Since every diffusion process has a smoothing effect that in images decreases the contrast, we add a so called source term on the righthand side of the differential equation that works against the loss of contrast.

We discretize the equation using linear finite elements and a semi implicit time stepping. That means we solve the matrix equation

and so proceed, starting from the random image, in little steps of length from scale n to the next scale n+1. We call the matrices Mn and Ln the mass- respectively stiffness matrix of the scale n.

## Using the Applet

Now that you know a little about the Mathematics behind the algorithm, you should be able to use the applet. The output region shows information on the current state of the algorithm.

Press the "Reset" button to load the parameters, you have typed in and to create the new starting image. Press the "Step" button to perfom one time step of the anisotropic nonlinear diffusion evolution.

In the group named "Parameters" you find inputs for the various parameters that steer the diffusion process.
 Sigma The time step width for the regularizing mollification step. Tau The time step width for the nonlinear diffusion step. K Parameter for the Perona Malik function G. The smaller this value is the more will the streamlines be clustered during the nonlinear diffusion step. LinDiff This is the constant linear diffusion coefficient that steers the diffusion along streamlines. The greater the value is the longer will the streamlines be. CG Steps Number of steps to perform with the linear solver.

The number of steps the CG solver needs depends on the condition of the matrix L that gets worse with increasing and . Since the Java language in applets is very slow we do not solve the problems exaclty nut only approximate the solutions. But already rough approximations deliver good insight in the structure of vectorfields.

With the color selectors, you can select the interpretation of the components of the vector valued problem. The number of colors you select corresponds directly to number of euqations in the coupled system.

With these two selectors you can turn on and off the usage of the contrast sharpening right hand side of the equation and of the Perona Malik function G. Be aware that turning of the Perona Malik function leads to a degenerate problem and that without the contrast enhancing righthand side the images suffer from high loss of contrast during the evolution.