Skip to content

Commit 58e8916

Browse files
committed
BF: residual outputs reversed domain and range
The residual output reversed the coordmap domain and range. Until now the tests didn't pick this up because we allowed through XYZ output names that didn't match expected names for NIFTI. The nifti writer does now check for these, and tranposes the image accordingly. Now the image is being transposed, the test needs to look for the NIFTI transposed shape.
1 parent f7075d5 commit 58e8916

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

nipy/modalities/fmri/fmristat/model.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -402,10 +402,9 @@ def output_resid(outfile, fmri_image, clobber=False):
402402
T[0,0] = (fmri_image.volume_start_times[1:] -
403403
fmri_image.volume_start_times[:-1]).mean()
404404
# FIXME: NIFTI specific naming here
405-
innames = ["l"] + list(g.function_range.coord_names)
406-
outnames = ["t"] + list(g.function_domain.coord_names)
407-
cmap = AffineTransform.from_params(innames,
408-
outnames, T)
405+
innames = ["t"] + list(g.function_domain.coord_names)
406+
outnames = ["t"] + list(g.function_range.coord_names)
407+
cmap = AffineTransform.from_params(innames, outnames, T)
409408
shape = (n,) + fmri_image[0].shape
410409
elif isinstance(fmri_image, Image):
411410
cmap = fmri_image.coordmap

nipy/modalities/fmri/fmristat/tests/test_model.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ def test_run():
8181
f_data = f_img.get_data()
8282
assert_true(np.all((f_data>=0) & (f_data<30)))
8383
resid_img = load_image('resid_AR_out.nii')
84-
assert_equal(resid_img.shape, funcim.shape[3:] + one_vol.shape)
84+
assert_equal(resid_img.shape, funcim.shape)
8585
assert_array_almost_equal(np.mean(resid_img.get_data()), 0, 3)
8686
e_img = load_image('T_out_effect.nii')
8787
sd_img = load_image('T_out_sd.nii')

0 commit comments

Comments
 (0)