Adding Correct Slice Timing Information Into JSON files

Hello! After converting my dicoms to nifti, I do not have slice timing information in my json files. I do know what the slice timing was/is-supposed to be. Siemen’s style, so with even slices (e.g. 32) it would be [2:2:32, 1:2:31]. However, I do not know how to add that to the JSON file in a format that fmriPrep likes/wants.

Would I just add to the JSON file
“SliceTiming”: “[2, 4, 6, 8…32, 1, 3, 5…31]”

Or is the format something else? I understand it uses afni’s 3dtshift but still do not understand the precise way I need to be recording the format of slice timing so fmriPrep is happy and does the slice timing adjustment properly.

Thanks!

fMRIPrep accepts datasets that are in BIDS format. According to BIDS:

Key name Requirement level Data type Description
SliceTiming RECOMMENDED, but REQUIRED for sparse sequences that do not have the DelayTime field set, and Arterial Spin Labeling with MRAcquisitionType set on 2D. array of numbers The time at which each slice was acquired within each volume (frame) of the acquisition. Slice timing is not slice order – rather, it is a list of times containing the time (in seconds) of each slice acquisition in relation to the beginning of volume acquisition. The list goes through the slices along the slice axis in the slice encoding dimension (see below). Note that to ensure the proper interpretation of the SliceTiming field, it is important to check if the OPTIONAL SliceEncodingDirection exists. In particular, if SliceEncodingDirection is negative, the entries in SliceTiming are defined in reverse order with respect to the slice axis, such that the final entry in the SliceTiming list is the time of acquisition of slice 0. Without this parameter slice time correction will not be possible.

So you’ll want your times to be something like [1, 3, 5...31, 0, 2, 4...30] / TR.

1 Like

Ah, thank you very much, that is extremely helpful. I wonder if it might be [1, 3, 5…31, 0, 2, 4…30] * (TR/numslices), so if TR was 2 and numslices was 32, then that would give something like [1/16, 3/16…31/16, 0, 2/16…30/16]

In which case, I just have to do the actual calculation of that and input the array from there.
So in the JSON file one might add:

“SliceTiming”: [0.0625, 0.1875, 0.3125…1.9375, 0, 0.125 … 1.875],

Obviously filling in those … with the other relevant values.

Thanks a ton!

1 Like

What kind of scanner is this coming from, and what software (and version) did you use to convert from dcm 2 nii? If you can get your slice timing information by upgrading to the most recent dcm2niix version, for example, that may be safer than the guesswork and human error involved in entering it manually.

This was also very helpful. I don’t know why, but the initial nifti and json files that had been converted before I started work simply did not have the slice time information. On a whim, and also thanks to this comment, I ended up going back to the raw dicoms and running a newer dcm2niix (through dcm2bids). This successfully grabbed the actual slice timing information!

The output seems to match the idea of [slice order] * (TR/numslices). So if this has to be done manually, then nailing down the slice order is the limiting step.

2 Likes

Good catch! Apologies for the too-quick response.