Export individual segements from segmentation as obj files

I am trying to export all segments as their own obj so that I don’t end up with just a surface like stl files.

I have been successful in the ui by hiding all the segments except 1 at a time, and then exporting all visible segments to an obj file and repeating this process.

How would I do this in a python script?

When you export to OBJ, a single file is sufficient, because each segment is exported with a different material, so you can select in your external viewer/editor software what to show and how (you are not limited to show the external surface).

That said, if you want, you can export a segmentation to multiple OBJ files (one OBJ file for each segment). For this you can use the exporter in SlicerOpenAnatomy extension. The exporter can also simplify the models, which is useful if you want to load the models into software that requires meshes with low polygon count (e.g., Unity, HoloLens).

1 Like