# How to change default snap to center slice when loading volume

**URL:** <https://discourse.slicer.org/t/how-to-change-default-snap-to-center-slice-when-loading-volume/8057>\
**Category:** Support\
**Tags:** segmentation\
**Created:** [August 16, 2019, 9:28am UTC](https://discourse.slicer.org/t/how-to-change-default-snap-to-center-slice-when-loading-volume/8057 "2019-08-16T09:28:18Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![EricaMoreira](https://avatars.discourse-cdn.com/v4/letter/e/85f322/32.png) [@EricaMoreira](https://discourse.slicer.org/u/EricaMoreira)\
**Post date:** [August 16, 2019, 9:28am UTC](https://discourse.slicer.org/t/how-to-change-default-snap-to-center-slice-when-loading-volume/8057/1 "2019-08-16T09:28:18Z")

</div>

**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.

 ![56%20AM](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/c/c/cc19c7b23011ccb0c61e770bdf186dc8c64a0dbb.png)

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?

Thanks!

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [August 16, 2019, 12:08pm UTC](https://discourse.slicer.org/t/how-to-change-default-snap-to-center-slice-when-loading-volume/8057/2 "2019-08-16T12:08:30Z")

</div>

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](https://www.slicer.org/wiki/Documentation/Nightly/ScriptRepository#Get_markup_fiducial_RAS_coordinates_from_volume_voxel_coordinates) then [jump the slice to that position](https://www.slicer.org/wiki/Documentation/Nightly/ScriptRepository#Get_centroid_of_a_segment_in_world_.28RAS.29_coordinates).
