# Binary image from segmentation

**URL:** <https://discourse.slicer.org/t/binary-image-from-segmentation/35601>\
**Category:** Support\
**Tags:** segmentation\
**Created:** [April 18, 2024, 1:59pm UTC](https://discourse.slicer.org/t/binary-image-from-segmentation/35601 "2024-04-18T13:59:37Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ahmad\_alminnawi](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/ahmad_alminnawi/32/66700_2.png) [@ahmad\_alminnawi](https://discourse.slicer.org/u/ahmad_alminnawi)\
**Post date:** [April 18, 2024, 1:59pm UTC](https://discourse.slicer.org/t/binary-image-from-segmentation/35601/1 "2024-04-18T13:59:37Z")

</div>

Hi all,

I have a segmentation and I want to select some slices (planes) that I want to convert to 2D binary images (lets say the xy plane at z=0) for example.

I found the question asked [here](https://discourse.slicer.org/t/export-binary-mask-of-the-segmentation-as-jpeg-png/28256) where the advice was to Export as LabelMap and save it as nrrd file but when I do so, i don’t see anything basically the labelMap is empty or it looks empty to me.

in a similar topic [here](https://discourse.slicer.org/t/cannot-save-binary-mask-of-annottated-images-from-segmentation-module/8829/2) the question "how to visualize the labelMap if we save it as a nrrd file was not answered

I would prefer using python to automate it but i wouldn’t mind using the GUI as well

can someone help with this issue please?

---

<div class="post-metadata">

**Author:** ![muratmaga](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/muratmaga/32/3622_2.png) [@muratmaga](https://discourse.slicer.org/u/muratmaga)\
**Post date:** [April 18, 2024, 3:00pm UTC](https://discourse.slicer.org/t/binary-image-from-segmentation/35601/2 "2024-04-18T15:00:34Z")

</div>

> [@ahmad\_alminnawi](#):
>
> I have a segmentation and I want to select some slices (planes) that I want to convert to 2D binary images (lets say the xy plane at z=0) for example.

As mentioned in the thread you linked, Slicer doesn’t allow exporting 2D slices. The most you can do is to use tiff format instead of NRRD. in that case, this will be a multi-frame TIFF (that is a single file, with all the slices inside).

If you are going to do this selectively (i.e., only export a few selected Slicer), you can possibly use the Screencapture module to save what’s visible in the 2D viewers as PNG or JPG. But then you will lose geometry information.

> [@ahmad\_alminnawi](#):
>
> I found the question asked [here](https://discourse.slicer.org/t/export-binary-mask-of-the-segmentation-as-jpeg-png/28256) where the advice was to Export as LabelMap and save it as nrrd file but when I do so, i don’t see anything basically the labelMap is empty or it looks empty to me.

Unless your segmentations/labelmaps fill a large portion of the volume, most of the resultant file will be empty (0s).
