I am trying to find the best way to quickly batch process a number of folders containing head MRI dicom files to .nii files. Basically the pipeline should work like this: import the dicom files > load them as a volume > save the volume as a .nii file.
I am trying to do this using the slicer from terminal: Slicer --no-main-window --python-script (as is described in here https://www.slicer.org/wiki/Documentation/Nightly/Developers/Python_scripting#How_to_access_a_scripted_module_from_python_scripts)
The python script goes like this:
i = ctk.ctkDICOMIndexer()
i.addDirectory(slicer.dicomDatabase, '/home/me/Documents/25/25')
How can I do the next necessary steps to load the dicom files as volumes and save them as .nii files?
Your use case seems to be simpler than this, and most of it is contained in this module. What you need to implement in addition is the one-line command to save the loaded volume as nii.
Thank you for your response. What I am looking for is ways to batch process multiple files through scripting with python. Perhaps there is some tutorial or a wiki page about this kind of processing? For example, I am not able to find the command to load the imported dicom files as a volume (without the Slicer GUI because I need to to do it as a batch script). Later on I will probably need to batch process more than just loading and saving.
it is not possible to run Slicer in batch mode (on a cluster) to make video of the volume rendering using the module Screen Capture, isn’t it? I guess for the rendering is needed to load the GUI to init the 3DView, isn’t it?
Moreover, (by running with only the option --python-script) Do I need to install VirtualGL and turbovnc?