Convert DICOM-RTSTRUCT format to Nifti format

Hi all, I’m facing another problem. I’m using machine learning method to do segmentation for medical images, and at first I convert the DICOM files to Nifti format. I have several DICOM directories and their corresponding DICOM-RTSTRUCT file as the segmentation masks. The problem is: for several cases, the python script can convert the DICOM-RTSTRUCT file to a valid Nifti file, but for other cases, the generated Nifti file of DICOM-RTSTRUCT has inconsistency image origin information as that of the corresponding DICOM files. I have asked one physician in our group for help, he said that the files may come from different DICOM imaging system, and thus has different meta information. But the commercial software (like 3D Slicer) can handle these issues automatically. Could you please suggest some software to convert DICOM-RTSTRUCT file to Nifti format? It seems the 3D Slicer doesn’t have this functionality. Thanks a lot.

Slicer can certainly read DICOM RTSTRUCT and save it as a labelmap in Nifti format.

By default, when you export a segmentation to a labelmap volume, Slicer uses the smallest necessary image extent, so the input grayscale volume’s geometry will not be the same as labelmap volume’s. If your software requires the grayscale and labelmap volumes to have the exact same geometry then you just need to specify the grayscale volume as reference volume for labelmap export (see Segmentations module Export/import… / Advanced section).

3 Likes

@lassoan Thanks a lot! Now I can export the contours successfully!

Does the value of the ROI outline defined in the labelmap exported by this segmentation module be 1 or 0?

If you export to labelmap, each segment will be assigned a unique voxel value, starting from 1. Voxel value of 0 means outside of all segments.

Thank you for your answer!

When I am saving a CTV RTstructure as a labelmap, I am not able to save this as a nifti. The choices are STL or OBJ. What am I missing here? I am using the T1 MRI as grayscale reference volume, and I need to save the labelmap as a nifti in order to use in python and compare to machine learning-derived CTV. Any suggestions? I am using 3Dslicer 4.10.2

First of all, please use the latest nightly because 4.10.2 is almost two years old.

To save a segmentation as nifti, you need to export it to labelmap, but it seems you exported it to models.

image

Then you can save the labelmap to nifti using the save function

image

1 Like

Thank you!! You made my day :slight_smile:

1 Like

A post was split to a new topic: RT structure set has holes after exporting to labelmap