From 5a3f3381d16c7151b695d2597695951869c9981d Mon Sep 17 00:00:00 2001 From: Andras Lasso Date: Thu, 8 Dec 2022 12:11:30 -0500 Subject: [PATCH] BUG: Fix arrayFromSegmentBinaryLabelmap leaving temporary node behind slicer.util.arrayFromSegmentBinaryLabelmap left temporary color node in the scene. This commit removes this unneeded node. --- Base/Python/slicer/util.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Base/Python/slicer/util.py b/Base/Python/slicer/util.py index 096c4b85e73..e1e3ff66680 100644 --- a/Base/Python/slicer/util.py +++ b/Base/Python/slicer/util.py @@ -2045,6 +2045,8 @@ def arrayFromSegmentBinaryLabelmap(segmentationNode, segmentId, referenceVolumeN raise RuntimeError("Export of segment failed.") narray = slicer.util.arrayFromVolume(labelmapVolumeNode) finally: + if labelmapVolumeNode.GetDisplayNode(): + slicer.mrmlScene.RemoveNode(labelmapVolumeNode.GetDisplayNode().GetColorNode()) slicer.mrmlScene.RemoveNode(labelmapVolumeNode) return narray