Save processed image as a DICOM series, in python

Hi, thanks again!

Have you posted the question on the forum publicly or contacted someone privately?

The link you gave me, i.e. “DICOM export of segmentation node”
led to a broken link to https://www.dropbox.com/s/j4cmpv5x7hupewy/20160826_DICOMVolumeExport_MatthewMouawad.py?dl=0
which was a code by Matthew Mouawad,
So I searched for Matthew on the Internet, I found him and directly wrote to him, who confirmed that his code is old and would not work now. He did not give the code to me anyway yet.

As to

Private messages are not ideal, since … if you learn something then
it will not be visible to the community.

as you can see, I am reporting in my messages all the code I am writing, so I’m going to share everything I get to.

If you don’t have much time then instead of writing an exporter script,
it may be faster to export the files manually, as shown in this tutorial:

Thanks for the link. I’ll watch it. Anyway, this is not a good option for me because I want to explore a whole space of rotation parameters, with the generation of dozens of rotated CT volumes, so I cannot save each transformed volume manually.

I am now studying this code:
https://github.com/SlicerRt/SegmentRegistration/blob/master/ProstateMRIUSContourPropagation/ProstateMRIUSContourPropagation.py
which has DICOM export, but I still have to understand many things. Moreover, looking at the lines which actually perform the export:

# Open DICOM export dialog, selecting the study to export
exportDicomDialog = slicer.qSlicerDICOMExportDialog(None)
exportDicomDialog.setMRMLScene(slicer.mrmlScene)
exportDicomDialog.execDialog(deformedMrStudyShItemID)

they open the dialog and select the volume, but the dialog stil needs interaction with the user (a mouse click) for saving, so… ok, as I said I am still trying to understand.
Thank you very much.
Giorgio