# Slicer crashes when using arrayFromSegmentBinaryLabelmap if segment is too small

**URL:** <https://discourse.slicer.org/t/slicer-crashes-when-using-arrayfromsegmentbinarylabelmap-if-segment-is-too-small/30636>\
**Category:** Support\
**Created:** [July 17, 2023, 11:22am UTC](https://discourse.slicer.org/t/slicer-crashes-when-using-arrayfromsegmentbinarylabelmap-if-segment-is-too-small/30636 "2023-07-17T11:22:24Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![kkkkkkk123](https://avatars.discourse-cdn.com/v4/letter/k/c37758/32.png) [@kkkkkkk123](https://discourse.slicer.org/u/kkkkkkk123)\
**Post date:** [July 17, 2023, 11:22am UTC](https://discourse.slicer.org/t/slicer-crashes-when-using-arrayfromsegmentbinarylabelmap-if-segment-is-too-small/30636/1 "2023-07-17T11:22:24Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [July 17, 2023, 5:51pm UTC](https://discourse.slicer.org/t/slicer-crashes-when-using-arrayfromsegmentbinarylabelmap-if-segment-is-too-small/30636/2 "2023-07-17T17:51:07Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![kkkkkkk123](https://avatars.discourse-cdn.com/v4/letter/k/c37758/32.png) [@kkkkkkk123](https://discourse.slicer.org/u/kkkkkkk123)\
**Post date:** [July 18, 2023, 2:34pm UTC](https://discourse.slicer.org/t/slicer-crashes-when-using-arrayfromsegmentbinarylabelmap-if-segment-is-too-small/30636/3 "2023-07-18T14:34:12Z")

</div>

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

```auto
segmentationNode.CreateDefaultDisplayNodes()
segmentationNode.SetReferenceImageGeometryParameterFromVolumeNode(volumeNode)

```
