How to cut multi-segments in a segmentation node with scissors at the same time?

Hi, My slicer version is:

Operating system: Arch Linux
Kernel: x86_64 Linux 5.14.16-arch1
Slicer version: 4.11.20210226

I tried to use ApplyToAllVisibleSegments effect parameter:
https://slicer.readthedocs.io/en/latest/developer_guide/modules/segmenteditor.html#scissors

volumeNode = slicer.mrmlScene.GetFirstNodeByClass('vtkMRMLScalarVolumeNode')
segmentationNode = slicer.mrmlScene.GetFirstNodeByClass('vtkMRMLSegmentationNode')
segmentationNode.CreateClosedSurfaceRepresentation()
segmentationNode.GetDisplayNode().SetAllSegmentsVisibility(1)
segmentationNode.SetReferenceImageGeometryParameterFromVolumeNode(volumeNode)

segmentEditorWidget = slicer.qMRMLSegmentEditorWidget()
segmentEditorWidget.setMRMLScene(slicer.mrmlScene)
segmentEditorNode = slicer.mrmlScene.AddNewNodeByClass("vtkMRMLSegmentEditorNode")
segmentEditorWidget.setMRMLSegmentEditorNode(segmentEditorNode)

segmentEditorWidget.setSegmentationNode(segmentationNode)
segmentEditorWidget.setMasterVolumeNode(volumeNode)
segmentEditorWidget.setActiveEffectByName("Scissors")
effect = segmentEditorWidget.activeEffect()
effect.setParameter('ApplyToAllVisibleSegments', 1)

Then I used mouse to cut the segments in 3D view, but only worked on the first segment.
So, is there a way to cut multi-segments with scissors at the same time?

Thanks

By the way, is there a way to cut multiple segments in different segmentation nodes?And How is the performance?

Yes, you are lucky, @rbumm has already implemented this for you in July. Use a recent Slicer Preview Release and cCheck the “all segments” checkbox if you want to cut/fill all visible segments, not just the current one.

Segment Editor only modifies the selected segmentation. However, it is easy to move or copy segments between segmentations: drag-and-drop in the Data module, or use the Copy/move segments feature in Segmentation module.

2 Likes

Very good, the multi-segment cut through 15 segmented vertebrae from a CT takes 2.5s on a gaming laptop.

1 Like