Anatomical-functional misalignment

Summary of what happened:

I see a consistent misalignment between the anatomical and functional images generated with fmriprep. (new to fmriprep). I updated the pipeline with some commands I added, but made no difference to the output.

Command used

#!/bin/bash
# User inputs:
bids_root_dir=$HOME/Documents/LUCA/DATA
nthreads=4
mem=25 # in GB
subj=sub-02

# Begin:
echo "Starting the script..."
chmod -R +r /home/maria/Documents/LUCA/DATA/sub-*/func/

# Convert virtual memory from GB to MB
mem=$(echo "${mem//[!0-9]/}") # Remove 'gb' at end
mem_mb=$((mem * 1000 - 5000)) # Reduce some memory for buffer space during pre-processing
echo "Memory allocated: ${mem_mb} MB"

# Set environment variables
export TEMPLATEFLOW_HOME=/home/maria/Documents/LUCA/PREPvalidation/templateflow
export FS_LICENSE=/home/maria/Documents/LUCA/DATA/license.txt
echo "FS License file path: $FS_LICENSE"

# Check if the Docker daemon is running
if ! docker info > /dev/null 2>&1; then
    echo "Docker daemon is not running. Please start Docker."
    exit 1
else
    echo "Docker daemon is running."
fi

echo "Running with Docker..."
docker run --rm -it \
   -v /home/maria/Documents/LUCA/DATA:/Luca \
   -v /media/maria/Storage-8TB/fmriprep_derivatives:/out \
   -v /media/maria/Storage-8TB/BIDSData:/work \
   -v /home/maria/Documents/LUCA/DATA/license.txt:/license.txt:ro \
   nipreps/fmriprep:24.1.1 \
   /Luca /out \
   participant \
   --bold2t1w-dof 9 \
   --bold2t1w-init register \
   --participant-label $subj \
   --skip-bids-validation \
   --fs-license-file /license.txt \
   --output-spaces MNI152NLin2009cAsym fsaverage \
   --use-aroma true \
   --use-syn-sdc \
   --force-bbr \
   --nthreads $nthreads \
   --stop-on-first-crash \
   --mem_mb $mem_mb \
   -w /work

# Check for errors
if [ $? -ne 0 ]; then
    echo "An error occurred while processing participant $subj. Exiting."
    exit 1
fi

echo "All participants processed."

Version:

fmriprep 24.1.1

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

Docker

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

BIDS validator shows no errors

Relevant log outputs (up to 20 lines):

No errors to report.

Screenshots / relevant information:

Overlay was made using freeview, I changed the functional image to a heat map and made it translucent. I couldn’t spot a problem with the html report (which I can’t post as I am a new user) but there are some overlapping issues I don’t know how to solve. I would greatly appreciate any help!



Hi @luca_Serriere , and welcome to Neurostars!

Just looking at the screenshot, it is not immediately obvious to me on how the realignment is wrong. The T1w image and BOLD images have two different contrasts (respectively T1 ans T2* contrast).
Otherwise, does this subject has a fieldmap usable by FMRIPREP to do susceptibility distorsion correction (SDC)? Do you see in the HTML report of fmriprep if SDC correction has been done and if yes, which method was used?

If the registration is really off, one parameter that you can try is:
--bold2anat-init header instead of --bold2t1w-init register.

I hope this helps!

Thank you for posting these additional screenshots, it is very informative. What is striking to me is that the contrast in both T1w and bold images is quite low. But the red GM/WM boundary seems to be well positioned on the T1w image so the segmentation seems to have been done correctly.

The BOLD image has a strange variation of intensity within the whole image, it is the case for all your subjects? From the screenshot, I don’t see a problem with the bold-to-anat alignement, the white matter mask (in red) seems to follow well the ventricules boundaries in the bold image.

Thanks @jsein for your welcome and help!

I was a little fearful of the functional image covering parts above the anatomical image, but maybe that’s not so big of a problem. I unfortunately don’t have fieldmaps for this data so fmriprep used a “fieldmap-less”, SyN-based method which ran smoothly.
With regards to the intensity variation, could you explain what I should pay attention to? I still need to run additional participants so I can try to see then if the variation persists.

The anatomical image shows the CSF above the brain in black, while it is white in BOLD images, this may have confused you.
The intensity variation in the bold image in the snapshot seems strange to me. Could you look at the native bold images, and also at the preprocessed images in the fmriprep output to see if you see such a pattern of intensity in the bold images.