How do I get the real-time Angle of a 3D image, as shown in the figure?

You can find a script that prints anatomical angles (RAO/LAO, CRA/CAU) in the corner of a 3D view in this post.