Python VTK -- Can we get the mesh rendered from the colorized point cloud

I see 3 possibilities:

  1. use actor.GetProperty().RenderPointsAsSpheresOn() somewhere in your code.
  2. this works for me, using vtkVertexGlyphFilter :
import vtk

# Load the data for point cloud and colorized vectors
# nc = vtk.vtkNamedColors()
# test = BTL_GL.BTL_GL()
# pcd, pc, pc_color, MeshGrid, img_color = test.GL_NonFlat()
n = 10
src = vtk.vtkPointSource()
src.SetNumberOfPoints(n)
src.Update()

vgf = vtk.vtkVertexGlyphFilter()
vgf.SetInputData(src.GetOutput())
vgf.Update()
pcd = vgf.GetOutput()

ucols = vtk.vtkUnsignedCharArray()
ucols.SetNumberOfComponents(3)
ucols.SetName("Colors")
for i in range(n):
    ucols.InsertNextTuple3(255,i*30,i*30)
pcd.GetPointData().SetScalars(ucols)


# Design the mapper
point_mapper = vtk.vtkPolyDataMapper()
point_mapper.SetInputData(pcd)

actor = vtk.vtkActor()
actor.SetMapper(point_mapper)
actor.GetProperty().SetPointSize(10)
actor.GetProperty().RenderPointsAsSpheresOn()

ren = vtk.vtkRenderer()
ren.SetBackground(.2, .3, .4)
ren.AddActor(actor)

renWin = vtk.vtkRenderWindow()
renWin.AddRenderer(ren)

# Interactor
renderWindowInteractor = vtk.vtkRenderWindowInteractor()
renderWindowInteractor.SetRenderWindow(renWin)

# Begin Interaction
renWin.Render()
renderWindowInteractor.Start()

cols

  1. use example in https://github.com/marcomusy/vtkplotter/blob/master/examples/basic/manyspheres.py