Trying to export nrrd file segmentation to DICOM

I am using version 4.11.0-2020-08-09
I have converted some segmentation from numpy format to nrrd, I also converted my CT volume from numpy to nrrd, I am able to load them fine in slicer 3d, but I wanted to convert this to dicom format so that the segmentations as well as the CT can be read by dicom viewers.


Seems like RTStruct is the only way or are there better ways to do this ?
I tried to convert to dicom RTSTruct by following the steps below

But after I convert to RTStruct I get images that dont display any contours.


Is there something that I am doing wrong ?

The RT structure set does not even show up in the series list in the screenshot. What viewer are you trying to use?

I would recommend to use DICOM Segmentation Object (instead of the archaic and very limited RT structure set). This option shows up after you install Quantitative reporting extension. For future reference, see list of supported DICOM information objects here.

Thank you for the suggestion,

I was using RadiAnt DICOM Viewer to view the folder containing the exported dicom files and the RTstruct but for some reason the RTStruct doesnt show up.

When I try to export to DICOM Segmentation Object using the Quantitative reporting extension I get two errors. I had loaded the segmentation nrrd as label map and the primary CT volume is also an nrrd object.

Error 1 -
Could not retrieve DICOM tag value from input parameter None
Error 2 -
Traceback (most recent call last):
File “”, line 2, in
File “C:/Users/gabri/AppData/Roaming/NA-MIC/Extensions-29335/QuantitativeReporting/lib/Slicer-4.11/qt-scripted-modules/DICOMSegmentationPlugin.py”, line 350, in export
exporter.export(exportable.directory, segFileName, metadata)
File “C:/Users/gabri/AppData/Roaming/NA-MIC/Extensions-29335/QuantitativeReporting/lib/Slicer-4.11/qt-scripted-modules/DICOMSegmentationPlugin.py”, line 499, in export
absolutePaths=True)
File “C:/Users/gabri/AppData/Roaming/NA-MIC/Extensions-29335/QuantitativeReporting/lib/Slicer-4.11/qt-scripted-modules/DICOMSegmentationPlugin.py”, line 575, in getDICOMFileList
instanceUIDs = volumeNode.GetAttribute(attributeName)
AttributeError: ‘NoneType’ object has no attribute ‘GetAttribute’

You need to set the referenced image before you can export a DICOM Segmentation Object. To do this, you can go to Segment Editor module and choose the referenced image as Master volume. We’ll update the exporter to make this requirement more clear.

I had selected the CT volume as the master volume in segment editor


Below is the subject hierarchy, is this correct ?

But when I export this using DICOM seg it gives the same two errors

Sorry to bring back this old issue, but was there any success here? Was trying to do something similar (export seg from NRRD to DICOM) without success.

Following DICOM — 3D Slicer documentation and Script repository — 3D Slicer documentation do not work – even when the seg has a reference volume set manually, there are some missing DICOM tags/node attributes which prevent the export from proceeding.

I assume since Slicer SEG export is failing when reference volume is not DICOM · Issue #247 · QIICR/QuantitativeReporting · GitHub is still open without comment there hasn’t been any movement in this regard?

DICOM Segmentation Object export works well, it just complicated because of required cross-references between DICOM files.

If you use a recent Slicer Preview Release then you will get detailed error message about what steps were missed.

If you don’t export to existing DICOM studies but you make up new ones then you need to create the patients, studies, image series first and then associate this DICOM volume with the existing segmentation:

  • Export the volume to the DICOM database and then load the volume from the DICOM database.
  • Drag-and-drop the segmentation under the loaded DICOM volume’s study.
  • Go to Segment Editor and set the loaded DICOM volume as source geometry (by clicking the Specify geometry button and selecting the loaded DICOM volume as “source geometry”)

After this, you can export the segmentation as DICOM segmentation object by right-clicking on the segmentation node in Data module.

You can find a script here that fully automates this process (even takes care of assigning DICOM terminologies, in case someone is just converting plain labelmaps and not segmentation nodes): GitHub - lassoan/LabelmapToDICOMSeg: Script for converting labelmap volumes to DICOM segmentation objects