From 61de1fb7ad001e2c3ae5b4d4b90b0c19d86568cb Mon Sep 17 00:00:00 2001 From: Elizabeth DuPre Date: Mon, 20 Aug 2018 16:32:01 -0400 Subject: [PATCH] Explicitly strip extensions --- tedana/tests/test_utils.py | 4 ++-- tedana/utils/utils.py | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/tedana/tests/test_utils.py b/tedana/tests/test_utils.py index 27174527b..d4e64bee2 100644 --- a/tedana/tests/test_utils.py +++ b/tedana/tests/test_utils.py @@ -123,8 +123,8 @@ def test_load_data(): # list of filepath to images d, ref = utils.load_data(fnames, n_echos=len(tes)) assert d.shape == exp_shape - assert isinstance(ref, str) - assert ref == fnames[0] + assert isinstance(ref, nib.Nifti1Image) + assert np.allclose(ref.get_data(), nib.load(fnames[0]).get_data()) # list of img_like d, ref = utils.load_data(fimg, n_echos=len(tes)) diff --git a/tedana/utils/utils.py b/tedana/utils/utils.py index 11c695174..90303b67a 100644 --- a/tedana/utils/utils.py +++ b/tedana/utils/utils.py @@ -133,7 +133,9 @@ def load_data(data, n_echos=None): '{}'.format(data)) else: # individual echo files were provided (surface or volumetric) fdata = np.stack([load_image(f) for f in data], axis=1) - return np.atleast_3d(fdata), data[0] + ref_img = check_niimg(data[0]) + ref_img.header.extensions = [] + return np.atleast_3d(fdata), ref_img img = check_niimg(data) (nx, ny), nz = img.shape[:2], img.shape[2] // n_echos