Different shape, affine between fmriprep processed BOLD image and icbm152 gm mask pulled from nilearn dataset

Dear Neurostar expertise,

Hi, I’m kind of new to fmri analyses and running fmri 1st level analyses, I want to look at the signal only from gray matter, so I pulled a icbm152_gm_mask in nilearn dataset, but I found the shape and affine are different with my fmriprep processed BOLD images.

nilearn code: gm_mask=fetch_icbm152_brain_gm_mask()
GM mask affine:

 [[   1.    0.    0.  -98.]
 [   0.    1.    0. -134.]
 [   0.    0.    1.  -72.]
 [   0.    0.    0.    1.]]

GM mask shape:
(197, 233, 189)

The fmriprep processed BOLD image shape and affine:
Resolution (x, y, z): (2.0, 2.0, 2.0, 0.8)
GM mask affine:

 [[   2.    0.    0.  -76.]
 [   0.    2.    0. -112.]
 [   0.    0.    2.  -76.]
 [   0.    0.    0.    1.]]

GM mask shape:
(77, 95, 82, 399)

I’m using fMRIPrep-23.2.1, code is as follows:

start=69
end=69
for i in $(seq -f "%03g" $start $end)
do
# List of subjects
#subjects=("008" "021")

#for i in "${subjects[@]}"
#do
 echo "Processing participant sub-$i"
 docker run --rm \
-v "$data_dir":/data:ro \
-v "$license_file":/opt/freesurfer/license.txt \
-v "$output_dir":/out \
-v "$work_dir":/work \
nipreps/fmriprep:23.2.1 \
/data /out participant \
--participant-label $i \
--task-id rest \
--work-dir /work
done

I’m confused that fmriprep supposed to normazlied the BOLD image to MNI space, why the shape and afine would be different?
I currently resample the icbm152_gm_mask to the BOLD resolution and keep the gm mask in BOLD’s shape and affine, Is there any better/usual way to constrict the activation in GM? Any comment would be really really really appreciated, thanks a lotttt! @Steven @effigies @ChrisGorgolewski

Hi @Isabella,

MNI templates can be in various resolutions. In this case, it looks like the nilearn one is in 1mm isotropic voxels. Without specifying the res-X in your fmriprep --output-spaces argument, fmriprep will put your output images in same resolution as input images.

I wouldn’t worry about it. I believe nilearn should downsample the mask to the resolution of your data, so long as they are both MNI aligned, the mask should work.

Best,
Steven

Thank you very much for your reply! it helps! like you said, fmriprep did output BOLD images in same resolution as input images, my original BOLD resolution is 2mm, and the original BOLD shape is (104,104,72), after fmriprep it became (77,95,82), If I pull the MNI152 brain mask in resolution=2, the shape is (99, 117, 95).
I’m confused and wonder what fmriprep did is correct since BOLD images are supposed to align to the MNI space, then why would they have different shape?..
2. Now gm mask and my BOLD proprocessed images have different shape, I think except for resampling, we also need to keep the shape consistent?

Hi @Isabella,

Have you visualized the mask overlaid the bold image? Do they align well? If so, I don’t think you have anything to worry about.

Best,
Steven