Save segmentation output as xml file or binary mask

Operating system: Windows 8
Slicer version: 4.8.1
Expected behavior: get segmentation output in xml, or just binary image format like jpg or png.
Actual behavior: can’t figure out how to get correct format.


I am very new to slicer, and my goal of using slicer is to create manual annotations on dicom files, then save those annotations as binary array(1 for segmented area, 0 for background) with exact same dimension with original image. The purpose of saving these masks is for training neural nets.

However, I haven’t figured it out how to save these segmented areas. If someone can tell me how to do this or provide some tutorial links, that will be great.

Warmest Regard!
Kunyu Shi

Export segmentation to labelmap node in Segmentations module’s Export/Import section. To match the exported labelmap’s geometry with another volume’s choose a reference volume in Advanced section / Reference volume.

I’m also looking to generate masks for neural nets, I see how I can follow the instructions you’ve given but I don’t see how I can get the output as a series of .jpgs or binary arrays. I’m not sure how to convert .nnrd and .ctbl into a series of images

Most medical image deep learning toolkits can directly use the nrrd file that you save in Slicer. See for example

For initial testing, you can use Screen Capture module to export image slices as a series of png files.

1 Like

Preliminary inspection of niftynet shows it to be cool but I already have a pipeline in Keras so I’m not sure it would be worth the time to switch.

Thank you for the help! I will proceed via the screen capture module for now