pyvista.ImageDataFilters.gaussian_smooth#
- ImageDataFilters.gaussian_smooth(
- radius_factor=1.5,
- std_dev=2.0,
- scalars=None,
- progress_bar=False,
Smooth the data with a Gaussian kernel.
- Parameters:
- radius_factor
float
| sequence[float
], default: 1.5 Unitless factor to limit the extent of the kernel.
- std_dev
float
| sequence[float
], default: 2.0 Standard deviation of the kernel in pixel units.
- scalars
str
,optional
Name of scalars to process. Defaults to currently active scalars.
- progress_barbool, default:
False
Display a progress bar to indicate progress.
- radius_factor
- Returns:
pyvista.ImageData
Uniform grid with smoothed scalars.
Notes
This filter only supports point data. For inputs with cell data, consider re-meshing the cell data as point data with
cells_to_points()
or resampling the cell data to point data withcell_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)
Next, smooth the sample data.
>>> smoothed = grid.gaussian_smooth() >>> smoothed.plot(show_scalar_bar=False)
See Gaussian Smoothing for a full example using this filter.