# Export segmentation Into another predifined model

**URL:** https://discourse.slicer.org/t/export-segmentation-into-another-predifined-model/11685
**Category:** Development
**Created:** [May 25, 2020, 12:44am UTC](https://discourse.slicer.org/t/export-segmentation-into-another-predifined-model/11685 "2020-05-25T00:44:07Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![siaeleni](https://avatars.discourse-cdn.com/v4/letter/s/b4bc9f/32.png) [@siaeleni](https://discourse.slicer.org/u/siaeleni)
#### Post date: [May 25, 2020, 12:44am UTC](https://discourse.slicer.org/t/export-segmentation-into-another-predifined-model/11685/1 "2020-05-25T00:44:07Z")

</div>

Hi,

I am not sure what is the best way to export a segmentation to a predefined empty vtkMRMLModelNode?  
Assume that I have a vtkMRMLModelNode named “Model”.  
I currently use the following

> shNode = slicer.mrmlScene.GetSubjectHierarchyNode()  
> exportFolderItemId = shNode.CreateFolderItem(shNode.GetSceneItemID(), “Segments”)  
> slicer.modules.segmentations.logic().ExportAllSegmentsToModels(outSegmentation, exportFolderItemId)

but I want to export directly to the node = slicer.util.getNode(“Model”)  
Is it possible?

Thanks

---

<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 25, 2020, 3:20am UTC](https://discourse.slicer.org/t/export-segmentation-into-another-predifined-model/11685/2 "2020-05-25T03:20:14Z")

</div>

You can set vtkPolyData from a segmentation node as shown in these [examples in the script repository](https://www.slicer.org/wiki/Documentation/Nightly/ScriptRepository#Get_a_representation_of_a_segment).
