# Avoid recenter during vtkMRMLSliceLogic::FitSliceToAll

**URL:** <https://discourse.slicer.org/t/avoid-recenter-during-vtkmrmlslicelogic-fitslicetoall/20496>\
**Category:** Development\
**Created:** [November 5, 2021, 9:46am UTC](https://discourse.slicer.org/t/avoid-recenter-during-vtkmrmlslicelogic-fitslicetoall/20496 "2021-11-05T09:46:52Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![riep](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/riep/32/9933_2.png) [@riep](https://discourse.slicer.org/u/riep)\
**Post date:** [November 5, 2021, 9:46am UTC](https://discourse.slicer.org/t/avoid-recenter-during-vtkmrmlslicelogic-fitslicetoall/20496/1 "2021-11-05T09:46:52Z")

</div>

Hi all,  
I am wondering if I could do a modification of vtkMRMLSliceLogic::FitSliceToVolume to add a Boolean to avoid recenter and only adjust de FOV. Would it sounds good to you?  
The final objective is to have it exposed in vtkMRMLSliceLogic::FitSliceToAll  
Pierre

---

<div class="post-metadata">

**Author:** ![riep](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/riep/32/9933_2.png) [@riep](https://discourse.slicer.org/u/riep)\
**Post date:** [November 5, 2021, 12:42pm UTC](https://discourse.slicer.org/t/avoid-recenter-during-vtkmrmlslicelogic-fitslicetoall/20496/2 "2021-11-05T12:42:37Z")

</div>

I do not plan to change the current slicer behavior, so this option would be by default activated.

---

<div class="post-metadata">

**Author:** ![jamesobutler](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/jamesobutler/32/7511_2.png) [@jamesobutler](https://discourse.slicer.org/u/jamesobutler)\
**Post date:** [November 5, 2021, 2:03pm UTC](https://discourse.slicer.org/t/avoid-recenter-during-vtkmrmlslicelogic-fitslicetoall/20496/3 "2021-11-05T14:03:27Z")

</div>

Isn’t FitSliceToVolume inherently a centering action because it is attempting to fit the extent of the volume into the current slice view? Fitting both width and height to the view is like centering FOV.

Or are you just trying to select the volume as the background volume to show in the slice views?

---

<div class="post-metadata">

**Author:** ![riep](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/riep/32/9933_2.png) [@riep](https://discourse.slicer.org/u/riep)\
**Post date:** [November 5, 2021, 2:21pm UTC](https://discourse.slicer.org/t/avoid-recenter-during-vtkmrmlslicelogic-fitslicetoall/20496/4 "2021-11-05T14:21:50Z")

</div>

We could also see it as an adjustment of the FOV without changing the origins of the slices.  
**example** : part of your image is hidden because of a zoom in. Now you want to see the full image at the exact same slice offset (without changing the origins) for now it is not possible except by zooming out manually.

---

<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 8, 2021, 2:50am UTC](https://discourse.slicer.org/t/avoid-recenter-during-vtkmrmlslicelogic-fitslicetoall/20496/5 "2021-11-08T02:50:03Z")

</div>

I’ve felt the need for this feature a few times, too (center the view but not change the slice offset). It would be nice if you could implement this extra flag in vtkMRMLSlicerLogic. An extra flag in vtkMRMLSliceLogic::Fit\* methods would be suitable. The implementation is not completely trivial, as you would need to intersect the bounding box with the transformed volume node. I’m not sure how (if) I would expose this feature on the GUI.

---

<div class="post-metadata">

**Author:** ![riep](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/riep/32/9933_2.png) [@riep](https://discourse.slicer.org/u/riep)\
**Post date:** [November 8, 2021, 11:28am UTC](https://discourse.slicer.org/t/avoid-recenter-during-vtkmrmlslicelogic-fitslicetoall/20496/6 "2021-11-08T11:28:59Z")

</div>

thanks, Andreas & James, I will work on it and keep you posted.
