# Can I display a binary numpy array on Slicer as a segmentation volume?

**URL:** <https://discourse.slicer.org/t/can-i-display-a-binary-numpy-array-on-slicer-as-a-segmentation-volume/7952>\
**Category:** Support\
**Created:** [August 8, 2019, 9:43pm UTC](https://discourse.slicer.org/t/can-i-display-a-binary-numpy-array-on-slicer-as-a-segmentation-volume/7952 "2019-08-08T21:43:12Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ISJ0392](https://avatars.discourse-cdn.com/v4/letter/i/a88e57/32.png) [@ISJ0392](https://discourse.slicer.org/u/ISJ0392)\
**Post date:** [August 8, 2019, 9:43pm UTC](https://discourse.slicer.org/t/can-i-display-a-binary-numpy-array-on-slicer-as-a-segmentation-volume/7952/1 "2019-08-08T21:43:12Z")

</div>

I have a numpy array with dimensions 512 \* 512 \* 64 \* 5. This represents 5 3D arrays, and the arrays have only 1 or 0 values representing voxels in a segmentation volume. Is there anyway I can display this saved .npy file to see the 3D segmentations in Slicer? Is there a way for me todo this without slicer?

Apologies if this is a simple and has been asked elsewhere but im relatively new to slicer and from what I can see people have asked questions todo the opposite (convert segmentation to npy and not the other way around)

---

<div class="post-metadata">

**Author:** ![ISJ0392](https://avatars.discourse-cdn.com/v4/letter/i/a88e57/32.png) [@ISJ0392](https://discourse.slicer.org/u/ISJ0392)\
**Post date:** [August 9, 2019, 1:39am UTC](https://discourse.slicer.org/t/can-i-display-a-binary-numpy-array-on-slicer-as-a-segmentation-volume/7952/2 "2019-08-09T01:39:53Z")

</div>

The question I have is the opposite to the question in : [Segment / BinaryLabelMap to numpy array](https://discourse.slicer.org/t/segment-binarylabelmap-to-numpy-array/778)

I think this user is asking how to get the numpy array from the .seg.nrrd. I want to know how to get a numpy array and convert it to a .sseg.nrrd format that slicer can work with

---

<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:** [August 10, 2019, 6:09pm UTC](https://discourse.slicer.org/t/can-i-display-a-binary-numpy-array-on-slicer-as-a-segmentation-volume/7952/3 "2019-08-10T18:09:12Z")

</div>

The simplest is probably to create a [labelmap volume node](https://apidocs.slicer.org/master/classvtkMRMLLabelMapVolumeNode.html), set its voxels from a numpy array using [slicer.util.updateVolumeFromArray](https://slicer.readthedocs.io/en/latest/developer_guide/slicer.html#slicer.util.updateVolumeFromArray), and convert into a segmentation node using [ImportLabelmapToSegmentationNode](https://discourse.slicer.org/t/import-labelmap-to-segmentation-node-in-batch-processing/2360/10).
