fMRIPrep 20.2.7 silently skips sphere generation (-nosphere) for multi-T1w dataset

Summary of what happened:

Hello,

I’m encountering a strange issue with fMRIPrep where it completes but fails to generate the crucial *sphere.surf.gii files in the subject’s anat directory. This is preventing me from running any subsequent surface-based analyses, such as CIFTI resampling.

Here’s a summary of my debugging process:

  1. Initial Run: I ran fMRIPrep 20.2.7 on a subject from the dataset, which has multiple T1w and T2w images across two structural sessions. The process finished and generated an HTML report, but the anat directory was missing the lh.sphere.surf.gii and rh.sphere.surf.gii files. This was true for both a full run and an --anat-only run.
  2. Log File Investigation: I dug into the recon-all.log file located in the fMRIPrep working directory. I discovered that fMRIPrep automatically generated and executed the recon-all command for the autorecon3 stage with a long list of -no... flags, including -nosphere and -nosurfreg. This seems to be the direct cause of the missing files, as fMRIPrep explicitly told FreeSurfer to skip these steps.
  3. Manual FreeSurfer Test: To verify that the data and FreeSurfer itself were not the problem, I launched an interactive shell inside the same Singularity container. I manually ran recon-all -all on a single T1w image from the same subject. This manual run completed successfully after about 9 hours, and correctly generated the native lh.sphere and rh.sphere files in its output surf/ directory.

Based on these steps, my current hypothesis is that the issue is a bug within fMRIPrep 20.2.7’s workflow logic, specifically in how it handles datasets with multiple anatomical scans, which causes it to erroneously skip critical surface reconstruction steps.

My questions for the community are:

  1. Does my troubleshooting logic and conclusion seem correct?
  2. Are there any other potential causes for this behavior that I might be missing?
  3. Is upgrading to a newer version of fMRIPrep the most likely solution?

Thank you in advance for any insights!

Command used (and if a helper script was used, a link to the helper script or the command generated):

singularity run --cleanenv /home1/ISTBI_data/toolbox/fmriprep/fmriprep-20.2.7.simg \
    BIDS \
    OUTPUT \
    participant \
    --participant-label SUBID \
    --skip_bids_validation \
    --nprocs 20 \
    --force-bbr \
    --fs-license-file /home1/ISTBI_data/toolbox/freesurfer/license.txt \
    -w OUTPUT/tmp \
    --output-spaces MNI152NLin6Asym:res-2 fsaverage \
    --cifti-output 91k

Version: 20.2.7

Environment (Docker, Singularity / Apptainer, custom installation): Singularity

Data formatted according to a validatable standard? Please provide the output of the validator:

The dataset is from OpenNeuro, which is a standard BIDS-compliant dataset. Each subject has multiple T1w and T2w images across two structural sessions (ses-struct01, ses-struct02)

Relevant log outputs (up to 20 lines):

/opt/freesurfer/bin/recon-all
-autorecon3 -openmp 8 -subjid sub-MSC01 -sd /path/to/freesurfer_dir \
-nosphere \
-nosurfreg \
-nojacobian_white \
-noavgcurv \
-nocortparc \
-nopial \
-noparcstats \
-nocortparc2 \
-noparcstats2 \
-nocortparc3 \
-noparcstats3 \
-nopctsurfcon \
-nocortribbon \
-nobalabels

Screenshots / relevant information:

Hi @FreyaWen,

I would try updating fmriprep.

Best,
Steven

Thanks for answering, @Steven
I’m trying with docker on local computer. I’ll update soon.