Hello All,
I’ve been working witht the segmentEditor Widget based on the code examples on the dev site and have been referencing the info here: Segment editor — 3D Slicer documentation
But for whatever reason I cannot get the “INTERSECT” option to work. I am able to get every other option (COPY, UNION, SUBTRACT, INVERT, CLEAR, FILL) to work properly, but when I choose INTERSECT it simply returns the first segment I pass, and not the overlap between the two.
My code can be found below… Has anybody been able to get INTERSECT to work properly?
segmentEditorWidget = slicer.qMRMLSegmentEditorWidget()
segmentEditorWidget.setMRMLScene(slicer.mrmlScene)
segmentEditorNode = slicer.mrmlScene.AddNewNodeByClass("vtkMRMLSegmentEditorNode")
segmentEditorWidget.setMRMLSegmentEditorNode(segmentEditorNode)
segmentEditorWidget.setSegmentationNode(segmentationNodeNew)
segmentEditorWidget.setActiveEffectByName("Logical operators")
effect = segmentEditorWidget.activeEffect()
effect.self().scriptedEffect.setParameter("Operation","UNION")
selectedSegmentID = effect.self().scriptedEffect.parameterSetNode().GetSelectedSegmentID()
effect.self().scriptedEffect.setParameter("BypassMasking", 1)
effect.self().scriptedEffect.setParameter("ModifierSegmentID",segmentationNodeNew.GetSegmentation().GetNthSegmentID(1))
effect.self().onApply()