Fit SliceView Zoom

Hi everyone!
I´m trying to fit a reformat slice view to volume size.
I´ve finded slicer.util.setSliceViewerLayers(volumeNode, fit=True) but it reset also position and orientation. I´ve tried also sliceLogic.FitSliceToAll() but with same results.
Is there any way to just fit zoom of slice view?
Thanks on advance

Hi Angel,
If you want to avoid rotation, you could use.

appLogic =
appLogic.FitSliceToAll(True, False)

However, I would say that position change is the normal behavior.

If you want to center the volume except you want to keep the current slice offset (just zoom in/out and pan to center the volume but keep the current slice) then you can save the slice offset before centering and then restore it:

sliceLogic ="Red")
offset = sliceLogic.GetSliceOffset()
1 Like