# Resizing slice view doesn't preserve field of view

**URL:** <https://discourse.slicer.org/t/resizing-slice-view-doesnt-preserve-field-of-view/19636>\
**Category:** Development\
**Created:** [September 13, 2021, 1:44am UTC](https://discourse.slicer.org/t/resizing-slice-view-doesnt-preserve-field-of-view/19636 "2021-09-13T01:44:56Z")\
**Posts on this page:** 2\
**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:** [September 13, 2021, 1:44am UTC](https://discourse.slicer.org/t/resizing-slice-view-doesnt-preserve-field-of-view/19636/1 "2021-09-13T01:44:56Z")

</div>

Hi,

Let’s suppose I intensionally changed field of view in slice node:

```python
sliceNode = layoutManager = slicer.app.layoutManager().sliceWidget('Red').sliceView().mrmlSliceNode()
sliceNode.SetFieldOfView(100, 300, 1)

```

and then I change slice view either by gragging QSplitter or by clicking on maximize button (on the picture) and apparently restores field of view to default.

Is this a drawback and the behaviour will be fixed in the future or it is done intensionally and to preserve my custom aspect ratio I need to hardcode my module?

![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/5/c/5c81f1a9373d1d6f868d3c5dec0eddac495e417b.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:** [September 13, 2021, 2:45pm UTC](https://discourse.slicer.org/t/resizing-slice-view-doesnt-preserve-field-of-view/19636/2 "2021-09-13T14:45:15Z")

</div>

The field of view needs to match the shape of the window, which can change when the layout changes. We can’t have the aspect ratio of the image change (it would distort the anatomy). So if you change the field of view in your custom code you will need to reset it when the layout changes.
