ColoredElevationMap speed

#1

Hi,
I’ve been searching the interwebs for the past days (3-4) but I cannot find a solution to my problem. I want to color a pointcloud of about 40 million points by height, I took a look into the ColoredElevationMap example but it’s way to slow, basically it crashes before finishing, after a minute or so.

What could be done? I am new to all this.

(Marco Musy) #2

This takes ~40s on my system:

from vtkplotter import *
from random import uniform as u
N = 4000000
rgb = [(u(0, 255), u(0, 255), u(0, 255)) for i in range(N)]
pts = Points(rgb, c=rgb, alpha=1, r=1)
show(pts, bg="white")

Internally it uses the vtkVertexGlyphFilter:

        src = vtk.vtkPointSource()
        src.SetNumberOfPoints(n)
        src.Update()
        vgf = vtk.vtkVertexGlyphFilter()
        vgf.SetInputData(src.GetOutput())
        vgf.Update()
        pd = vgf.GetOutput()

        ucols = vtk.vtkUnsignedCharArray()
        ucols.SetNumberOfComponents(3)
        ucols.SetName("pointsRGB")

        for i in range(len(plist)):
            ucols.InsertNextTuple3(c[0], c[1], c[2])

        pd.GetPoints().SetData(numpy_to_vtk(plist, deep=True))
        pd.GetPointData().SetScalars(ucols)
#3

Even 40 seconds is too much… I need it to be less than 0.5secs to be acceptable

#4

Bump!