# Export individual segements from segmentation as obj files 

**URL:** <https://discourse.slicer.org/t/export-individual-segements-from-segmentation-as-obj-files/29234>\
**Category:** Development\
**Tags:** python\
**Created:** [May 1, 2023, 9:42pm UTC](https://discourse.slicer.org/t/export-individual-segements-from-segmentation-as-obj-files/29234 "2023-05-01T21:42:26Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kalgodon](https://avatars.discourse-cdn.com/v4/letter/k/96bed5/32.png) [@Kalgodon](https://discourse.slicer.org/u/Kalgodon)\
**Post date:** [May 1, 2023, 9:42pm UTC](https://discourse.slicer.org/t/export-individual-segements-from-segmentation-as-obj-files/29234/1 "2023-05-01T21:42:26Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [May 1, 2023, 9:49pm UTC](https://discourse.slicer.org/t/export-individual-segements-from-segmentation-as-obj-files/29234/2 "2023-05-01T21:49:34Z")

</div>

> [@Kalgodon](#):
>
> 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.

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](https://github.com/PerkLab/SlicerOpenAnatomy). 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).
