pyradiomics with DICOM data


I would like to use pyradiomics with DICOM data, in the guideline it says “The script will accept as input a directory with a single DICOM image study for the input image, and the file name pointing to a DICOM Segmentation Image (DICOM SEG) object.”

but I am not sure what are the DICOM Segmentation Images and how to get these? I only have DICOM image files.

Thank you


I am not sure what you mean but maybe this helps: Create DICOM files from CT volume and segmentation - YouTube
With 3D-slicer, you can generate DICOM segmentation files.

But I would rather work with nifiti where you only have one file per scan.
It is pretty easy to convert DICOM to nifti: dicom2nifti · PyPI


Hi Jonas,

Thank you for your response. I am not a radiologist and not familiar with the images format, I am trying to figure out what kind of data I will be working with (to run pyradiomics) I know that we have DICOM files but not sure if they also have segmentation files as well,I know that veloity software is used. Does all DICOM files come with the segmentation files?

Hi Gorge,

You are welcome. :slight_smile:

I am also not a radiologist. I know that DICOM is the raw data format containing metadata from the device (e.g. CT scanners). A CT scan contains several (mostly axial) slices which together make the 3D scan. To run Pyradiomics you need to have a region of interest where you extract the features. Segmentations are annotations and do not necessarily come with the image file itself. Normally, it is an extra file that separates the region of interest from the background (a mask for the original scan). If this file is not present you are probably missing the annotations and need to segment the region. Depending on what is your object of interest (e.g. cancer, metastasis, etc.) it can be very time-consuming to do this segmentation. Maybe ask some radiologists if they have segmentations for your purpose.

I hope that helps somehow.


1 Like

Hello George,

In general, DICOMS acquired in a radiology workflow will not have been segmented, this is indeed a required and time consuming step. In case of images from radiotherapy, these will generally have segmentations in the form of RTSTRUCT, which need to be converted before they are usable for PyRadiomics. This can be done in 3D Slicer, or via commandline tool plastimatch.

Generally, most studies using PyRadiomics start out with DICOMS, but first convert them to another (easier-to-use) image format like NIFTII or NRRD, followed by segmentation and radiomics feature extraction. PyRadiomics does allow you to use DICOM files directly, but this uses the pyradiomics-dcm labs script and requires you to provide the segmentation in DICOM SEG format (which is a newer type of segmentation annotation that is easier to use than RTSTRUCT when extracting features). Furthermore, the output of that script is DICOM SR, making it a DICOM to DICOM workflow, which is generally not required for research in a big dataset and can make it more complicated than necessary.



Great, thank you both for your explanations. So of I get you right I need DICOM file (or series of files?) +segmentation file to run pyradiomics. Without segmentation I will not be able to run radiomics feature extraction as the ROI is not defined.
I can get this if there are DICOM SEG files already, or I can convert DICOM to NIFTII (or NRRD) and next on this file ask radiologist to do segmentation. Is this correct?
Is there any example of data that I can send to show what I need for pyradiomics?I am interested in lung cancer nodules. Can you advise what exactly to ask to send me, possible formats etc how big are files, can they be easily transferred-send by email. Any suggestions will be highly appreciated!

It is simpler than this. You can load your DICOM images into Slicer. If you have DICOM segmentations (because the radiologist already segmented the region of interests in his clinical software and stored in the DICOM archive in DICOM RT Structure Set or DICOM Segmentation Object format), then you can load them into Slicer, too. If you don’t have segmentation then you can load the DICOM image into Slicer and then segment it in the Segment Editor.

You can then compute radiomics features in Slicer or save the image and segmentation in nrrd format and compute radiomics features later.

1 Like

@lassoan Do I have to convert the segmentation with a couple of segments to a labelmap before I feed it into Radiomics? I tested some datasets today and always get identical feature columns in SlicerRadiomics.

I’ve just tested and it works well (in a few-day-old Slicer Preview Release). I’ve just submitted a fix for an issue that might cause the problem you experienced:

You can try to apply this change manually on your file and see if it fixes the issue.

1 Like

Thanks so much Andras! Can I also ask if the segmentation file has a DICOM SEG ending? How to recognise the segmentation file (either DICOM RT or Segmentation Object). I am asking as a clinician is not sure if there are any segmentations files associated with CT, and he is not sure how to spot one. Thanks again!

Thanks a lot. This now works.


DICOM does not rely on specific filenames or extensions, so you can only tell what a set of DICOM files contain by parsing them with a compatible software application. Segmentation may show up in the series list as “Segmentation”, “SEG”, “Structure Set”, “RTSTRUCT”.

Segmenting an image in clinical software usually requires significant effort. Therefore, if the clinician is not sure if he segmented the image or not then most likely the image was not segmented.

Hi Andras
My research project is about Brain Mets. My question is can I use this method for MRI scans as well?
Because I am not sure if those MRI scans have segmentations.

Yes, the same method works. You need segmentation to designate a region of interest. You don’t want irrelevant regions of the image affect your results.

1 Like

Thanks for your response!!!