Dear vtk js,
I’m about to start building a tool for segmentation of mesh data, but I’m not sure what the best way forward would be. Could you perhaps point me towards a (high-level) approach? Also, if it would turn out that vtk.js isn’t the recommended library for this use-case, feel free to let me know - I’m happy to explore alternatives.
The tool should ideally support:
- rendering 3D mesh data (polydata) [this already works]
- adding balls on the mesh by clicking with the mouse [this already works; using a cellPicker]
- dragging existing balls around on top the mesh. Some subquestions arise here:
** How to detect when hovering over a 3D ball? I could use the cellPicker again, but it seems like a heavy operation to do on every mouse move. I did notice that (after setting the actor of the widgetRepresentation to pickable), the mouse pointer already automatically changes when hovering over it. Is there a way to directly leverage this underlying logic?
** Would there be a way to constrain movement of the balls to the mesh surface? I could of course move them around in the plane (parallel to the screen) and re-project them onto the mesh after each (infetisimal) movement. However, directly forcing the balls to stay on the mesh would be even better. I found a similar question here (How to move objects with mouse? · Issue #657 · Kitware/vtk-js · GitHub) but didn’t find a lot of information on it yet. Also, I don’t seem to find the vtkContrainedPointHandleRepresentation - as recommended in the final comment.
- doing some mathematical operations on mesh data, such as
** computing shortest paths between two mesh vertices
** getting all vertices within a closed contour on the mesh
** removing/splitting part of the mesh (enclosed by a contour)
** collision detection between polydata objects
To have a better idea of the final end goal, I’d like to refer to an existing tool, allowing to place and move around balls on a mesh surface: video (3:06-3:26)
I know these are a lot of questions at once, but the goal is rather to get an understanding of how realistic and straightforward this is in vtk.js. No need to provide me with a detailed solution of course
Thanks a lot for your help and for building this great software.