2D contours from mesh / plane intersection


I’m trying to evaluate if vtk.js is right for my next project and a feature that I couldn’t find is the ability to generate 2D contours from a mesh + plane intersection. And the contours shall look nice and the solution should scale to 50+ contours displayed at 60FPS.

Is it supported? I’m not sure I’ve seen that in Slicer3D at all.

I’ve been thinking about many ways this problem could be approached but nothing seems to provide fast, scalable, and beautiful solutions. Any clue on how that could be approach would be greatly appreciated.

Here is a snapshot of what I try to achieve, keeping in mind that the contours are the intersections from meshes + plane as opposed to a label map.


Screenshot 2021-09-30 at 15.36.04

Looks like what you need is a vtkCutter (see example).
It is currently CPU based but it seems to be fast regarding the complexity of your meshes.
The image reslicing can be done on the GPU (see example)


Thanks I’ll give it a shot and keep you in the loop!

Do you think those will perform well on multiple fairly complex shapes?

@Nicolas_Rannou did you manage to visualize the contour intersection? I tried the same in python, but the intersection seems infinitesimally thin, and I don’t know how to inflate / dilate to make it actually visible along the normal … :frowning:

Please do not mix VTK C++/Python and VTK.js

you can inflate using:

  • line thickness
  • a tube filter

Regarding the “visible along the normal”, it is a matter of lighting/shading you need to play with.