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


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

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

1 Like

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