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:
- 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 theanat
directory was missing thelh.sphere.surf.gii
andrh.sphere.surf.gii
files. This was true for both a full run and an--anat-only
run. - 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 therecon-all
command for theautorecon3
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. - 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 nativelh.sphere
andrh.sphere
files in its outputsurf/
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:
- Does my troubleshooting logic and conclusion seem correct?
- Are there any other potential causes for this behavior that I might be missing?
- 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