Resample to Image on point cloud?

I’m trying to use volumetric rendering with data that comes in as a collection of 24million 3d points. I searched through the documentation and it seems like resample to image is a way to do it if I had a mesh that had attribute data on it, but I only have points.

Is there a method that essentially samples a set of points and turns it into voxel data where the data in a cell is the number of points within that voxel? Is this an option I’m missing in the resample to image filter?

Thanks!

https://vtk.org/doc/nightly/html/classvtkPointDensityFilter.html is exactly what you need. The challenge is that it is not directly available in ParaView. Fortunately, you can easily integrate that into a ProgrammableFilter. Here is the code, tested with v5.11.

PointDensity = ProgrammableFilter(registrationName='PointDensity', Input=mergeBlocks1)
PointDensity.OutputDataSetType = 'vtkImageData'
PointDensity.Script = """from vtk.vtkFiltersPoints import vtkPointDensityFilter

bounds = inputs[0].GetBounds()
hBin = vtkPointDensityFilter()
hBin.SetInputData(inputs[0].VTKObject)
hBin.SetModelBounds(bounds)
hBin.SetSampleDimensions(self.dims)
hBin.Update()
output.ShallowCopy(hBin.GetOutput())
"""
PointDensity.RequestInformationScript = """
executive = self.GetExecutive ()
outInfo = executive.GetOutputInformation(0)

self.dims = [512]*3
outInfo.Set(executive.WHOLE_EXTENT(), 0, self.dims[0]-1 , 0, self.dims[1]-1 , 0, self.dims[2]-1)
"""
PointDensity.RequestUpdateExtentScript = ''
PointDensity.PythonPath = ''
PointDensity.CopyArrays = 0

Adding more options to the PointDensityFilter is left as an exercise for the reader.
N.B. This filter has been threaded with vtkSMPTools. It can execute pretty quickly.

Incredible! I’ll get right to checking this out, and I’m excited to learn more in the underlying vtk space. Thank you so much.

Oh this is totally a one stop shop for everything I wanted

There is also the Point Volume Interpolator, which is available in ParaView now.

I gave the Point Volume Interpolator a try, but since my points didn’t come with attribute data on them it was greyed out?

As an extended exercise, instead of a Python Programmable filter, you can simply describe the filter in XML and load it as a Plugin.
The solution is attached :wink:

PointDensityFilter.xml (7.7 KB)

Well done @Joachim_P :clap:

So fun, I appreciate all the addon growth options from everyone!

Devin