Problems with brain masks & concat blips affine tolerance (fMRIPrep 21.0.1)

Hiya, I’m running fMRIPrep 21.0.1 on multiband, multiecho data and seeing some repeated problems in my data. Looked at Poor fMRI Prep Brain Masks and some other posts but not sure if mine is the same issue.

(1) Brain masks for the functional data are erroneously including areas of signal outside the brain (this was also an issue in subjects previously preprocessed using fMRIPrep 1.4.1).

SDC results:


(RMET run2)


(rest)

CompCor results:


(RMET run2)


(rest)

(2) The preprocessed MNI-space optimally combined image (& its mask) also includes areas outside of the brain, though not necessarily the same areas (you can see this in the first CompCor figures). The T1w brain mask looks fine.

FYI: T1w images were defaced using pydeface prior to fMRIPrep. Also prior to fMRIPrep, we set the echo-1 PA scan to be the topup for all four echos in that run. (see below, from our manual)

We are collecting short top-up scans with the opposite phase encoding direction to the main runs (PA/FH instead of AP/HF) for each task, in order to apply pepolar SDC (see API — fmriprep version documentation). To do this, we just need to let fmriprep know which top-up scans are ‘intended for’ [distortion correcting] which functional runs. Since it is not optimal for apply different transformations to different echos (see Blipup Blipdown distortion correction on multiecho data - #2 by handwerkerd), we will set the echo-1 PA scan prior to each run to be the top-up for all echos in that run. This is done by adding an ‘IntendedFor’ field to the relevant .json sidecar files for the echo-1 PA fieldmaps. E.g., for sub-060:

[in fmap/sub-060_task-faceStroop_dir-PA_run-01_echo-1_epi.json:]
“IntendedFor”: [“func/sub-060_task-faceStroop_dir-AP_run-01_echo-1_bold.nii.gz”,
“func/sub-060_task-faceStroop_dir-AP_run-02_echo-1_bold.nii.gz”,
“func/sub-060_task-faceStroop_dir-AP_run-01_echo-2_bold.nii.gz”,
“func/sub-060_task-faceStroop_dir-AP_run-02_echo-2_bold.nii.gz”,
“func/sub-060_task-faceStroop_dir-AP_run-01_echo-3_bold.nii.gz”,
“func/sub-060_task-faceStroop_dir-AP_run-02_echo-3_bold.nii.gz”,
“func/sub-060_task-faceStroop_dir-AP_run-01_echo-4_bold.nii.gz”,
“func/sub-060_task-faceStroop_dir-AP_run-02_echo-4_bold.nii.gz”],

Compressed directory with two output & reports from two representative subjects here:
sub-003 has the affine tolerance problem, sub-005 has the brain mask issues (particularly on functional runs “rest”, “RMET run1”, “RMET run2”, and “faceStroop run2”).

(I’d also love to understand what is causing these issues, just out of curiosity. I’d say the brain mask issue is happening on at least one run for a majority of subjects.)

Thanks for any help!

Another thing I’m noticing…the tCompCor ROIs in these data look motion-related, as shown in the images from my post above where the the blue outlines are primarily voxels at the border of the brain. tCompCor also often has an extremely high correlation with the global signal (>.6, up to around .8), though based on the carpet plots and FD/DVARS, the motion doesn’t look especially extreme or excessive. I was thinking this could be related to the brain mask issue, but seems to happen even for subjects/runs where the mask looks reasonable.

I’m used to seeing the tCompCor countours mainly around voxels with physiological noise, e.g. this report image on a subject from a (single band/echo) dataset:

What might be causing this?

Okay, well, unsurprisingly, using Freesurfer did help the brain mask issues. The mask for the subject shown in my initial post (first SDC results image) is better though not perfect:

Also unsurprisingly given that having using Freesurfer should reduce partial volume effects, the often extremely high correlations between tissue-specific signals and tCompCor are slightly lower… though still >=.7 or .8 on many runs.

I’m still curious as to why the preprocessed functional images often appear to be partially skull-stripped, as they shouldn’t be skull-stripped at all (afaik…?)

Thanks for posting your progress @01010011. Could you clarify what you did with FreeSurfer? Were you just using the --fs-no-reconall flag previously, and you turned that flag off?

That’s correct, I was hoping since these were normal adult brains I could get away with using --fs-no-reconall but I’m convinced enough by the three subjects I’ve looked at so far that I’ll rerun using Freesurfer on the rest.

1 Like

Separating out the affine issue from the mask issue for clarity (probably should have posted this as 2 separate questions)…

(3) A number of subjects are encountering the issue documented here: https://github.com/nipreps/sdcflows/pull/265

For now, the workaround I used was to use fslcpgeom to copy the affine of one file to the other and fmriprep v21.0.1 was able to run correctly after this modification

@effigies is there a good way to apply your fix now or just have to wait for the next release? :slight_smile: If the latter, could you confirm which files for which I copy the affine (a) from and (b) to using use fslcpgeom?

Latest fMRIPrep release (v21.0.2) fixes the concat blips errors :slight_smile: (thank you!!)
https://fmriprep.org/en/stable/changes.html#april-21-2022