# Reformatted slice node doesn't restore its original orientation

**URL:** <https://discourse.slicer.org/t/reformatted-slice-node-doesnt-restore-its-original-orientation/19601>\
**Category:** Development\
**Created:** [September 10, 2021, 1:40am UTC](https://discourse.slicer.org/t/reformatted-slice-node-doesnt-restore-its-original-orientation/19601 "2021-09-10T01:40:51Z")\
**Posts on this page:** 4\
**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 10, 2021, 1:40am UTC](https://discourse.slicer.org/t/reformatted-slice-node-doesnt-restore-its-original-orientation/19601/1 "2021-09-10T01:40:51Z")

</div>

Hi,

Slice node `vtkMRMLNode` has a method `GetOrientation()` wich returns string value: Axial, Coronal, Sagittal or Reformat.  
Also there is a button on the view that probably [restore the default state (on the picture)](https://slicer.readthedocs.io/en/latest/user_guide/user_interface.html?highlight=background%20layer#slice-view)  
 ![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/9/2/924de4cbccb16bfcb18837c0457a6ee9ef3d2152.png)  
I tried to reformat the slice, restore it (by pressing on that button) and check the orientation (I expected that it should have been changed back to Axial):

```python
layoutManager = slicer.app.layoutManager()
view = layoutManager.sliceWidget('Red').sliceView()
sliceNode = view.mrmlSliceNode()
sliceNode.GetOrientation() # gives `Reformat`

```

but it returns `Reformat` orientation.

Is it expected behaviour?

---

<div class="post-metadata">

**Author:** ![jamesobutler](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/jamesobutler/32/7511_2.png) [@jamesobutler](https://discourse.slicer.org/u/jamesobutler)\
**Post date:** [September 10, 2021, 3:51am UTC](https://discourse.slicer.org/t/reformatted-slice-node-doesnt-restore-its-original-orientation/19601/2 "2021-09-10T03:51:54Z")

</div>

The button immediately to the left of the slice offset slider is the maximize/restore for the slice layout. This is a new button recently added. See the following for details on that feature

> [@New feature: maximize view](https://discourse.slicer.org/t/new-feature-maximize-view/19581):
>
> We added a new feature that allows quickly maximize a view (use the space of the entire view layout) without switching between layouts. The feature can be activated using 3 methods: double-click on a view to maximize/restore click the maximize/restore button in the view control bar (at the top of each view) right-click on the view and choose maximize/restore When the view is restored then the original view layout is restored. The feature is available in latest Slicer Preview Relea…

There isn’t a button for resetting default orientation. You can change orientation in the slice view pop up widget that displays when hovering over the slice offset slider area. There is a combobox for selecting orientation.

You can also set orientation programmatically like so:

```python
orientation = slicer.app.layoutManager().sliceWidget("Red").sliceLogic().GetSliceNode().GetDefaultOrientation()
slicer.app.layoutManager().sliceWidget("Red").setSliceOrientation(orientation)

```

---

<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:** [September 10, 2021, 4:32am UTC](https://discourse.slicer.org/t/reformatted-slice-node-doesnt-restore-its-original-orientation/19601/3 "2021-09-10T04:32:56Z")

</div>

If you use a recent Slicer Preview Release then you can enable “Reset view orientation on show” option (by right-clicking on the eye icon in Data module) and then hide and show the volume (by clicking on the eye icon).

 ![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/4/7/4745550f26f52b4ffa7d97d8e6e325493355be41.png)

---

<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 10, 2021, 11:09am UTC](https://discourse.slicer.org/t/reformatted-slice-node-doesnt-restore-its-original-orientation/19601/4 "2021-09-10T11:09:02Z")

</div>

@jamesobutler

> [@jamesobutler](#):
>
> The button immediately to the left of the slice offset slider is the maximize/restore for the slice layout. This is a new button recently added.

I meant the button that is near to maximize button (in orange rectangle):  
 ![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/b/d/bde51ba80d78e32a6ed8b674dc96511466823c80.png)  
But still, as you said I can modify orientation in combobox, that is good.

@lassoan thank you for the help, I use SlicerCAT based on recent Slicer so I have tried your solution and it works.
