DICOM export of segmentation node

Hi everyone,

I am writing a python module and wanted to know if it is possible to export a Segmentation node to a RTSS DICOM without its associated DICOM volume ?

In the example of the attached image: I want to export RTSTRUCT without MRI volume.

I used the code from SlicerProstate to create a new study that includes the MR volume and the RTSS, but this solution requires to export both the MR volume and the RTSS.

Many thanks,

I think this has been addressed in recent versions, but @cpinter can confirm within a few days.

As far as I can remember what was actually resolved when this issue came up last time was the speed of the export, which was drastically slowed down by the automatic importing of the exported DICOM back into the database. The export now takes only a few seconds, so allowing the export of only the RTSS was not implemented. The reasons:

  1. As RTSS represents structures as planar contours, a master volume is needed in many cases to determine the planes to do the cutting.
  2. DICOM requires references from RTSS to an anatomical volume (3006,0014, and 3006,0016, both type 1), so exporting them both is necessary to make the exported DICOM valid.

If you don’t need the MRI image, you can remove it after the export.

Hi Csaba,

Thanks for the quick answer.

Actually, the speed of the export is fine and works just good on a local computer. The problem is that our workflow uses the internal network to process the data. So, each time we export the RTSS, we have to wait about 10 min for the DICOM to be exported first.

One solution would be to export everything locally then send the required RTSS through the network (not sure if it is possible with the actual settings). Is it possible to export the DICOM on a temporary location without the dialog window popping?

Thanks
Houssem

Exporting to a temporary location should be the way to go, I agree.
I’m on my way to the airport so cannot prepare you a script, but here’s one that does export programmatically, bypassing the GUI


Things changed in Slicer core since then, so you may need to adjust a few lines.

Let me know how it goes, I can be of better help tomorrow.

An important piece of information is that instead of using the scalar volume exporter, you will need to use the RT exporter. This means that you’ll need to

  • import DicomRtImportExportPlugin
  • Instantiate it (bottom of script) like this:
    exporter = DicomRtImportExportPlugin.DicomRtImportExportPlugin(tags[…

One thing that can make this script a lot shorter is to use examineForExport to automatically populate the exportables that you can pass to the export function. You’ll need to use subject hierarchy items, which you can get by the nodes as explained in the script repo
https://www.slicer.org/wiki/Documentation/Nightly/ScriptRepository#Get_subject_hierarchy_item

Thank you Csaba for your help. It works great now.
I used the DicomRtImportExportPlugin. It looks like

import DicomRtImportExportPlugin
exporter = DicomRtImportExportPlugin.DicomRtImportExportPluginClass()
exportables = []
mrSegmentationExportable = exporter.examineForExport(mrSegmentationForExportShItemID)
mrVolumeExportable = exporter.examineForExport(mrVolumeForExportShItemID)
exportables.extend(mrVolumeExportable)
exportables.extend(mrSegmentationExportable)
for exp in exportables:
    exp.directory = temporaryFolderPath
exporter.export(exportables)

However, if I export only the Segmentations, it does not work but I get no error message.

Houssem

I’m glad I could be of help. Good job on the script!