Skip to content

Commit 2dcce40

Browse files
committed
enh(afni): change reference in linear resampling test
1 parent 2140b59 commit 2dcce40

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

nitransforms/tests/test_linear.py

+8-3
Original file line numberDiff line numberDiff line change
@@ -171,9 +171,6 @@ def test_apply_linear_transform(tmpdir, get_testdata, get_testmask, image_orient
171171
"""Check implementation of exporting affines to formats."""
172172
tmpdir.chdir()
173173

174-
if (sw_tool, image_orientation) == ("afni", "oblique"):
175-
pytest.skip("AFNI oblique transformations not supported yet.")
176-
177174
img = get_testdata[image_orientation]
178175
msk = get_testmask[image_orientation]
179176

@@ -211,10 +208,18 @@ def test_apply_linear_transform(tmpdir, get_testdata, get_testmask, image_orient
211208
exit_code = check_call([cmd], shell=True)
212209
assert exit_code == 0
213210
sw_moved_mask = nb.load("resampled_brainmask.nii.gz")
211+
212+
# Change reference dataset for AFNI & oblique
213+
if (sw_tool, image_orientation) == ("afni", "oblique"):
214+
xfm.reference = "resampled_brainmask.nii.gz"
215+
214216
nt_moved_mask = xfm.apply(msk, order=0)
215217
nt_moved_mask.set_data_dtype(msk.get_data_dtype())
218+
nt_moved_mask.to_filename("nt_resampled_brainmask.nii.gz")
216219
diff = np.asanyarray(sw_moved_mask.dataobj) - np.asanyarray(nt_moved_mask.dataobj)
217220

221+
nt_moved_mask.__class__(diff, sw_moved_mask.affine, sw_moved_mask.header).to_filename("diff.nii.gz")
222+
218223
assert np.sqrt((diff ** 2).mean()) < RMSE_TOL
219224
brainmask = np.asanyarray(nt_moved_mask.dataobj, dtype=bool)
220225

0 commit comments

Comments
 (0)