PEPolar SDC correction biases and clips one functional run but not the other

I processed 3 separate, multiband fmri-bold runs through fMRIprep (task A: 2 runs, task B: 1 run, resting-state: 1 run).
PEPolar SDC was used. Task A shared one pair of spin-echo images, whereas task B and resting-state shared another pair.

SDC applied to Task-A, run-1 clips and biases the image, ruining the extracted mask. This also ruins coregistration with the subject-space anatomical image.

original

"corrected"

extracted mask

Task-A, run-1 and run-2 share the same spin-echo pair.
Below is an image of the estimated SDC, applied to Task-A, run-2.

Task-A run-2 Mask and original bold are unremarkable.
The SDC estimated for Task-B and resting-state are also unremarkable.

For Task-A, both runs, I confirmed good alignment between the sbref and original bold image. The "PhaseEncodingDirection" field was correctly applied. Might I ask if there are any other corrective procedures I can take?

Hi,

May I ask:

  • which FMRIPREP version you are using?
  • is your data set BIDS validated ?
  • which command did you use ?
  • Did you get any errors reported from the FMRIPREP execution?

My apologies for the lack of prior information:

  • fmriprep: version 21.0.1
  • Dataset is BIDS validated
  • full command:
singularity run --cleanenv \
    -B /home/hamilton/bids:/data:ro \
    -B //home/hamilton/derivatives/fmriprep:/out \
    /home/hamilton/Containers/fmriprep_21.0.1.sif \
    /data \
    /out \
    participant \
    --participant-label mtlpilot02 \
    --n_cpus 16 \
    --mem 16G \
    --fs-license-file ~/licenses/freesurfer/license.txt \
    -vvv \
    --output-spaces anat MNI152NLin2009cAsym \
    --notrack --resource-monitor
  • No errors were reported during fmriprep execution.

If helpful: reported orientations for all EPI images:

>>> import nibabel as nib
>>> nib.orientations.aff2axcodes(nib.load('sub-mtlpilot02_ses-1_task-A_dir-PA_run-1_bold.nii'))
('L', 'A', 'S')

"PhaseEncodingDirection": "j" is labeled as "PA"
"PhaseEncodingDirection": "j-" is labeled as "AP"

Thank you for this detailed information. Are all the functional runs with the same acquisition parameters and the volumes prescribed the same way during the acquisition? (are the affines the same for all the functional runs?)

I don’t understand your 4th figure in your initial post. How do you apply the SDC if the SDC applied by FMRIPREP for task A is wrong?

To debug this you may need to go look at the temporary files generated by the fmriprep workflow that can be saved if you pass the argument -w ( -w /out/temp for exemple) in your fmriprep command.

All Prescriptions were performed using siemens autoalign. Affine matrices for both runs of Task-A are confirmed to be the same.

>>> import nibabel as nib
>>> f1 = nib.load("sub-mtlpilot02_ses-1_task-A_dir-PA_run-1_bold.nii")
>>> f2 = nib.load("sub-mtlpilot02_ses-1_task-A_dir-PA_run-2_bold.nii")
>>> print(f1.affine)
array([[-1.99633324e+00, -1.21051826e-01,  3.89613182e-04,
         1.10305862e+02],
       [-1.18440136e-01,  1.95457220e+00,  4.06963885e-01,
        -7.69764175e+01],
       [ 2.50126272e-02, -4.06194717e-01,  1.95815730e+00,
        -4.04280357e+01],
       [ 0.00000000e+00,  0.00000000e+00,  0.00000000e+00,
         1.00000000e+00]])
>>> print(f1.affine == f1.affine)
array([[ True,  True,  True,  True],
       [ True,  True,  True,  True],
       [ True,  True,  True,  True],
       [ True,  True,  True,  True]])

Ah, my apologies, confused myself in the previous posting. I was showing the same SDC applied to Task-A, run-2, to show that the estimated SDC for task-A worked for the second run. Post is corrected to reflect this.

From the small amount of probing I have done, it seems the trouble began around inal_boldref_wf/enhance_and_skullstrip_bold_wf/map_brainmask, i.e. registering the template flow brainmask to native space,

which caused problems for N4BiasFieldCorrection

and ultimately screwed up the final mask derivation.

Thank you again for this detailed report. Would you say that the mask you show is wrong? It looks fine to me. But indeed the output of N4BiasFieldCorrection is wrong. I don’t know what to suggest other than trying to re-run again fmriprep for Task-A (after cleaning the temporary folder).

Unfortunately the there is severe warping in the inferior temporal lobes and around the poles. The frontal lobe also looks very stretched.