Load two volumes into two views using Python

Operating system: Windows
Slicer version:4.11.20210226 r29738

I am developing a Slicer module that performs image enhancement of computed tomography volumes. Once the module is executed, I’d like to allow the user to see both the original volume and the post-processed volume. I found a previous thread of a similar request in which the response was to drag-and-drop the volume into the corresponding view.

This works manually. However, is there a way to do it programmatically (e.g., have the module reference a specific view in which to load the volume)?

Namely, to do the following 2 steps in Python code,
Step 1. Configure a layout (e.g., Compare with two views)
Step 2. Load two separate DICOM volumes in its own view

1 Like

Same suggestion as in the post you linked: try the Compare Volumes module and then look at the code - you may be able to use the viewerPerVolume method from the logic.

1 Like