Return angle, axis corresponding to these Euler angles Uses the z, then y, then x convention above Parameters ---------- z : scalar Rotation angle in radians around z-axis (performed first) y : scalar Rotation angle in radians around y-axis x : scalar
(z=0, y=0, x=0)
| 345 | |
| 346 | |
| 347 | def euler2angle_axis(z=0, y=0, x=0): |
| 348 | ''' Return angle, axis corresponding to these Euler angles |
| 349 | |
| 350 | Uses the z, then y, then x convention above |
| 351 | |
| 352 | Parameters |
| 353 | ---------- |
| 354 | z : scalar |
| 355 | Rotation angle in radians around z-axis (performed first) |
| 356 | y : scalar |
| 357 | Rotation angle in radians around y-axis |
| 358 | x : scalar |
| 359 | Rotation angle in radians around x-axis (performed last) |
| 360 | |
| 361 | Returns |
| 362 | ------- |
| 363 | theta : scalar |
| 364 | angle of rotation |
| 365 | vector : array shape (3,) |
| 366 | axis around which rotation occurs |
| 367 | |
| 368 | Examples |
| 369 | -------- |
| 370 | >>> theta, vec = euler2angle_axis(0, 1.5, 0) |
| 371 | >>> print(theta) |
| 372 | 1.5 |
| 373 | >>> np.allclose(vec, [0, 1, 0]) |
| 374 | True |
| 375 | ''' |
| 376 | # delayed import to avoid cyclic dependencies |
| 377 | import nibabel.quaternions as nq |
| 378 | return nq.quat2angle_axis(euler2quat(z, y, x)) |
| 379 | |
| 380 | |
| 381 | def angle_axis2euler(theta, vector, is_normalized=False): |
nothing calls this directly
no test coverage detected