Prevent extra folder on dicom export

Hi there

Exporting a volume to DICOM from the Data module does not place all DICOM files inside of the selected folder, but creates an extra one on the same level.
Is there an option to prevent the extra folder?

Exporting data to a clean folder ensures that there is no interference between DICOM exporters that are writing their outputs (potentially in parallel), the maximum number of files per folder is not exceeded (it can be a problem on file systems used for some removable media) and it also offers an easy way to determine which files are resulted from the same DICOM export operation.

It is certainly possible, but it would require developing alternative solutions for the issues mentioned above. If there are strong use cases / needed by many users then we could allocate Slicer core developers time to change the current design. What is your use case? Is the problem that you have each DICOM export result in a separate folder or that you don’t know how to get that folder?

I understand, thank you for your quick reply. In my case the exported DICOMs are read by a Python routine after the volume is processed with 3D Slicer. I create different folders for different volumes beforehand. Of course I could just select the deepest available folder in my routine, but I prefer a direct output to get a clean folder structure.

If you only need to export scalar volumes then you can use the CreateDICOMSeries CLI module as it is done here:

Alternatively, you could add an option to CreateDICOMSeries module to take a file prefix. The scalar volume DICOM plugin then could create all the files in the base folder with a randomly generated prefix to make sure there is no name clash:

1 Like