Modifying nifti files before fMRIPrep

Hello,

I am currently working with a dataset with NIFTI files that feature the TR in milliseconds (i.e. 2000 ms). This seems to cause issues later on in my pipeline when I use FSL FEAT — FSL incorrectly reads the TR as 2000 seconds.

Is it safe to convert the timing from ms to sec using fslmaths on my NIFTI files before using fMRIPrep?

You would probably want to update the JSONs to be in seconds, without touching the NIFTI, and fMRIprep should run okay. Perhaps test on a single subject and if it works apply to everyone.

Steven

If your TR (pixdim[4]) is in milliseconds, then you need to make sure that your temporal units are msec (xyzt_units & NIFTI_UNITS_MSEC != 0) (see https://nifti.nimh.nih.gov/pub/dist/src/niftilib/nifti1.h). If that’s the case, and your RepetitionTime == 2, then fMRIPrep should handle things correctly. I think it will also update the header in the output to be in seconds (i.e., pixdim[4] == 2 && xyzt_units & NIFTI_UNITS_SEC != 0).

@effigies I ran fMRIPrep on one subject (with the repetition time as 2000, and the time unit as ms). It looks like fMRIPrep changed the time units to seconds but kept the 2000 in the pixdim[4] for all the output. I’m using fMRIPrep version 20.2.7 — should I update to another version?

@Steven Unfortunately I couldn’t find an example json online that contains an entry for a unit of time. What should I add to the json?

Thanks for all of your help so far!!

Sounds like a bug. We’ll need to update.

You can’t change the unit in the JSON. RepetitionTime needs to be in seconds, not ms.

Ok! Thanks so much. Should I continue to use the 20.2.x series and wait for a 20.2.8 update?

Yes, that will work. You can also update your headers yourself, if they cause problems in downstream processing.

Thanks!! Should I update the header of the raw nifti files before running fMRIPrep, or should I change the header of the fMRIPrep output?

Either way works. In general it would probably be cleanest to update them in your raw data, but if the idea is to avoid wasting computation, patching the results should be fine.