Skip to content

Commit

Permalink
BUG: Fix arrayFromSegmentBinaryLabelmap leaving temporary node behind
Browse files Browse the repository at this point in the history
slicer.util.arrayFromSegmentBinaryLabelmap left temporary color node in the scene.
This commit removes this unneeded node.
  • Loading branch information
lassoan committed Dec 8, 2022
1 parent 2ed9451 commit 5a3f338
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Base/Python/slicer/util.py
Expand Up @@ -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
Expand Down

0 comments on commit 5a3f338

Please sign in to comment.