# Add segmentation mask to volume

**URL:** <https://discourse.slicer.org/t/add-segmentation-mask-to-volume/27568>\
**Category:** Development\
**Tags:** segmentation\
**Created:** [January 31, 2023, 7:21pm UTC](https://discourse.slicer.org/t/add-segmentation-mask-to-volume/27568 "2023-01-31T19:21:30Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![devD](https://avatars.discourse-cdn.com/v4/letter/d/f08c70/32.png) [@devD](https://discourse.slicer.org/u/devD)\
**Post date:** [January 31, 2023, 7:21pm UTC](https://discourse.slicer.org/t/add-segmentation-mask-to-volume/27568/1 "2023-01-31T19:21:30Z")

</div>

Hi,

I have created a segmentation as a numpy array. What is the procedure to add the segmentation to the original volume and then display it in Slicer. I’ve seen someone else use the function “slicer.util.arrayFromSegmentBinaryLabelmap”, but I am unsure on how to use it.

Thank you

---

<div class="post-metadata">

**Author:** ![Sunderlandkyl](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/sunderlandkyl/32/79987_2.png) [@Sunderlandkyl](https://discourse.slicer.org/u/Sunderlandkyl)\
**Post date:** [January 31, 2023, 7:38pm UTC](https://discourse.slicer.org/t/add-segmentation-mask-to-volume/27568/2 "2023-01-31T19:38:23Z")

</div>

You can find an example using the function here:  
[https://slicer.readthedocs.io/en/latest/developer\_guide/script\_repository.html#read-and-write-a-segment-as-a-numpy-array](https://slicer.readthedocs.io/en/latest/developer_guide/script_repository.html#read-and-write-a-segment-as-a-numpy-array)
