Hi,
thanks for providing this great Software.
I am trying to change Models to Segments and Segments to Models using Python. This can easily be done using the GUI.
Model to Segmentation
Segmentation to Model
This is what I have found so far.
Converting Models to Segments
Create segmentation
segmentationNode = slicer.mrmlScene.AddNewNodeByClass("vtkMRMLSegmentationNode")
segmentationNode.CreateDefaultDisplayNodes()
addedSegmentID = segmentationNode.GetSegmentation().AddEmptySegment("Segment")
modelNode = slicer.util.getNode('Model')
segmentationNode = slicer.util.getNode('Segmentation')
slicer.modules.segmentations.logic().CreateSegmentFromModelNode(modelNode, segmentationNode)
The segmentation is then empty somehow.
Thanks in advance