# Proposition to preserve Slice view aspect ratio when resizing the window

**URL:** <https://discourse.slicer.org/t/proposition-to-preserve-slice-view-aspect-ratio-when-resizing-the-window/22709>\
**Category:** Development\
**Created:** [March 27, 2022, 2:41pm UTC](https://discourse.slicer.org/t/proposition-to-preserve-slice-view-aspect-ratio-when-resizing-the-window/22709 "2022-03-27T14:41:36Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![keri](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/keri/32/11618_2.png) [@keri](https://discourse.slicer.org/u/keri)\
**Post date:** [March 27, 2022, 2:41pm UTC](https://discourse.slicer.org/t/proposition-to-preserve-slice-view-aspect-ratio-when-resizing-the-window/22709/1 "2022-03-27T14:41:36Z")

</div>

Hi,

In SlicerCAT I add support to modify slice view’s aspect ratio, i.e. the horizontal scaling may not be equal to vertical scaling.

When slice window is resized it calls [vtkMRMLSliceLogic::ResizeSliceNode](https://github.com/Slicer/Slicer/blob/b362a139d35373c6cccfff501c3935c482c52024/Libs/MRML/Logic/vtkMRMLSliceLogic.cxx#L1741) that modify FOV while resetting the aspect ratio.

For example if I set aspect ratio for slice view 2:1 then after the slice window is resized I get the restored aspect ratio 1:1. If I manually changed the aspect ratio then most likely I don’t want that it was reset after resizing the window.  
May we change that so that the aspect ratio stays untouched?  
To do so it is enough to delete [5 lines of code](https://github.com/Slicer/Slicer/blob/b362a139d35373c6cccfff501c3935c482c52024/Libs/MRML/Logic/vtkMRMLSliceLogic.cxx#L1778-L1783) of `ResizeSliceNode` function.

If the user wants to reset the aspect ratio (to 1:1) then there is a button that resets FOV and aspect ratio:  
 ![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/4/e/4effc30a8f13fb7927ec2f73597539eadcc58197.png)

---

<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:** [March 27, 2022, 5:00pm UTC](https://discourse.slicer.org/t/proposition-to-preserve-slice-view-aspect-ratio-when-resizing-the-window/22709/2 "2022-03-27T17:00:48Z")

</div>

I’d be very wary of introducing the possibility of accidental distortions for our core medical imaging use cases. Instead of changing the view, why don’t you use a transformation to compress or expand the data along an axis. Or you could observe the slice node and set it to the desired aspect ratio any time it’s updated.

---

<div class="post-metadata">

**Author:** ![keri](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/keri/32/11618_2.png) [@keri](https://discourse.slicer.org/u/keri)\
**Post date:** [March 27, 2022, 5:14pm UTC](https://discourse.slicer.org/t/proposition-to-preserve-slice-view-aspect-ratio-when-resizing-the-window/22709/3 "2022-03-27T17:14:50Z")

</div>

Thank for response,

Applying transform to every node is much harder as I also use XYZ axes shown at all borders that are represented by axes actors. It is much easier to set FOV.

> [@pieper](#):
>
> Or you could observe the slice node and set it to the desired aspect ratio any time it’s updated.

That is possible solution.

Just to clarify: it is completely fine if this proposition will be declined. I can patch this function during SlicerCAT build so it is not a problem for me. I just thought that it would be more intuitive for any Slicer user.
