Exporting multiple segmentations into individual binary labelmaps?

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!

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

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.