From d79710398f416228083c29ce1b0becee9877c00f Mon Sep 17 00:00:00 2001 From: Mainak Jas Date: Mon, 22 Jul 2019 21:21:57 -0400 Subject: [PATCH] FIX address Stefan's comments --- mne_bids/write.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/mne_bids/write.py b/mne_bids/write.py index f6b3cb04e..22d451407 100644 --- a/mne_bids/write.py +++ b/mne_bids/write.py @@ -1019,7 +1019,9 @@ def write_anat(bids_root, subject, t1w, session=None, acquisition=None, t1w = nib.Nifti1Image(t1w.dataobj, t1w.affine) # XYZT_UNITS = NIFT_UNITS_MM (10 in binary or 2 in decimal) # seems to be the default for Nifti files - t1w.header['xyzt_units'] = np.array(10, dtype='uint8') + # https://nifti.nimh.nih.gov/nifti-1/documentation/nifti1fields/nifti1fields_pages/xyzt_units.html + if t1w.header['xyzt_units'] == 0: + t1w.header['xyzt_units'] = np.array(10, dtype='uint8') # Now give the NIfTI file a BIDS name and write it to the BIDS location t1w_basename = make_bids_basename(subject=subject, session=session, acquisition=acquisition, prefix=anat_dir,