How to set FOV through XML

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

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:

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

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


try these codes