How to export posituon parameters like slice center and the normal vector for the slice plane?

Hi!

I wanted to know how can we export position parameters like slice center and the normal vector for the slice plane we are viewing such that I can visualize that slice of the 3D data in lets say python? Thanks for the help

You can get the slice transformation matrix using the slice Id (here for the default red slice). This returns the 4x4 transform matrix, from which you can retrieve the slice origin and the normal vector.

sliceNode = slicer.util.getNode('vtkMRMLSliceNodeRed')
sliceToRas = sliceNode..GetSliceToRAS()
origin = np.array([sliceToRas.GetElement(i, 3) for i in range(3)])
normal = np.array([sliceToRas.GetElement(0, 2), sliceToRas.GetElement(1, 2), sliceToRas.GetElement(2, 2)])
1 Like