Using `vtkPointPicker.getPointId` on geometries

I am making some changes to itk-vtk-viewer code as per Geometry / Point selection · Issue #575 · Kitware/itk-vtk-viewer · GitHub

While doing so I am using the getPointId() function from vtkPointPicker to try to select points in the viewer.

Working: When using point_sets data as input to the view (i.e. view(point_sets=[point_set_1]) ), the returned data point ID’s are correct.

Issue: However, when using geometries (i.e. view(geometries=glyphs.GetOutput()) ) the returned ID’s are not correct.
It seems that each glyph has 50 different pointID’s attributed to them? If I take the returned ID and run Math.floor(ID / 50) I get the correct ID.

Questions:

  • Is there a way to tell getPointId to only read one ID per glyph?
    • I have tried using model.annotationPicker.setUseCells(true) but that does not work.
  • If not, is there a way to tell if the data is type geometries or point_sets from inside itk-vtk-viewer?

Because you are using a CPU vtkGlyph3D filter, it means that your sphere glyph (made of 50 points?) is duplicated N times in your output mesh where N is the number of input points.
This would explain why you had to divide by 50 the point id.

You might want to consider the vtkSphereMapper, but please read this discussion before.

Thanks for the reply, but I am using Python to generate the data etc and (as far as I can see) vtkSphereMapper is not available outside of VTK.js