# Slice view does not fit to background on loading a volume

**URL:** <https://discourse.slicer.org/t/slice-view-does-not-fit-to-background-on-loading-a-volume/40230>\
**Category:** Support\
**Created:** [November 17, 2024, 1:44pm UTC](https://discourse.slicer.org/t/slice-view-does-not-fit-to-background-on-loading-a-volume/40230 "2024-11-17T13:44:16Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![chir.set](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/chir.set/32/66982_2.png) [@chir.set](https://discourse.slicer.org/u/chir.set)\
**Post date:** [November 17, 2024, 1:44pm UTC](https://discourse.slicer.org/t/slice-view-does-not-fit-to-background-on-loading-a-volume/40230/1 "2024-11-17T13:44:16Z")

</div>

Usually, and in Slicer stable, when loading a volume of any dimension, the slice views would fit the extent of the volume nicely.

That’s no longer the case since recently. The image below shows the effect when a small volume is loaded (212 x 92 x 114) with spacing 0.6 x 0.6 x 0.6: on loading, with FitSliceToAll() and with FitSliceToBackground().

![FitSlice](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/f/e/fe2491e41288a83f09386c1740ea956a7743b787.gif)

It seems that the problem is with FitSliceToAll(). Formerly, it would behave like FitSliceToBackground(). Is it how it should be considered now, a feature?

Slicer is started with --ignore-slicerrc and the slice composite node has a single background scalar volume node. Using self-built preview on Linux.

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:** [November 17, 2024, 7:52pm UTC](https://discourse.slicer.org/t/slice-view-does-not-fit-to-background-on-loading-a-volume/40230/2 "2024-11-17T19:52:18Z")

</div>

Can you share an example volume that leads to the issue? I tried the latest nightly preview build of today and didn’t see anything unusual.

---

<div class="post-metadata">

**Author:** ![chir.set](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/chir.set/32/66982_2.png) [@chir.set](https://discourse.slicer.org/u/chir.set)\
**Post date:** [November 17, 2024, 8:42pm UTC](https://discourse.slicer.org/t/slice-view-does-not-fit-to-background-on-loading-a-volume/40230/3 "2024-11-17T20:42:50Z")

</div>

> [@pieper](#):
>
> share an example volume

Sure, here is [one](https://disk.yandex.com/d/zlErI05tuga7vg), cropped from CTA-cardio. I just tested with 5.7.0-2024-11-15 r33115 / 7438bf2 from your website with the same unexpected result. It’s not a big issue, I just reported it in case there might be something to fix.

---

<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:** [November 17, 2024, 9:13pm UTC](https://discourse.slicer.org/t/slice-view-does-not-fit-to-background-on-loading-a-volume/40230/4 "2024-11-17T21:13:20Z")

</div>

I can confirm this is a regression - the nightly preview is first below, and the latest 5.6.2 release is below that. All I did was drag-and-drop the file provided by @chir.set on each.

 ![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/7/a/7a4f9d28d57d68dc48fc12cdf488f943003369bf.png)

 ![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/5/9/591854313b64ed96c9f5276a09edccb52b9125a3.jpeg)

---

<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:** [November 18, 2024, 9:40pm UTC](https://discourse.slicer.org/t/slice-view-does-not-fit-to-background-on-loading-a-volume/40230/5 "2024-11-18T21:40:46Z")

</div>

Indeed, `Reset to field of view` does not work for this volume. How to reproduce: link slice views, click `Reset to field of view` button in any of the slice views.

@chir.set to make sure we take care of this before the new stable release, would you mind submitting a bug report to [issues.slicer.org](http://issues.slicer.org) and post the link here? Thank you!

---

<div class="post-metadata">

**Author:** ![chir.set](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/chir.set/32/66982_2.png) [@chir.set](https://discourse.slicer.org/u/chir.set)\
**Post date:** [November 19, 2024, 7:20am UTC](https://discourse.slicer.org/t/slice-view-does-not-fit-to-background-on-loading-a-volume/40230/6 "2024-11-19T07:20:41Z")

</div>

> [@lassoan](#):
>
> post the link here

The issue is reported [here](https://github.com/Slicer/Slicer/issues/8053).

Thank you all.

---

<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:** [November 25, 2024, 5:54pm UTC](https://discourse.slicer.org/t/slice-view-does-not-fit-to-background-on-loading-a-volume/40230/7 "2024-11-25T17:54:32Z")

</div>

Fix is provided in this pull request:

> <https://github.com/Slicer/Slicer/pull/8063>
>
> Fixed and fit slice to volume and made it work consistently for both when backgr…ound clipping is enabled (default) or disabled.
> 
> \<img width="1394" alt="image" src="https://github.com/user-attachments/assets/1936df0b-75ba-45ef-89bf-0d059423ca4c"\>
