How to change default snap to center slice when loading volume

Operating system : macOS Mojave (version 10.14.6)
Slicer version : 4.11.0-2019-07-29 r28413
Desired behavior : Snap to the first slice of the volume when loaded
Actual behavior : By default, the middle slice is displayed when the volume is loaded

Details :

Is there a way to programmatically have the first slice of the volume displayed by default when a volume is loaded?

Which slice is displayed is controlled by the slider bar shown below, and the button circled in green snaps to the center slice.

So Iā€™m wondering if there a parameter I can add when loading the volume

[success, volume] = slicer.util.loadVolume(filename = image_path_slicer, returnNode=True)

to control that slider or the button?


There is no volume loading parameter for centering on first slice.

You can get the physical position of the first slice by converting its voxel position (i=(extent[0]+extent[1])/2; j=(extent[0]+extent[1])/2; k=0) to physical position as shown here then jump the slice to that position.

1 Like