Affine Variation in fMRIPrep MNI space

Summary of what happened:

I am working on group-level models for task-based fMRI and was continually getting affine related errors, like the one below:

ValueError: Field of view of image #1 is different from reference FOV.
Reference affine:
array([[   2.5,    0. ,    0. ,  -76. ],
       [   0. ,    2.5,    0. , -112. ],
       [   0. ,    0. ,    2.5,  -75.5],
       [   0. ,    0. ,    0. ,    1. ]])
Image affine:
array([[   2.5,    0. ,    0. ,  -73.5],
       [   0. ,    2.5,    0. , -111. ],
       [   0. ,    0. ,    2.5,  -72. ],
       [   0. ,    0. ,    0. ,    1. ]])
Reference shape:
(62, 77, 66)
Image shape:
(61, 76, 64, 1)

I’ve been trying to trace this issue and realized that the MNI152NLin2009cAsym_desc-preproc_bold.nii.gz all have slightly different affines. Is this expected behavior? When I check affines for other data sets, there is some slight variation in affines – about a 100th of a decimal point, but no more. What is the best way to get all of the affines aligned? Does this need to happen before running first levels or can it be done on the stat_map .nii.gz objects. Thanks in advance!!!

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

singularity run --cleanenv --containall -B /projects/b1108:/projects/b1108 \
-B /projects/b1108/studies/transitions/data/preprocessed/neuroimaging:/base \
-B /projects/b1108/studies/transitions/scripts/2_fmriprep_and_QC:/scripts \
-B /projects/b1108/studies/transitions/data/preprocessed/neuroimaging/fmriprep_23_2_0_nofmap:/out \
-B /projects/b1108/studies/transitions/data/raw/neuroimaging/bids:/data \
-B /projects/b1108/templateflow:/projects/b1108/templateflow \
/projects/b1108/software/singularity_images/fmriprep_23.2.0.sif \
/data /out participant --nthreads 4 --omp-nthreads 3 --mem_mb 30000 \
--participant-label ${input_args[$SLURM_ARRAY_TASK_ID]} --bids-filter-file /scripts/bids_filter_file_ses-1.json \
--fs-license-file /projects/b1108/software/freesurfer_license/license.txt \
--fs-subjects-dir /base/freesurfer_23_2 \
--output-spaces MNI152NLin6Asym MNI152NLin2009cAsym \
-w /base/work  --ignore fieldmaps


Version:

fmriprep version 23.2.0, nilearn version

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

Singularity

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

Yes! 

Relevant log outputs (up to 20 lines):

/projects/b1108/studies/transitions/data/preprocessed/neuroimaging/fmriprep_23_2_0_nofmap/sub-t1064/ses-1/func/sub-t1064_ses-1_task-mid_run-01_space-MNI152NLin2009cAsym_desc-preproc_bold.nii.gz
[[   2.5    0.     0.   -76. ]
 [   0.     2.5    0.  -112. ]
 [   0.     0.     2.5  -75.5]
 [   0.     0.     0.     1. ]]
/projects/b1108/studies/transitions/data/preprocessed/neuroimaging/fmriprep_23_2_0_nofmap/sub-t1143/ses-1/func/sub-t1143_ses-1_task-mid_run-01_space-MNI152NLin2009cAsym_desc-preproc_bold.nii.gz
[[   2.5    0.     0.   -73.5]
 [   0.     2.5    0.  -111. ]
 [   0.     0.     2.5  -72. ]
 [   0.     0.     0.     1. ]]
/projects/b1108/studies/transitions/data/preprocessed/neuroimaging/fmriprep_23_2_0_nofmap/sub-t1012/ses-1/func/sub-t1012_ses-1_task-mid_run-02_space-MNI152NLin2009cAsym_desc-preproc_bold.nii.gz
[[   2.5           0.            0.          -76.        ]
 [   0.            2.5           0.         -112.        ]
 [   0.            0.            2.50099993  -75.49900055]
 [   0.            0.            0.            1.        ]]
/projects/b1108/studies/transitions/data/preprocessed/neuroimaging/fmriprep_23_2_0_nofmap/sub-t1012/ses-1/func/sub-t1012_ses-1_task-mid_run-01_space-MNI152NLin2009cAsym_desc-preproc_bold.nii.gz
[[   2.5           0.            0.          -76.        ]
 [   0.            2.5           0.         -112.        ]
 [   0.            0.            2.50099993  -75.49900055]
 [   0.            0.            0.            1.        ]]

Screenshots / relevant information:


No need to respond - I think I’ve answered my own question!