Reformatted slice node doesn't restore its original orientation

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)
image
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):

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?

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

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:

orientation = slicer.app.layoutManager().sliceWidget("Red").sliceLogic().GetSliceNode().GetDefaultOrientation()
slicer.app.layoutManager().sliceWidget("Red").setSliceOrientation(orientation)
2 Likes

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

1 Like

@jamesobutler

I meant the button that is near to maximize button (in orange rectangle):
image
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.