I would like to export a segment of a segmentation node to a .stl 3d model file.
I’m wondering how can I do it in python? I could create the volume like this, but then in saving it didn’t work the way I expected.
segmentationNode = getNode(“segmentationNode”)
#I’m not sure if I can also get a specific segment (and not the whole segmentation node) only for exporting as model?
shNode = slicer.mrmlScene.GetSubjectHierarchyNode()
exportFolderItemId = shNode.CreateFolderItem(shNode.GetSceneItemID(), “Segments”)
but then how can I save the model? I tried:
#with error: “slicer.util.MRMLNodeNotFoundException: could not find nodes in the scene by name or id ‘Segments’”
thanks in advance