# How to display a volume in a specific slice view with Python

**URL:** <https://discourse.slicer.org/t/how-to-display-a-volume-in-a-specific-slice-view-with-python/21361>\
**Category:** Development\
**Created:** [January 8, 2022, 4:32pm UTC](https://discourse.slicer.org/t/how-to-display-a-volume-in-a-specific-slice-view-with-python/21361 "2022-01-08T16:32:14Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![lauralatorre](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lauralatorre/32/12245_2.png) [@lauralatorre](https://discourse.slicer.org/u/lauralatorre)\
**Post date:** [January 8, 2022, 4:32pm UTC](https://discourse.slicer.org/t/how-to-display-a-volume-in-a-specific-slice-view-with-python/21361/1 "2022-01-08T16:32:14Z")

</div>

Hi,

I am trying to display 3 different volumes in a Three by three slice layout after pressing an Apply button in my module. I was wondering how can I set the slice views where to display each volume (for instance, I want to display volume3 in the 7,8 and 9 slice views). `slicer.util.loadVolume()` has no input arguments for that, so I was looking for a function similar to `slicer.util.setSliceViewerLayers()` that allows to set the volume displayed in each slice view. My aim is to avoid using the View Controllers module for that.

Thank you

---

<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:** [January 8, 2022, 5:47pm UTC](https://discourse.slicer.org/t/how-to-display-a-volume-in-a-specific-slice-view-with-python/21361/2 "2022-01-08T17:47:53Z")

</div>

You should be able to use CompareVolumes for that, or if needed tweak the code.

[https://www.slicer.org/wiki/Documentation/Nightly/Modules/CompareVolumes](https://www.slicer.org/wiki/Documentation/Nightly/Modules/CompareVolumes)

---

<div class="post-metadata">

**Author:** ![lauralatorre](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lauralatorre/32/12245_2.png) [@lauralatorre](https://discourse.slicer.org/u/lauralatorre)\
**Post date:** [January 9, 2022, 12:20pm UTC](https://discourse.slicer.org/t/how-to-display-a-volume-in-a-specific-slice-view-with-python/21361/3 "2022-01-09T12:20:50Z")

</div>

That’s what I was looking for, thank you @pieper!
