Fmriprep error - no functional output folder

Summary of what happened:

I tried to preprocess using fmriprep on a cluster. I only got freesurfer output folder, but there was neither output for functional images or html. Any insight would be super helpful!!

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

SINGULARITY_CMD="singularity run --cleanenv -B /shared:/shared -B $BIDS_DIR:/data -B ${TEMPLATEFLOW_HOST_HOME}:${SINGULARITYENV_TEMPLATEFLOW_HOME} -B /scratch/$USER/fmriprep:/work -B ${LOCAL_FREESURFER_DIR}:/fsdir $CONTAINER_PATH/$CONTAINER_NAME"

cmd="${SINGULARITY_CMD} /data /data/${DERIVS_DIR} participant --participant-label $subject_name -w /work/ -vv --omp-nthreads 8 --nthreads 12 --mem_mb 30000 --output-spaces MNI152NLin2009cAsym:res-2 anat fsnative fsaverage5 --fs-subjects-dir /fsdir --skip_bids_validation "

Version:

fmriprep 23.1.4

Environment (Docker, Singularity, custom installation):

singularity 3.5.0

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

The functional and T1 passed the validator. I also added -skip-bids-validation in the command line.

Relevant log outputs (up to 20 lines):

The output is long. I only pasted the lines with “error” and the last few lines about the failure of this job.

7094: error: Numerical argument out of domain 7095: error: WARNING: 16777216 NaNs found in volume /fsdir/sub-CC110033/mri/T2.prenorm.mgz... 7170: error: Numerical argument out of domain 7171: error: MRIhistogramLabelRegion: constant image 7172: error: Numerical argument out of domain 7173: error: MRIhistogramLabelRegion: constant image 8148: error: Numerical argument out of domain 8149: error: WARNING: 16777216 NaNs found in volume /fsdir/sub-CC110033/mri/T2.prenorm.mgz... 8224: error: Numerical argument out of domain 8225: error: MRIhistogramLabelRegion: constant image 8226: error: Numerical argument out of domain 8227: error: MRIhistogramLabelRegion: constant image

Traceback: RuntimeError: subprocess exited with code 1. 231009-17:11:44,442 cli ERROR: Preprocessing did not finish successfully. Errors occurred while processing data from participants: CC110033 (1). Check the HTML reports for details. sub-CC110033 Finished tasks 1 with exit code 1

Screenshots / relevant information:

The file organization:
image

Hi @meishai,

Your fmap names are not BIDS valid.

Also, the error looks to be associated with FreeSurfer, are you using precomputed FreeSurfer files? Does the error persist when you use a fresh working directory and do not pass precomputed freesurfer files in?

Also, this error might be due to low T1 quality, and there’s not much of a way to fix that. Does every subject get this error?

Best,
Steven

Hi Steven,

Thanks! Thanks for the bids formatting comment, I will change the name of fieldmaps. For the structural data, I did not use any freesurfer precomputed files. There is only T1 raw file in the bids folder.

I took a look at the T1. I think the quality looks fine. Is it possible that I should not put T2 in the anat folder?

For the output folder under derivative, there is only freesurfer output, but not the fmriprep folder. My guess is that the error took place even before any preprocessing steps for bold images? This is also persistent across other participants too.

Thank you!
Meishan

Hi @meishai,

No, you should keep T2 in the anat folder (in fact, it improves the surface reconstruction from FreeSurfer).

The complete output log would be helpful here. Usually the fmriprep folder is made in the beginning but is only populated with outputs as they finish computing.

Looking at your image, the brain is rotated strangely, although the labels are correct (e.g., the top of the brain being on the right side in the first panel). Can you try making a copy of a subjects anatomicals and BOLD images after running fslreorient2std on them, and then run fmriprep on those?

If that fails, you might be best trying to run recon-all outside of fmriprep and then porting the premade outputs with the --fs-subjects-dir argument.

Best,
Steven

jobMA_fmriprep.39029854-2.txt (483.1 KB)
Hi Steven,

Thanks! I have uploaded the entire output log, where I got all the error messages.

For the T1 orientations, I just found that other participants have the standard orientation (see figure below), but still getting the same error. The slurm job log I attached is from another participant, whose oritentations of T1 and func were both standard.

I also assume that at least there should be an fmriprep folder being created, but there is none. I will also try changing the orientation on the first participant and keep it posted, but any help so far would be appreciated!

Meishan

Can you also share a screenshot of the T2?

This is the screenshot of the T2 scan of the same participant above!

Thank you!
Meishan

Hi @meishai,

I agree the quality looks fine, at least in what I can tell from the screenshot. I’m sorry the error is not immediately obvious to me. The error log seems to imply there are lots of NaNs in the T2. My next recommendations would be to try:

  1. Deleting any existing freesurfer data and work directories and rerun;
  2. try running freesurfer outside of fmriprep (something like recon-all -subject $subject -i $t1 -T2 $t2 -T2pial -all -qcache -hires);
  3. exclude the T2 and try running, although ideally your final version will have the T2 incorporated.

Best,
Steven

Hi Steven,

Thank you for your suggestion! I will try running recon all outside of fmriprep, although I would wish I can do everything all together in fmriprep all at once.

I removed all the working directory files, and T2, and re-ran the fmriprep. And it worked! I will look into more about the T2 issue, but so far the freesurfer output looks fine.

Thanks for the help!
Meishan