# How to set FOV through XML

**URL:** <https://discourse.slicer.org/t/how-to-set-fov-through-xml/24586>\
**Category:** Development\
**Tags:** segmentation\
**Created:** [August 1, 2022, 2:58am UTC](https://discourse.slicer.org/t/how-to-set-fov-through-xml/24586 "2022-08-01T02:58:03Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![michabermoy](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/michabermoy/32/16003_2.png) [@michabermoy](https://discourse.slicer.org/u/michabermoy)\
**Post date:** [August 1, 2022, 2:58am UTC](https://discourse.slicer.org/t/how-to-set-fov-through-xml/24586/1 "2022-08-01T02:58:03Z")

</div>

I have written code that generates a customized tabbed layout based on the number of segments as shown below:

 ![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/c/9/c9f4e6e0cbf9a64a3260b9f1fbb5e368dde762f7.png)  
 ![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/7/f/7f39ff21aa218220d50b7a2e06caee54ca765217.png)

However, the field of view for the Red (Axial), Green (Coronal), and Yellow (Sagittal) view windows is not centered and zoomed in so that you can see the volume and its segments. As you can see from the images attached, none of the segments are visible in any of the slice windows. Is there a way to fix this issue so that whenever I generate the customized view, the segments are centered on each window like so:

 ![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/0/6/06173fcfa49c5e1291c73a75196794297556cb7e.png)

---

<div class="post-metadata">

**Author:** ![jay1987](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/jay1987/32/16183_2.png) [@jay1987](https://discourse.slicer.org/u/jay1987)\
**Post date:** [August 1, 2022, 5:24am UTC](https://discourse.slicer.org/t/how-to-set-fov-through-xml/24586/2 "2022-08-01T05:24:25Z")

</div>

it can be done with python or C++ code,i don’t known how to do through XML

---

<div class="post-metadata">

**Author:** ![michabermoy](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/michabermoy/32/16003_2.png) [@michabermoy](https://discourse.slicer.org/u/michabermoy)\
**Post date:** [August 1, 2022, 12:16pm UTC](https://discourse.slicer.org/t/how-to-set-fov-through-xml/24586/3 "2022-08-01T12:16:27Z")

</div>

How would you do it through python? My code is a mix of python and some XML.

---

<div class="post-metadata">

**Author:** ![jay1987](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/jay1987/32/16183_2.png) [@jay1987](https://discourse.slicer.org/u/jay1987)\
**Post date:** [August 1, 2022, 12:36pm UTC](https://discourse.slicer.org/t/how-to-set-fov-through-xml/24586/4 "2022-08-01T12:36:49Z")

</div>

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

try these codes
