How to export segmentation as masks (.jpgs?)


#1

Operating system: Linux
Slicer version: 4.10.1
I have as input DICOM files and I want to export the segmentations on those files in the form of a mask. The intended use is to load the masks into a numpy array for further use.


(Murat Maga) #2

Using Segmentation module you can convert your segments to a label map, and then save it as a JPG/PNG series at the Save Dialog box.


(Csaba Pinter) #3

Why do you need a stack of jpgs just to load them into a numpy array? You can do all that in Slicer using the python interactor. To get the numpy array for a volume you can use this function


(slicer.util.arrayFromVolume)
You’ll need to do this on the labelmap you exported from the segmentation.

Btw you can also export segmentations to labelmaps in the Data module (right-click segmentation and you’ll find the option in the menu).


#4

I see, thank you so much! I wasn’t familiar with the python interactor.