Navigation

Operators and Keywords

Function List:

C++ API

: smoothed_data = smooth3 (data)
: smoothed_data = smooth3 (data, method)
: smoothed_data = smooth3 (data, method, sz)
: smoothed_data = smooth3 (data, method, sz, std_dev)

Smooth values of 3-dimensional matrix data.

This function can be used, for example, to reduce the impact of noise in data before calculating isosurfaces.

data must be a non-singleton 3-dimensional matrix. The smoothed data from this matrix is returned in smoothed_data which is of the same size as data.

The option input method determines which convolution kernel is used for the smoothing process. Possible choices:

"box", "b" (default)

to use a convolution kernel with sharp edges.

"gaussian", "g"

to use a convolution kernel that is represented by a non-correlated trivariate normal distribution function.

sz is either a vector of 3 elements representing the size of the convolution kernel in x-, y- and z-direction or a scalar, in which case the same size is used in all three dimensions. The default value is 3.

When method is "gaussian", std_dev defines the standard deviation of the trivariate normal distribution function. std_dev is either a vector of 3 elements representing the standard deviation of the Gaussian convolution kernel in x-, y- and z-directions or a scalar, in which case the same value is used in all three dimensions. The default value is 0.65.

See also: isosurface, isonormals, patch.

Demonstration 1

The following code

 data = rand (10, 10, 10);
 clf;
 subplot (1, 2, 1);
  patch (isosurface (data, .5), ...
         "FaceColor", "blue", "EdgeColor", "k");
  title ("Original data");
  view (3);
  smoothed_data = smooth3 (data);
 subplot (1, 2, 2);
  patch (isosurface (smoothed_data, .5), ...
         "FaceColor", "blue", "EdgeColor", "k");
  title ("Smoothed data");
  view (3);

Produces the following figure

Figure 1

Package: octave