pyvista.ImageDataFilters.gaussian_smooth#

ImageDataFilters.gaussian_smooth(radius_factor=1.5, std_dev=2.0, scalars=None, progress_bar=False)[source]#

Smooth the data with a Gaussian kernel.

Parameters:
radius_factorfloat | sequence[float], default: 1.5

Unitless factor to limit the extent of the kernel.

std_devfloat | sequence[float], default: 2.0

Standard deviation of the kernel in pixel units.

scalarsstr, optional

Name of scalars to process. Defaults to currently active scalars.

progress_barbool, default: False

Display a progress bar to indicate progress.

Returns:
pyvista.ImageData

Uniform grid with smoothed scalars.

Notes

This filter only supports point data. Consider converting any cell data to point data using the cell_data_to_point_data() filter to convert any cell data to point data.

Examples

First, create sample data to smooth. Here, we use pyvista.perlin_noise() to create meaningful data.

>>> import numpy as np
>>> import pyvista as pv
>>> noise = pv.perlin_noise(0.1, (2, 5, 8), (0, 0, 0))
>>> grid = pv.sample_function(
...     noise, [0, 1, 0, 1, 0, 1], dim=(20, 20, 20)
... )
>>> grid.plot(show_scalar_bar=False)
../../../_images/pyvista-ImageDataFilters-gaussian_smooth-1_00_00.png

Next, smooth the sample data.

>>> smoothed = grid.gaussian_smooth()
>>> smoothed.plot(show_scalar_bar=False)
../../../_images/pyvista-ImageDataFilters-gaussian_smooth-1_01_00.png

See Gaussian Smoothing for a full example using this filter.