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