PyVista: 3D Gaussian Smoothing of PolyData

134 views Asked by At

I would like to replicate the example here https://docs.pyvista.org/version/stable/examples/01-filter/gaussian-smoothing.html using my own data but trying to apply the gaussian_smooth() method to my ImageData results in MissingDataError: No data available. (but works for the example). I'm guessing I need to pass my scalar field to ImageData but I'm not sure with what attribute I do this.

Some potentially helpful code:

# create a uniform grid to sample the function with
n = 40
x_min, y_min, z_min = [np.min(q) - 0.25*np.absolute(np.min(q)) for q in [tmp[tmp[:,3]==1, 0], tmp[tmp[:,3]==1, 1], tmp[tmp[:,3]==1, 2]]]
x_max, y_max, z_max = [np.max(q) + 0.25*np.absolute(np.max(q)) for q in [tmp[tmp[:,3]==1, 0], tmp[tmp[:,3]==1, 1], tmp[tmp[:,3]==1, 2]]]
grid = pv.ImageData(
    dimensions=(n, n, n),
    spacing=( (x_max - x_min) / n, 
              (y_max - y_min) / n,
              (z_max - z_min) / n),
    origin=(x_min, y_min, z_min),
)

smooth_grid = grid.gaussian_smooth(std_dev=3.0)

My question: How can I successfully perform a gaussian_smooth on my ImageData

0

There are 0 answers