Export segmentation Into another predifined model

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

You can set vtkPolyData from a segmentation node as shown in these examples in the script repository.

1 Like