# Define field of view

**URL:** <https://discourse.slicer.org/t/define-field-of-view/12933>\
**Category:** Support\
**Created:** [August 10, 2020, 6:43pm UTC](https://discourse.slicer.org/t/define-field-of-view/12933 "2020-08-10T18:43:33Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jj31](https://avatars.discourse-cdn.com/v4/letter/j/ccd318/32.png) [@jj31](https://discourse.slicer.org/u/jj31)\
**Post date:** [August 10, 2020, 6:43pm UTC](https://discourse.slicer.org/t/define-field-of-view/12933/1 "2020-08-10T18:43:33Z")

</div>

Hello,

I developed a small simple module to open a VTK/VTU file and perform a series of calculations. Every time I open the file, I need to manually adjust the field of view (zoom and move to the center of the window viewer) for each of the red/yellow/green slice viewers. Is there a way (code) so that the views are automatically adjusted?

Thanks,  
JJ

---

<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:** [August 10, 2020, 6:56pm UTC](https://discourse.slicer.org/t/define-field-of-view/12933/2 "2020-08-10T18:56:59Z")

</div>

Hi - yes, just search the source code for `FitSliceToAll`. There are some variants and options.

---

<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 10, 2020, 7:08pm UTC](https://discourse.slicer.org/t/define-field-of-view/12933/3 "2020-08-10T19:08:56Z")

</div>

See also this example: [https://www.slicer.org/wiki/Documentation/Nightly/ScriptRepository#Center\_the\_3D\_View\_on\_the\_Scene](https://www.slicer.org/wiki/Documentation/Nightly/ScriptRepository#Center_the_3D_View_on_the_Scene)
