|
7 | 7 |
|
8 | 8 | from ..eulerangles import euler2mat
|
9 | 9 | from ..affines import (AffineError, apply_affine, append_diag, to_matvec,
|
10 |
| - from_matvec, dot_reduce, voxel_sizes) |
| 10 | + from_matvec, dot_reduce, voxel_sizes, obliquity) |
11 | 11 |
|
12 | 12 |
|
13 | 13 | from nose.tools import assert_equal, assert_raises
|
@@ -178,3 +178,13 @@ def test_voxel_sizes():
|
178 | 178 | rot_affine[:3, :3] = rotation
|
179 | 179 | full_aff = rot_affine.dot(aff)
|
180 | 180 | assert_almost_equal(voxel_sizes(full_aff), vox_sizes)
|
| 181 | + |
| 182 | + |
| 183 | +def test_obliquity(): |
| 184 | + """Check the calculation of inclination of an affine axes.""" |
| 185 | + aligned = np.diag([2.0, 2.0, 2.3, 1.0]) |
| 186 | + aligned[:-1, -1] = [-10, -10, -7] |
| 187 | + R = from_matvec(euler2mat(x=0.09, y=0.001, z=0.001), [0.0, 0.0, 0.0]) |
| 188 | + oblique = R.dot(aligned) |
| 189 | + assert_almost_equal(obliquity(aligned), 0.0) |
| 190 | + assert_almost_equal(obliquity(oblique), 5.1569948883) |
0 commit comments