# Exporting multiple segmentations into individual binary labelmaps?

**URL:** <https://discourse.slicer.org/t/exporting-multiple-segmentations-into-individual-binary-labelmaps/24926>\
**Category:** Support\
**Created:** [August 25, 2022, 7:52pm UTC](https://discourse.slicer.org/t/exporting-multiple-segmentations-into-individual-binary-labelmaps/24926 "2022-08-25T19:52:09Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![dokay1](https://avatars.discourse-cdn.com/v4/letter/d/b4bc9f/32.png) [@dokay1](https://discourse.slicer.org/u/dokay1)\
**Post date:** [August 25, 2022, 7:52pm UTC](https://discourse.slicer.org/t/exporting-multiple-segmentations-into-individual-binary-labelmaps/24926/1 "2022-08-25T19:52:09Z")

</div>

I have a project where we segmented 500 tumors from 50 patients and into a single segmentation with 1 segment per tumor.

I want to generate a probability map by adding all 500 lesions into a binary file, then divide it by the number of subjects.

Is there a way to bulk export every segment to a binary labelmap with a value of 1 (or 0)?  
Or alternatively is there a way to bulk add segments into a single layer without overlaps but summed intensity values?

Do I have to use python interactor for this?

THanks in advance!

---

<div class="post-metadata">

**Author:** ![cpinter](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/cpinter/32/7995_2.png) [@cpinter](https://discourse.slicer.org/u/cpinter)\
**Post date:** [August 27, 2022, 11:54am UTC](https://discourse.slicer.org/t/exporting-multiple-segmentations-into-individual-binary-labelmaps/24926/2 "2022-08-27T11:54:25Z")

</div>

You could look into the Batch Processing module in the SlicerRT extension.

---

<div class="post-metadata">

**Author:** ![dokay1](https://avatars.discourse-cdn.com/v4/letter/d/b4bc9f/32.png) [@dokay1](https://discourse.slicer.org/u/dokay1)\
**Post date:** [September 11, 2022, 3:19pm UTC](https://discourse.slicer.org/t/exporting-multiple-segmentations-into-individual-binary-labelmaps/24926/3 "2022-09-11T15:19:04Z")

</div>

Thanks Csaba! It doesn’t seem to work on Mac. The solution was to export each segmentation layer individually (which was tedious but doable with only 6 layers.

1. I turned on show Segment layer on the Segment viewer
2. Exported each layer’s segments to a separate binary label map
3. SimpleITK filters was used to binarize them (0 vs. 1)
4. Added binary maps to each other
5. Converted the summed map to a FLOAT (Cast Scalar module)
6. Divided by the number of patients (created a labelmap whose entire value was the equivalent of the number of patients using BinaryImage Threshold filter in Simple ITK filters)
7. Voila the result is a population lesion probability map.
