Skip to content

Commit 9c2d313

Browse files
committed
fix: rapidart tests
1 parent 155e8b7 commit 9c2d313

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

nipype/algorithms/tests/test_rapidart.py

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -50,37 +50,40 @@ def test_ad_output_filenames():
5050
ad = ra.ArtifactDetect()
5151
outputdir = '/tmp'
5252
f = 'motion.nii'
53-
outlierfile, intensityfile, statsfile, normfile, plotfile = ad._get_output_filenames(f, outputdir)
53+
(outlierfile, intensityfile, statsfile, normfile, plotfile,
54+
displacementfile, maskfile) = ad._get_output_filenames(f, outputdir)
5455
yield assert_equal, outlierfile, '/tmp/art.motion_outliers.txt'
5556
yield assert_equal, intensityfile, '/tmp/global_intensity.motion.txt'
5657
yield assert_equal, statsfile, '/tmp/stats.motion.txt'
5758
yield assert_equal, normfile, '/tmp/norm.motion.txt'
5859
yield assert_equal, plotfile, '/tmp/plot.motion.png'
60+
yield assert_equal, displacementfile, '/tmp/disp.motion.nii'
61+
yield assert_equal, maskfile, '/tmp/mask.motion.nii'
5962

6063

6164
def test_ad_get_affine_matrix():
6265
ad = ra.ArtifactDetect()
63-
matrix = ad._get_affine_matrix(np.array([0]))
66+
matrix = ra._get_affine_matrix(np.array([0]), 'SPM')
6467
yield assert_equal, matrix, np.eye(4)
6568
# test translation
6669
params = [1, 2, 3]
67-
matrix = ad._get_affine_matrix(params)
70+
matrix = ra._get_affine_matrix(params, 'SPM')
6871
out = np.eye(4)
6972
out[0:3, 3] = params
7073
yield assert_equal, matrix, out
7174
# test rotation
7275
params = np.array([0, 0, 0, np.pi / 2, np.pi / 2, np.pi / 2])
73-
matrix = ad._get_affine_matrix(params)
76+
matrix = ra._get_affine_matrix(params, 'SPM')
7477
out = np.array([0, 0, 1, 0, 0, -1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1]).reshape((4, 4))
7578
yield assert_almost_equal, matrix, out
7679
# test scaling
7780
params = np.array([0, 0, 0, 0, 0, 0, 1, 2, 3])
78-
matrix = ad._get_affine_matrix(params)
81+
matrix = ra._get_affine_matrix(params, 'SPM')
7982
out = np.array([1, 0, 0, 0, 0, 2, 0, 0, 0, 0, 3, 0, 0, 0, 0, 1]).reshape((4, 4))
8083
yield assert_equal, matrix, out
8184
# test shear
8285
params = np.array([0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 3])
83-
matrix = ad._get_affine_matrix(params)
86+
matrix = ra._get_affine_matrix(params, 'SPM')
8487
out = np.array([1, 1, 2, 0, 0, 1, 3, 0, 0, 0, 1, 0, 0, 0, 0, 1]).reshape((4, 4))
8588
yield assert_equal, matrix, out
8689

@@ -90,9 +93,9 @@ def test_ad_get_norm():
9093
params = np.array([0, 0, 0, 0, 0, 0, 0, 0, 0, np.pi / 4, np.pi / 4,
9194
np.pi / 4, 0, 0, 0, -np.pi / 4,
9295
-np.pi / 4, -np.pi / 4]).reshape((3, 6))
93-
norm = ad._calc_norm(params, False)
96+
norm, _ = ra._calc_norm(params, False, 'SPM')
9497
yield assert_almost_equal, norm, np.array([18.86436316, 37.74610158, 31.29780829])
95-
norm = ad._calc_norm(params, True)
98+
norm, _ = ra._calc_norm(params, True, 'SPM')
9699
yield assert_almost_equal, norm, np.array([0., 143.72192614, 173.92527131])
97100

98101

0 commit comments

Comments
 (0)