Skip to content

Commit a31870d

Browse files
committed
FIX: Set dtypes for integer test images
NiBabel 4 began warning that int64 images would error, and NiBabel 5 began erroring if not passed an explicit dtype or header. We don't need int64 images, just set some sensible dtypes.
1 parent 7382b3d commit a31870d

File tree

3 files changed

+4
-3
lines changed

3 files changed

+4
-3
lines changed

nipype/algorithms/tests/test_ErrorMap.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ def test_errormap(tmpdir):
1717
volume1 = np.array([[[2.0, 8.0], [1.0, 2.0]], [[1.0, 9.0], [0.0, 3.0]]])
1818
# Alan Turing's birthday
1919
volume2 = np.array([[[0.0, 7.0], [2.0, 3.0]], [[1.0, 9.0], [1.0, 2.0]]])
20-
mask = np.array([[[1, 0], [0, 1]], [[1, 0], [0, 1]]])
20+
mask = np.array([[[1, 0], [0, 1]], [[1, 0], [0, 1]]], dtype=np.uint8)
2121

2222
img1 = nb.Nifti1Image(volume1, np.eye(4))
2323
img2 = nb.Nifti1Image(volume2, np.eye(4))

nipype/algorithms/tests/test_TSNR.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,5 +131,6 @@ def assert_unchanged(self, expected_ranges):
131131
[
132132
[[[2, 4, 3, 9, 1], [3, 6, 4, 7, 4]], [[8, 3, 4, 6, 2], [4, 0, 4, 4, 2]]],
133133
[[[9, 7, 5, 5, 7], [7, 8, 4, 8, 4]], [[0, 4, 7, 1, 7], [6, 8, 8, 8, 7]]],
134-
]
134+
],
135+
dtype=np.int16,
135136
)

nipype/algorithms/tests/test_metrics.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ def test_fuzzy_overlap(tmpdir):
4545

4646
# Just considering the mask, the central pixel
4747
# that raised the index now is left aside.
48-
data = np.zeros((3, 3, 3), dtype=int)
48+
data = np.zeros((3, 3, 3), dtype=np.uint8)
4949
data[0, 0, 0] = 1
5050
data[2, 2, 2] = 1
5151
nb.Nifti1Image(data, np.eye(4)).to_filename("mask.nii.gz")

0 commit comments

Comments
 (0)