# How to export Segmentation as gtlf using python code

**URL:** <https://discourse.slicer.org/t/how-to-export-segmentation-as-gtlf-using-python-code/24852>\
**Category:** Support\
**Tags:** segmentation, python\
**Created:** [August 21, 2022, 3:20pm UTC](https://discourse.slicer.org/t/how-to-export-segmentation-as-gtlf-using-python-code/24852 "2022-08-21T15:20:28Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sirius\_Chen](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/sirius_chen/32/15998_2.png) [@Sirius\_Chen](https://discourse.slicer.org/u/Sirius_Chen)\
**Post date:** [August 21, 2022, 3:20pm UTC](https://discourse.slicer.org/t/how-to-export-segmentation-as-gtlf-using-python-code/24852/1 "2022-08-21T15:20:28Z")

</div>

Greetings!  
I need to export Segmentation as ONE gtlf file. I noticed I can use [SlicerOpenAnatomy](https://github.com/PerkLab/SlicerOpenAnatomy/), but using the python code——

```auto
exporter = vtk.vtkGLTFExporter()
exporter.SetRenderWindow(slicer.app.layoutManager().threeDWidget(0).threeDView().renderWindow())
exporter.SetFileName("c:/tmp/newfolder/mymodel.gltf")
exporter.Write()

```

——will export the entire scene and create a gltf file and several bin files.  
like this:  
 ![1661094927326](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/2/8/280e807a53097579358f99ed3859e7055f19a794.png)

Could anyone help me find the code that can export the Segmentation to ONE gtlf file?  
like this:  
 ![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/e/8/e863b1f1bc8a2d15425b7a6bf46a74c7b3d4f9fe.png)  
Thank you so much!
