Manually adding slice timing information for nifti data

Hi all,

I have some data only in the nifti format, so in order to run fmriprep I have to create the .json file for them and manually add information into the .json file. Everything is fine except I am not 100% sure about the SliceTiming information.

I already know the data is collected in a descending order, so the slice timing will be [0, 1, …, N-1]* TR or [ N-1, N-2, …, 1, 0]* TR depending on how fMRIprep determines which slice corresponds to the first entry of my slice timing information.

According to @Chris_Rorden, the slice timing values are with respect to the order that the 2D slices are saved to disk. So the first entry in slice timings corresponds to the first slice saved to the disk, so my questions are:

(1) how I can know the order that the 2D slices are saved to disk with my nifti only data?

(2) will this order be affected by the orientation of images, for example, if images of LPS and LPI have a different first slice?

Appreciate your help so much!

I would carefully read my comments here and here. Modern versions of dcm2niix should correctly extract slice timing for most GE and Siemens scanners, so I assume your data is from a Philips system. You also suggest you are confident that the slice acquisition is sequential, not interleaved. I strongly recommend you contact the Philips scientist who is associated with your center to ensure correct details (these individuals are Research Collaboration Managers in Siemens-speak, but I believe they are 'Clinical Scientists` for Philips users).

I would use a tool like fslhd to determine the order of slices on disk. For example:

fslhd fmri.nii
sform_xorient Left-to-Right
sform_yorient Posterior-to-Anterior
sform_zorient Inferior-to-Superior

This reports how columns (x), rows (y) and slices (z) are stored on disk. In this case, the slices are stored in the order inferior to superior, so the first slice on disk is the most inferior. I have never seen dcm2niix convert data from any vendor in the Superior-to-Inferior.

Hi Chris,

Thanks so much for your response, very helpful, especially your example of using fslhd perfectly addressed my question about how I can know the order of slices on disk, sorry I was not aware of that the qform/sform x/y/z orient information was also indicating how the data was stored.

To provide more context, I was using a GE scanner but using a spiral in and out sequence instead of the EPI sequence and the data was reconstructed by our own recon script instead of GE, which did not produce DICOM data but a nifti data and a header which includes information like the acquisition order - here is descending.

When I use fslhd only qform has information, given qform should give the same information as sform in terms of the zorient so my data was saved in the order of inferior to superior, therefore my slice timing should be [ N-1, N-2, …, 1, 0]* TR given it was collected in a descending order.

qform_name Scanner Anat
qform_code 1
qto_xyz:1 -3.437500 0.000000 0.000000 114.199997
qto_xyz:2 0.000000 -3.435847 0.124036 136.100006
qto_xyz:3 0.000000 0.106593 3.998076 -34.414577
qto_xyz:4 0.000000 0.000000 0.000000 1.000000
qform_xorient Right-to-Left
qform_yorient Anterior-to-Posterior
qform_zorient Inferior-to-Superior
sform_name Scanner Anat
sform_code 0
sto_xyz:1 0.000000 0.000000 0.000000 0.000000
sto_xyz:2 0.000000 0.000000 0.000000 0.000000
sto_xyz:3 0.000000 0.000000 0.000000 0.000000
sto_xyz:4 0.000000 0.000000 0.000000 1.000000
sform_xorient Unknown
sform_yorient Unknown
sform_zorient Unknown

Thanks again!!!

Since an SForm is not present, tools should fall back to using the QForm. The QForm is fine for MRI, but be aware that the SForm is a superset of the QForm: the QForm can not store shears (e.g. CT gantry tilt).

Since this is an internal sequence and conversion tool, I would suggest doing the physical head rotation test I describe here to provide confidence in your methods.