How to keep BOLD signal in the eyes for bidsmreye when preprocessing with fmriprep?

Summary of what happened:

When preprocessing with fmriprep, the output BOLD images are masked and eyes signal is then removed but we need it to run bidsmreye. How to do it properly? Should we provide a custom mask or is it possible to not mask the BOLD?

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

apptainer run --cleanenv -B ... -B ..../outputs/workdir/fmriprep_test -B .../fs_license.txt fmriprep_25.2.5.simg .../bids_test .../bids_test/derivatives/fmriprep_25.2.5 participant --work-dir .../workdir/fmriprep_test --notrack --write-graph --fs-license-file ..../fs_license.txt --return-all-components

Version:

fMRIPpep: 25.2.5

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

apptainer (custom .sif image build from docker)

@effigies

Am I dreaming or was there a way to pass some mask when running fmriprep to avoid masking some regions (like the eyes in in this case)?

@BastienCagna

in any case that’s a documentation error in the bidsmreye doc that should explain what input pipeline to use more specifcally

1 Like

Hi @BastienCagna !
I think this masking with fmriprep is specifically due to the processing of the multi-echo data into an ā€œoptimial combinationā€ timeserie . I don’t see this masking of fmriprep preprocessed image when dealing with single echo data. I will see what would be the correct workoutaround.

3 Likes

Well maybe the ā€œeasiestā€ way would be to use the first echo, should you save it with the --me-output-echos argument and move it to the T1w space with antsApplyTransforms and the sub-SUB_ses-SES_task-TASK_run-RUN_from-boldref_to-T1w_mode-image_desc-coreg_xfm.txt transform.
DeepMReye needs to have the functional image coregistered with the T1w image.

Something like this should work:

base=/scratch/jsein/BIDS/FrenchMinds
flirt \ 
-in $base/derivatives/fmriprep_S01/sub-MAR01R/ses-S01/anat/sub-MAR01R_ses-S01_desc-preproc_T1w.nii.gz \ 
-ref $base/derivatives/fmriprep_S01/sub-MAR01R/ses-S01/anat/sub-MAR01R_ses-S01_desc-preproc_T1w.nii.gz \  
-out $base/derivatives/fmriprep_S01/sub-MAR01R/ses-S01/anat/sub-MAR01R_ses-S01_desc-preproc_rec-2p5mm_T1w.nii.gz \ 
 -applyisoxfm 2.5 -usesqform


antsApplyTransforms  -e 3 \ 
 -i $base/derivatives/fmriprep_S01/sub-MAR01R/ses-S01/func/sub-MAR01R_ses-S01_task-BBB_echo-1_part-mag_desc-preproc_bold.nii.gz \ 
 -r $base/derivatives/fmriprep_S01/sub-MAR01R/ses-S01/anat/sub-MAR01R_ses-S01_desc-preproc_rec-2p5mm_T1w.nii.gz \
 -o $base/derivatives/fmriprep_S01/sub-MAR01R/ses-S01/func/sub-MAR01R_ses-S01_task-BBB_echo-1_space-T1w_part-mag_desc-preproc_bold.nii.gz \
 -t $base/derivatives/fmriprep_S01/sub-MAR01R/ses-S01/func/sub-MAR01R_ses-S01_task-BBB_from-boldref_to-T1w_mode-image_desc-coreg_xfm.txt \ 
 -v 1

The next question would to know which image should work best for deepmreye: echo-1, echo-2 ou echo-3?

Thank you all for your responses. We were able to test the proposed solution.

By using the --me-output-echos flag in fMRIPrep and then registering the outputs to the T1w space, we were able to run bidsmreye successfully. However, the subsequent registration to MNI space does not seem to be correct, as we obtain an incorrect final result for our two sessions. For this test, we used all three echoes in T1w space. Do you have any recommendations regarding which echo should be preferred? Our initial thought was to use the first echo because it appears to have a higher signal. How does bidsmereye manage them ?

We also have another question regarding the distinction between the training and testing sets in bidsmreye. For each session, we would like to use some of our BOLD runs (specifically our task-DME runs) as the training set, while using the remaining tasks as the testing set. Is this type of split possible within bidsmreye, and if so, what would be the recommended way to implement it?

Thus, we thought maybe it could probably be easier to directly use DeepMReye for our study. We will try to work on it again next week.

Hi @MeloSuspize , welcome to Neurostars!

My initial thought to stay in the T1w space may be not great, the most straightforward way with bidsmreye would be to normalize directly the individual echo to the MNI space with fmriprep by concatenating the 2 transforms:

antsApplyTransforms -e 3 \
-i $base/derivatives/fmriprep_S01/sub-MAR01R/ses-S01/func/sub-MAR01R_ses-S01_task-BBB_echo-1_part-mag_desc-preproc_bold.nii.gz \
-r $base/derivatives/fmriprep_S01/sub-MAR01R/ses-S01/anat/sub-MAR01R_ses-S01_desc-preproc_rec-2p5mm_T1w.nii.gz \
-o $base/derivatives/fmriprep_S01/sub-MAR01R/ses-S01/func/sub-MAR01R_ses-S01_task-BBB_echo-1_space-MNI152NLin2009cAsym_part-mag_desc-preproc_bold.nii.gz \
-t $base/derivatives/fmriprep_S01/sub-MAR01R/ses-S01/func/sub-MAR01R_ses-S01_task-BBB_from-boldref_to-T1w_mode-image_desc-coreg_xfm.txt \
-t $base/derivatives/fmriprep_S01/sub-MAR01R/ses-S01/anat/sub-MAR01R_ses-S01_from-T1w_to-MNI152NLin2009cAsym_mode-image_xfm.h5 \
-v 1

From what I understand, the new models need to be created with DeepMReye:

If you train deepMReye, or if you have eye-tracking training labels and the extracted eyeball voxels, consider sharing it to contribute to the pretrained model pool.