New Isocontouring filter for discrete, labled volumetric data: vtkSurfaceNets3D

Thanks for the questions and feedback. I see that the filter does not support some of your workflows well. I will extend the API in the current filter next week. In the future, we are also considering creating a vtkAxisModeller which would essentially be a geometry/modelling kernel, with lots of advanced “atlas” functionality, but that won’t happen for a while. Here’s some additional elaboration if you are interested.

-------- More information -----

  • As Derk indicated, the current API is “.SetOutputStyleToSelected(), .InitializeSelectedLabelsList(), and AddSelectedLabel(label)” to extract labels/regions one-by-one (or to extract a subset of labels). I think another output style, maybe something like .SetOutputStyleToPartitioned(), to produce a grouped dataset (i.e., vtkPartitionedDataSet) would work. Each label would be placed into a separate vtkPolyData contained within an output vtkPartitionedDataSet. Of course to provide surface closure, shared points and triangles would be duplicated (does this make sense? comments?) Then it’d be quick and easy to extract vtkPolyData one by one and process them. I think Derk’s idea of writing a 3MF writer is of interest to me, but since I am not yet familiar with this, and to save some time, does anyone have any code that we can reuse?

  • Credit for the original algorithm goes to Sarah Frisken "SurfaceNets for Multi-Label Segmentations with Preservation of Sharp Boundaries” (see this paper for algorithm concepts and details). At one time the algorithm was patented, but now that it’s off patent we wanted to include it into VTK and make it really fast. We adapted some algorithmic concepts from Flying Edges, and mixed in vtkSMPTools for threading; the resulting performance is very good IMHO (best if you use VTK_SMP_IMPLEMENTATION_TYPE=TBB; typical speed ups range from 1-2 orders of magnitude depending on the data, number of labels, etc.). Note that vtkDiscreteFlyingEdges will be faster than vtkSurfaceNets3D for very small numbers of labels because FE assumes manifold isosurfaces, which gives it a performance boost over SN which assumes its dealing with non-manifold, joined surfaces. But for large numbers of labels SN is much faster, since FE makes a separate, complete pass for each label over the input annotation volume.

  • As far as future work goes, I occasionally see “bumps” in the surface near the intersection of multiple materials. I suspect that the smoothing stencils could be improved in some cases (it’s on my todo list). Also, the smoothing parameters are likely not tuned well so this will need to be experimented with. I also mentioned the vtkAxisModeller - it leverages the best kept secret of SNs, the BoundaryLabels 2-tuple cell data (indicating what regions are on either side of a triangle). You can probably imagine how this adjacency information could be used to navigate anatomical atlases. especially when combined with anatomical / ontology information.

  • If you are a glutton for punishment, the repository here has some standalone little programs for testing SNs, and comparing it against other algorithms. Dr. Frisken’s initial MultiMaterial SN code is also included (MM*) if you want to try that out. The mini-program RunSN.cxx lets you run and view results. Five datasets, some small, some quite large 2048^3 are also included. You will have to build (using the primitive CMakeLists.txt file) against a recent VTK version, either in VTK master or a version later than 9.2.20230420.

1 Like