# Load two volumes into two views using Python

**URL:** <https://discourse.slicer.org/t/load-two-volumes-into-two-views-using-python/24628>\
**Category:** Development\
**Created:** [August 3, 2022, 10:47pm UTC](https://discourse.slicer.org/t/load-two-volumes-into-two-views-using-python/24628 "2022-08-03T22:47:26Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![bzhu](https://avatars.discourse-cdn.com/v4/letter/b/3bc359/32.png) [@bzhu](https://discourse.slicer.org/u/bzhu)\
**Post date:** [August 3, 2022, 10:47pm UTC](https://discourse.slicer.org/t/load-two-volumes-into-two-views-using-python/24628/1 "2022-08-03T22:47:26Z")

</div>

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.

> [@Python viewing two volumes side by side (four over four)](https://discourse.slicer.org/t/python-viewing-two-volumes-side-by-side-four-over-four/19638):
>
> I wanted to have two volumes that I load from dicom series to be viewed side by side separately. something like this view: how is the good approach to that?

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

---

<div class="post-metadata">

**Author:** ![pieper](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/pieper/32/8_2.png) [@pieper](https://discourse.slicer.org/u/pieper)\
**Post date:** [August 3, 2022, 11:21pm UTC](https://discourse.slicer.org/t/load-two-volumes-into-two-views-using-python/24628/2 "2022-08-03T23:21:56Z")

</div>

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`](https://github.com/pieper/CompareVolumes/blob/master/CompareVolumes.py#L337) method from the logic.
