# Update plane from fiducial points
def UpdateSlicePlane(data):
a = data
points = np.array([list(zip(*a))])[0]
# b2 = np.array([list(zip(*a))])
sliceNode = slicer.app.layoutManager().sliceWidget("Red").mrmlSliceNode()
planePosition = points.mean(axis=1)
planeNormal = np.cross(points[:,1] - points[:,0], points[:,2] - points[:,0])
planeX = points[:,1] - points[:,0]
sliceNode.SetSliceToRASByNTP(planeNormal[0], planeNormal[1], planeNormal[2],
planeX[0], planeX[1], planeX[2],
planePosition[0], planePosition[1], planePosition[2], 0)
UpdateSlicePlane(data33)
slicernb.ViewDisplay('OneUpRedSlice', center=False)
我想将图片对齐,就像这样:
I want aligne the red plane with Coordinate axis?, like that: