fMRI Prep Phase-Encoding Question


I’m currently working with a relatively old dataset that has a phase encoding direction of “Right-to-Left.” When I run fMRI Prep, however, the phase encoding direction seems to be set to “Anterior-to-Posterior.”

Below is some header information of a sample nifti file from my dataset. I’ve specifically copied over the portions that contain info about the qform and sform:

qform_name Scanner Anat
qform_code 1
qto_xyz:1 0.000000 -3.000000 0.000005 96.000000
qto_xyz:2 -2.997985 0.000000 0.109936 115.213982
qto_xyz:3 0.109936 0.000005 2.997985 -52.418221
qto_xyz:4 0.000000 0.000000 0.000000 1.000000
qform_xorient Anterior-to-Posterior
qform_yorient Right-to-Left
qform_zorient Inferior-to-Superior
sform_name Unknown
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 0.000000
sform_xorient Unknown
sform_yorient Unknown
sform_zorient Unknown
file_type NIFTI-1+
file_code 1

In the corresponding task json files, I have coded the Phase Encoding Direction to be ‘j’. To my knowledge, this means that the phase encoding direction should reflect the second direction in the nifti file, which is “Right-to-Left” (i.e. qform_yorient). Is this correct? If so, why is fMRI Prep reflecting “Anterior-to-Posterior”?

What version of fMRIPrep are you using? Some previous versions did assume L/R - A/P - S/I axes for reporting the PE direction in world coordinates, but they should have still corrected according to the actual orientation/PhaseEncodingDirection. But recent versions (20.2.x and 21.0.x are still receiving maintenance) should have corrected reporting.

I’m currently using version 20.2.3.

Ah, it looks like we fixed this in 21.0.0; I thought it’d gotten into 20.2.x. We can backport that and it will be in the 20.2.7 release.

That said, the SDC should still be performed in the correct direction. Are you seeing cases where the distortion is corrected in A/P and not L/R?

@lene the fslhd output looks bizarre to me. The SForm is not set and the QForm suggests an axial scan where the columns are AP and the rows are RL. All the scanner sequences I have seen from all manufacturers will save axial data with the columns being RL and the rows being AP. Further, dcm2niix always populates both the SForm and the QForm (virtually all MR acquisitions are rectangular, but only the SForm can store the shears sometimes seen for CT scans). I would make sure these scans show the correct orientation in a viewer that respects the QForm (e.g. MRIcroGL or FSLeyes) and proceed with caution.

@effigies Thanks. So should I install the 20.2.7 version instead (or the 21.0.0 version)?

Unfortunately, I’m not entirely sure how to check which direction the susceptibility distortion correction has been performed in. Would I look at the *-desc-sdc_bold.svg file?

@Chris_Rorden The nifti files I have were created using a in-house image reconstruction sequence, so I did not have access to its dicoms or use dcm2niix.

Just to confirm, do you mean I should use a viewer to confirm that the phase encoding direction is correct? So far, I had a colleague confirm that the N/2 ghost for the functional image reflects that the phase encoding direction is Right-to-Left. Should we look for anything else?

I would make sure the qform spatial transform is correct, e.g. that MRIcroGL and FSLeyes show the left side of the brain on the left side of world space.