Filters and parameters used in "export visible segments to model"

Is there a way to figure out which vtk filters, parameters and processing steps are run in Slicer, when one clicks the “export visible segments to models” button? Since it takes a binary voxel mask and converts it to a mesh, I assume vtkContourFilter is used?

I would like to replicate this functionality outside of Slicer, in python. I looked in the Slicer source code, but couldn’t get far. In addition, would also like to understand the methods for the opposite “Convert model to segmentation node”.

Any help would be appreciated! If this is documented somewhere, please let me know.

Thanks,
Chaitanya

Hi @lassoan @pieper,

Do you have some pointers here?

Thanks,
Chaitanya

This is all implemented in a standalone library (vtkSegmentationCore, a.k.a. PolySeg). It has been also compiled with webassembly and used in JavaScript (in OHIF) and will be avilable as a standalone pip-installable Python package.

The Python work takes time, as we want to implement it properly, by developing a solid infrastructure for it in VTK (that can be used for many other VTK-based libraries). @jcfr might be able to give more details.