Slicer crashes when using arrayFromSegmentBinaryLabelmap if segment is too small

Hello, I am trying to use arrayFromSegmentBinaryLabelmap, but when my segmentation is too small (e.g. just a few voxels), 3D Slicer crashes. Is there any way to prevent this? Can I extract information about the size of segmentation before converting it to an array?

Could you provide sample data and/or more detailed instructions that would allow us to reproduce this?

I seem to have fixed the issue! I did not include these two lines before converting the segmentation to an array

segmentationNode.CreateDefaultDisplayNodes()
segmentationNode.SetReferenceImageGeometryParameterFromVolumeNode(volumeNode)
1 Like