Polygon Mesh Boolean Operations

We are trying to represent a segmentation as a purely polygon mesh-based structure. The polyData is generated by creating an isosurface from a 3D mask using vtkSurfaceNets3D.

We are struggling with Boolean operations meant to edit this segmentation. We are trying vtkLoopBooleanPolyDataFilter but it seems to be unstable, sometimes working well but other times erasing rather than adding. Spherical brush example:
Screenshot 2024-01-29 100031
or adding a closed shape rather than merging the existing mesh with the addition:
Screenshot 2024-01-29 100156

  • Is there data preprocessing we should try? We apply triangulation (vtkTriangleFilter), cleaning (vtkCleanPolyData), and normal calculation (vtkPolyDataNormals) to the polyData and “edit” data before the boolean operation.
  • We also tried vtkBooleanOperationPolyDataFilter but it seemed slower and produced worse results.
  • We are using the Java wrapping for the main vtk build. vtkBool (GitHub - zippy84/vtkbool: A new boolean operations filter for VTK) seems interesting but lacks a Java Wrapper, has anyone used this library? Is it worth developing a Java wrapper in order to use it?


1 Like

This is a great question; our team recently implemented vtkBool into our Java application, and it does seem to be more more robust than the vtkBooleanOperationPolyDataFilter but still does have some issues. Would be very interested to hear others thoughts on this.

Hello @dpseiter ,

For boolean operations involving triangulated surfaces, I would recommend the vespa module.
This is a VTK (external) module that serves as a bridge between VTK and CGAL, exposing some efficient and robust algorithms like:

One constraint may be the license however, CGAL is in dual licensing (GPL, paid license) so any executable generated against CGAL needs to comply with the GPLv3, except if you own a CGAL license of course.

1 Like

it’s a pity that VESPA just support VTK9.0+, but I have to work with VTK8.2
I am facing the problem like polygon overlapping part separation problem like this, but with different discriminant condition(same polygon, but self-intersecting or not), could you give me some advice?? Thanks a lot!