# Slicer source code for stl file extraction

**URL:** <https://discourse.slicer.org/t/slicer-source-code-for-stl-file-extraction/18636>\
**Category:** Development\
**Created:** [July 12, 2021, 7:15am UTC](https://discourse.slicer.org/t/slicer-source-code-for-stl-file-extraction/18636 "2021-07-12T07:15:09Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![11116](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/11116/32/9013_2.png) [@11116](https://discourse.slicer.org/u/11116)\
**Post date:** [July 12, 2021, 7:15am UTC](https://discourse.slicer.org/t/slicer-source-code-for-stl-file-extraction/18636/1 "2021-07-12T07:15:09Z")

</div>

Hi,  
I want to see 3d slicer source code for the STL file extraction of a multi label image in python.Where can i find it? I want to extract an aggregated mess for all labels.

Thank you in advance for your help,  
Spyridoula Zagkou

---

<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:** [July 12, 2021, 2:14pm UTC](https://discourse.slicer.org/t/slicer-source-code-for-stl-file-extraction/18636/2 "2021-07-12T14:14:05Z")

</div>

The implementation is available here: [Slicer/vtkBinaryLabelmapToClosedSurfaceConversionRule.cxx at master · Slicer/Slicer · GitHub](https://github.com/Slicer/Slicer/blob/master/Libs/vtkSegmentationCore/vtkBinaryLabelmapToClosedSurfaceConversionRule.cxx)

Note that you can use Slicer without graphical user interface in batch processing, you can run your processing script in Slicer’s Python environment or using Slicer as Jupyter Notebook kernel - so it should not be necessary to copy-paste code from Slicer. But if you have a use case that is not covered by these then let us know and we may give more specific advice.

---

<div class="post-metadata">

**Author:** ![11116](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/11116/32/9013_2.png) [@11116](https://discourse.slicer.org/u/11116)\
**Post date:** [July 12, 2021, 4:22pm UTC](https://discourse.slicer.org/t/slicer-source-code-for-stl-file-extraction/18636/3 "2021-07-12T16:22:31Z")

</div>

Yes,I’m sorry for misunderstanding.I’m searching the python scrip for this process without GUI.

.

---

<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:** [July 12, 2021, 5:36pm UTC](https://discourse.slicer.org/t/slicer-source-code-for-stl-file-extraction/18636/4 "2021-07-12T17:36:29Z")

</div>

You can find lots of examples how to manipulate segmentations using Python scripting in the [script repository](https://slicer.readthedocs.io/en/latest/developer_guide/script_repository.html#segmentations).
