Brainmasks created incorrectly during 7T preprocessing

Hi everyone!

This is my first time preprocessing 7T data and my team is running into an issue of anatomical and ROI masks being created incorrectly (see attached screenshot). We can’t figure out how to fix this - has anyone had a similar issue?

Some relevant info: the functional data was first denoised with NORDIC denoising, so we are sourcing the files from the nordic output folder, which has all other necessary files copied in.

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

$#!/bin/bash

mkdir -p /data/pt_02771/data/derivatives/fMRIPrep/trash

subs=('sub-103')

for sub in "${subs[@]}"; do
    echo "Processing $sub"
    
    singularity run \
    	--cleanenv \
    	/data/pt_02771/software/my_images/fmriprep-24.1.1.simg \
    	/data/pt_02771/data/derivatives/nordic/ \
    	/data/pt_02771/data/derivatives/fMRIPrep_2411/ \
    	participant \
    	--participant-label $sub \
    	--task-id auditory \
    	--fs-license-file /data/pt_02771/software/license.txt \
    	--output-spaces fsnative \
    	--cifti-output 170k \
    	--fs-subjects-dir /data/pt_02771/data/derivatives/freesurfer/
    
done

###Version

We used FmriPrep version 25.0.0.simg. and have also tried version 24.1.1.simg, but the results were the same.

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

Singularity

Screenshots / relevant information:


Example masks that are being created (note the red and magenta masks):

What we have tried:

  1. Running FmriPrep with --fs-no-reconall (finishes without errors but masks are still bad)

  2. Running minimal processing first, replacing the masks with masks created with freesurfers mri_synthstrip and then continuing.
    This is the command we used for minimal preprocessing:

#!/bin/bash

subs=('sub-103')

for sub in "${subs[@]}"; do
    echo "Processing $sub"
    
    singularity run \
    	--cleanenv \
    	/data/pt_02771/software/my_images/fmriprep-25.0.0.simg \
    	/data/pt_02771/data/derivatives/nordic/ \
    	/data/pt_02771/data/derivatives/fMRIPrep/ \
    	participant \
    	--participant-label $sub \
    	--task-id auditory \
    	--fs-license-file /data/pt_02771/software/license.txt \
    	--output-spaces fsnative \
    	--cifti-output 170k \
    	--fs-subjects-dir /data/pt_02771/data/derivatives/freesurfer/ \
    	--level minimal
    
done

After this, we used a python script to create masks with mri_synthstrip function and used them to replace the ones created by fmriprep.
And this is the command for the continued pipeline:

#!/bin/bash

subs=('sub-103')

for sub in "${subs[@]}"; do
    echo "Processing $sub"
    
    singularity run \
    	--cleanenv \
    	/data/pt_02771/software/my_images/fmriprep-25.0.0.simg \
    	/data/pt_02771/data/derivatives/nordic/ \
    	/data/pt_02771/data/derivatives/fMRIPrep/ \
    	participant \
    	--participant-label $sub \
    	--task-id auditory \
    	--fs-license-file /data/pt_02771/software/license.txt \
    	--output-spaces fsnative \
    	--cifti-output 170k \
    	--fs-subjects-dir /data/pt_02771/data/derivatives/freesurfer/ \
    	--derivatives /data/pt_02771/data/derivatives/fMRIPrep/
    
done

My main questions are: is anyone familiar with this issue? What do you think the reason could be? Maybe the fact that it’s 7T, or the application of nordic denoising? Is there a way to resolve this in FmriPrep? Would you recommend trying something other than FmriPrep?

I will be super grateful for any advice you guys may have - I’m a total beginner in MRI.

All the best,
Antonia

Hi @Antonia123 and welcome to neurostars!

Have you tried fmriprep on the raw data? Are you performing susceptibility distortion correction in any way? Is this subject specific or across the whole dataset?

Best,
Steven

Hi Steven,

thanks for replying! This issue seems to be across the dataset, but I’m only using one subject for test reasons right now. So, I looked into it, and there isn’t any SDC being performed right now. I found some EPIs in the original directory in ses-03/fmap (we’re supposed to process ses-01 but I think the anatomical data is all in ses-03.) There are a lot of files there, so I’m not sure which ones should be used for SDC:

“sub-103_ses-03_acq-A_dir-PA_run-01_epi.json”*
“sub-103_ses-03_acq-A_dir-PA_run-01_epi.nii.gz”*
“sub-103_ses-03_acq-A_dir-PA_run-02_epi.json”*
“sub-103_ses-03_acq-A_dir-PA_run-02_epi.nii.gz”*
“sub-103_ses-03_acq-A_dir-PA_run-03_epi.json”*
“sub-103_ses-03_acq-A_dir-PA_run-03_epi.nii.gz”*
“sub-103_ses-03_acq-bodyMTsat_RB1COR.json”*
“sub-103_ses-03_acq-bodyMTsat_RB1COR.nii”*
“sub-103_ses-03_acq-bodyPDw_RB1COR.json”*
“sub-103_ses-03_acq-bodyPDw_RB1COR.nii”*
“sub-103_ses-03_acq-bodyT1w_RB1COR.json”*
“sub-103_ses-03_acq-bodyT1w_RB1COR.nii”*
“sub-103_ses-03_acq-headMTsat_RB1COR.json”*
“sub-103_ses-03_acq-headMTsat_RB1COR.nii”*
“sub-103_ses-03_acq-headPDw_RB1COR.json”*
“sub-103_ses-03_acq-headPDw_RB1COR.nii”*
“sub-103_ses-03_acq-headT1w_RB1COR.json”*
“sub-103_ses-03_acq-headT1w_RB1COR.nii”*
“sub-103_ses-03_echo-01_flip-01_TB1EPI.json”*
“sub-103_ses-03_echo-01_flip-01_TB1EPI.nii”*
“sub-103_ses-03_echo-01_flip-02_TB1EPI.json”*
“sub-103_ses-03_echo-01_flip-02_TB1EPI.nii”*
“sub-103_ses-03_echo-01_flip-03_TB1EPI.json”*
“sub-103_ses-03_echo-01_flip-03_TB1EPI.nii”*
“sub-103_ses-03_echo-01_flip-04_TB1EPI.json”*
“sub-103_ses-03_echo-01_flip-04_TB1EPI.nii”*
“sub-103_ses-03_echo-01_flip-05_TB1EPI.json”*
“sub-103_ses-03_echo-01_flip-05_TB1EPI.nii”*
“sub-103_ses-03_echo-01_flip-06_TB1EPI.json”*
“sub-103_ses-03_echo-01_flip-06_TB1EPI.nii”*
“sub-103_ses-03_echo-01_flip-07_TB1EPI.json”*
“sub-103_ses-03_echo-01_flip-07_TB1EPI.nii”*
“sub-103_ses-03_echo-01_flip-08_TB1EPI.json”*
“sub-103_ses-03_echo-01_flip-08_TB1EPI.nii”*
“sub-103_ses-03_echo-01_flip-09_TB1EPI.json”*
“sub-103_ses-03_echo-01_flip-09_TB1EPI.nii”*
“sub-103_ses-03_echo-01_flip-10_TB1EPI.json”*
“sub-103_ses-03_echo-01_flip-10_TB1EPI.nii”*
“sub-103_ses-03_echo-01_flip-11_TB1EPI.json”*
“sub-103_ses-03_echo-01_flip-11_TB1EPI.nii”*
“sub-103_ses-03_echo-02_flip-01_TB1EPI.json”*
“sub-103_ses-03_echo-02_flip-01_TB1EPI.nii”*
“sub-103_ses-03_echo-02_flip-02_TB1EPI.json”*
“sub-103_ses-03_echo-02_flip-02_TB1EPI.nii”*
“sub-103_ses-03_echo-02_flip-03_TB1EPI.json”*
“sub-103_ses-03_echo-02_flip-03_TB1EPI.nii”*
“sub-103_ses-03_echo-02_flip-04_TB1EPI.json”*
“sub-103_ses-03_echo-02_flip-04_TB1EPI.nii”*
“sub-103_ses-03_echo-02_flip-05_TB1EPI.json”*
“sub-103_ses-03_echo-02_flip-05_TB1EPI.nii”*
“sub-103_ses-03_echo-02_flip-06_TB1EPI.json”*
“sub-103_ses-03_echo-02_flip-06_TB1EPI.nii”*
“sub-103_ses-03_echo-02_flip-07_TB1EPI.json”*
“sub-103_ses-03_echo-02_flip-07_TB1EPI.nii”*
“sub-103_ses-03_echo-02_flip-08_TB1EPI.json”*
“sub-103_ses-03_echo-02_flip-08_TB1EPI.nii”*
“sub-103_ses-03_echo-02_flip-09_TB1EPI.json”*
“sub-103_ses-03_echo-02_flip-09_TB1EPI.nii”*
“sub-103_ses-03_echo-02_flip-10_TB1EPI.json”*
“sub-103_ses-03_echo-02_flip-10_TB1EPI.nii”*
“sub-103_ses-03_echo-02_flip-11_TB1EPI.json”*
“sub-103_ses-03_echo-02_flip-11_TB1EPI.nii”*
“sub-103_ses-03_magnitude1.json”*
“sub-103_ses-03_magnitude1.nii”*
“sub-103_ses-03_magnitude2.json”*
“sub-103_ses-03_magnitude2.nii”*
“sub-103_ses-03_phasediff.json”*
“sub-103_ses-03_phasediff.nii”*

Also, the ses-01/fmap has some files, but I think these are different types of fieldmaps:

“sub-103_ses-01_acq-tr1_TB1AFI.json”* “sub-103_ses-01_acq-tr2_TB1AFI.json”*
“sub-103_ses-01_acq-tr1_TB1AFI.nii”* “sub-103_ses-01_acq-tr2_TB1AFI.nii”*

If I want to try doing SDC, I should probably copy some of those to the nordic directory, where the files to be preprocessed are located, right?

Apologies in advance that I seem kind of confused about the kinds of files we have, this is due to the fact that I’m filling in for my PI who is on sick leave.

Regarding running preprocessing on raw data: This is probably a good idea to try, but since I think our raw directory isn’t really BIDS-compliant and it’d take some time to reformat it, I think I’d try SDC first…

In conclusion: Do you think I should try moving some of these fieldmap files to the nordic directory? Which ones do you think are the ones to use? Will fmriprep be able to use them for ses-01 if they are in ses-03?

Many thanks,
Antonia

Hi @Antonia123,

Your fieldmaps are either you epi.nii.gz/json or magnitude/phasediff images. Probably it will be your magnitude/phasediff image. I bet your PA-only epis are to correct AP-collected DWI or something like that.

Yes, and make sure the IntendedFor / B0FieldSource / B0FieldIdentifier pairings are set up.

You can create temporary bids directories that only contain the files necessary for fmriprep, but eventually yes the compliance should be addressed.

Were the fieldmaps collected in different scanning sessions from the data you are trying to process? if so that’s not good, and I would instead try something like SynBOLD-DisCo.

Best,
Steven

Hi @Steven!

Thanks so much for the suggestions - I’ll try implementing them tomorrow. About fieldmaps, I’m actually not sure if this was a different scanning session - it looks like it, but like I said I’m lacking some context for this study, so I have to guess some things. I guess I’ll try both solutions (fieldmaps and SynBOLD-DisCo) and see. I’ll report back, thanks again!

Best,
Antonia