# FOV, spacing match Volumes

**URL:** <https://discourse.slicer.org/t/fov-spacing-match-volumes/11905>\
**Category:** Support\
**Created:** [June 6, 2020, 2:50pm UTC](https://discourse.slicer.org/t/fov-spacing-match-volumes/11905 "2020-06-06T14:50:07Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![ada](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/ada/32/15944_2.png) [@ada](https://discourse.slicer.org/u/ada)\
**Post date:** [June 6, 2020, 2:50pm UTC](https://discourse.slicer.org/t/fov-spacing-match-volumes/11905/1 "2020-06-06T14:50:07Z")

</div>

Hi developers,

What is the python function to set the slice views as “FOV, spacing match Volumes” instead of “FOV, spacing match 2D” ?  
Thank you,  
Best

---

<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:** [June 6, 2020, 9:15pm UTC](https://discourse.slicer.org/t/fov-spacing-match-volumes/11905/2 "2020-06-06T21:15:13Z")

</div>

It controls how Slicer generates pixels of the slice that is shown in the 3D view. See more details [here](https://slicer.readthedocs.io/en/latest/user_guide/user_interface.html#slice-view). Let us know if you need more details.

---

<div class="post-metadata">

**Author:** ![ada](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/ada/32/15944_2.png) [@ada](https://discourse.slicer.org/u/ada)\
**Post date:** [June 6, 2020, 9:28pm UTC](https://discourse.slicer.org/t/fov-spacing-match-volumes/11905/3 "2020-06-06T21:28:01Z")

</div>

Hello,  
Thank you for your answer. I know what is done, I just would like to know how can I automatically set this option with my own script in python ?  
Thank you

---

<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:** [June 6, 2020, 11:07pm UTC](https://discourse.slicer.org/t/fov-spacing-match-volumes/11905/4 "2020-06-06T23:07:54Z")

</div>

How to find a Python function for any Slicer features:

- Go to [Slicer project repository on github](https://github.com/Slicer/Slicer/)
- Enter text that you see on the GUI near the function that you want to use. In this case, enter `"FOV, spacing match Volumes"` (adding quotes around the text makes sure it finds that exact text)
- Usually the text is found in a .ui file, in this case it is in [qMRMLSliceControllerWidget.ui](https://github.com/Slicer/Slicer/blob/dfef9574096a10c4f02337b59c5edfd6810b55db/Libs/MRML/Widgets/Resources/UI/qMRMLSliceControllerWidget.ui), open the file
- Find the text in the page, and look up what is the name of the widget or action that it is associated with - in this case it is an action named `actionSliceModelModeVolumes`
- Search for that widget or action name in the repository, you should find a source file(s) that use it. In this case it will is [qMRMLSliceControllerWidget.cxx](https://github.com/Slicer/Slicer/blob/46345e8a3dba3d591a7f06767aff83a2beefad6a/Libs/MRML/Widgets/qMRMLSliceControllerWidget.cxx)
- Search for the action/widget name, and you’ll find what it does - in this case it calls `setSliceModelModeVolumes` method, which calls `this->setSliceModelMode(vtkMRMLSliceNode::SliceResolutionMatchVolumes)`, which then calls `d->MRMLSliceNode->SetSliceResolutionMode(mode)`

This means that this action calls `someSliceNode->SetSliceResolutionMode(vtkMRMLSliceNode::SliceResolutionMatchVolumes)` in Python syntax it is `someSliceNode.SetSliceResolutionMode(slicer.vtkMRMLSliceNode.SliceResolutionMatchVolumes)`. For example, for the red slice node this will be:

```python
sliceNode = slicer.mrmlScene.GetNodeByID('vtkMRMLSliceNodeRed')
sliceNode.SetSliceResolutionMode(slicer.vtkMRMLSliceNode.SliceResolutionMatchVolumes)

```

---

<div class="post-metadata">

**Author:** ![ada](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/ada/32/15944_2.png) [@ada](https://discourse.slicer.org/u/ada)\
**Post date:** [June 8, 2020, 7:21am UTC](https://discourse.slicer.org/t/fov-spacing-match-volumes/11905/5 "2020-06-08T07:21:37Z")

</div>

Thank you so much for your help !
