Get the slice view under the mouse cursor

Hello slicer developers,
How to get the slice view (Red, Green or Yellow) under the mouse cursor in Python, like what shown in Data Probe module (Eg: Green in the image)?

And also how to get the plane coordinates (or plane equation) of the current slice view, so that i can set the plane to that slice view later when a button is clicked.

Screenshot from 2024-07-21 11-39-51

See examples in the script repository. You can get the slice normal from the SliceToRAS homogeneous transformation matrix (slice normal in the RAS coordinate system is the third column of the matrix).

1 Like