How to open multiple DICOM series using python script

Hello everyone,
I want to use the WebServer module of 3D Slicer to make a WADO Server. I can load DICOM files into the scene from a folder. I need to open multiple DICOM series simultaneously, then control the volumes to return a slice corresponding to a request. How can I do this?
Thank you, everyone!

The WebServer already has a basic WADO mode (enough to support the OHIF viewer anyway, but not fully standards compliant). Code contributions to improve this mode would be welcome!

For full flexibility, it might be more efficient to use the exec API to run python code in Slicer to do all your dicom operations. There are lots of ways to accomplish what you describe so please post any example code you develop and let us know if you run into roadblocks.

For now, I can load multiple volumes, and get the arrays from them to return a slice corresponding to a request. (I need the array to return slices for different directions - axial, sagittal, coronal). For example:

volumeNode1 = slicer.util.loadVolume("path_to_series_1", {"singleFile": False, "show": False})
volumeArray1 = slicer.util.arrayFromVolume(volumeNode1)

With a volume loaded, I can render a 3D image for a volume with the following code, but I don’t know how to render multiple 3D images in different threeDView for different volumes. Can I do this or it’s only possible to render a 3D image for only one volume with one Slicer instance?

volRenLogic = slicer.modules.volumerendering.logic()
volRenLogic.CreateDefaultVolumeRenderingNodes(volumeNode1)

Thank you very much for your response!

You have pretty much full control through the python api in terms of which volumes to show in which 3D views or even create new views of arbitrary size. Maybe the best is to browse the script repository to get a sense of what’s possible and let us know if you get stuck.