[vtkusers] My point cloud data won't display in the renderer.

Ruff albin.nilsson at gmail.com
Thu Jul 11 02:54:24 EDT 2013


Nvm, i got it to work. Thanks! Though i realize that I asked for a point
cloud when it was a volume i was looking for all along. Looks kind of like
what i was trying to achieve.

Anyway, since it works, should someone (like me, totally unfamiliar with
vtk) google this, here's what i did:

verts = vtkPoints() #(Points with [index,x,y,z]    )
scalars = vtk.vtkDoubleArray() #(Array with [index, scalar])
scalars.SetNumberOfComponents(1) #For that one scalar value

# inserting stuff

cloud = vtkPolyData
cloud.SetPoints(verts)
cloud.GetPointData().SetScalars(scalars)

glyphFilter = vtkVertexGlyphFilter()
glyphFilter.AddInput(cloud)

cloudMapper = vtkPolyDataMapper()
cloudMapper.SetInputConnection(glyphFilter.GetOutputPort())

#These two seems to be set by default
#cloudMapper.ScalarVisibilityOn()
#cloudMapper.SetScalarModeToUsePointData()
cloudMapper.SetScalarRange(0,255) # col.-range of my scalars

cloudActor = vtkActor()
cloudActor.SetMapper(cloudMapper)
cloudActor.GetProperty().SetRepresentationToPoints()

etc...



--
View this message in context: http://vtk.1045678.n5.nabble.com/My-point-cloud-data-won-t-display-in-the-renderer-tp5721844p5721885.html
Sent from the VTK - Users mailing list archive at Nabble.com.



More information about the vtkusers mailing list