NiBabel

Access a cacophony of neuro-imaging file formats

Previous topic

nibabel.eulerangles.quat2euler

Next topic

nibabel.eulerangles.euler2angle_axis

This Page

Reggie -- the one

nibabel.eulerangles.angle_axis2euler

nibabel.eulerangles.angle_axis2euler(theta, vector, is_normalized=False)

Convert angle, axis pair to Euler angles

Parameters :

theta : scalar

angle of rotation

vector : 3 element sequence

vector specifying axis for rotation.

is_normalized : bool, optional

True if vector is already normalized (has norm of 1). Default False

Returns :

z : scalar

y : scalar

x : scalar

Rotations in radians around z, y, x axes, respectively

Notes

It’s possible to reduce the amount of calculation a little, by combining parts of the angle_axis2mat and mat2euler functions, but the reduction in computation is small, and the code repetition is large.

Examples

>>> z, y, x = angle_axis2euler(0, [1, 0, 0])
>>> np.allclose((z, y, x), 0)
True