fMRIprep MNI affine is off

Question: Why do the affines (excluding resolution) of fMRIprep outputs not exactly match the MNI template?

Hi all,

I have a question that hopefully is fairly straightforward for someone out there. When using fMRIprep with --output-spaces MNI152NLin2009cAsym, I expect the resulting image to be in the exact same space as the MNI template. However, this is not the case. I have noticed across multiple datasets and versions of fMRIprep that the resulting affine of the desc-preproc_bold is off by .5 along all dimensions.

For example, here is the affine of a preprocessed BOLD image in MNI152NLin2009cAsym space:

array([[   3. ,    0. ,    0. ,  -96.5],
       [   0. ,    3. ,    0. , -132.5],
       [   0. ,    0. ,    3. ,  -78.5],
       [   0. ,    0. ,    0. ,    1. ]])

while here is the affine of the MNI reference image (directly from templateflow):

array([[   1.,    0.,    0.,  -96.],
       [   0.,    1.,    0., -132.],
       [   0.,    0.,    1.,  -78.],
       [   0.,    0.,    0.,    1.]]) 

Why is there a .5 difference along the last dimension of the affine? Resolution aside, I would expect these values to be exactly the same, such that I can use the MNI in the analysis of my preprocessed bold without any additional registration or resampling.

I have looked through the fMRIprep and here as well, but have not seen anything specific. If someone knows the reason for this apparent "mis"alignment I would I appreciate it!

-Gus

If you use --output-spaces MNI152NLin2009cAsym:res-1, you’ll get what you want. The 0.5mm shift comes from the 2mm (res-2) image in TemplateFlow. I don’t know why that one does not contain the same offsets as res-1. @oesteban may remember the source of these files.

thanks @effigies! That clears up the practical reason in this case. If anyone else knows more about the bigger picture of why this shift exists at all I would still be curious.

Also, for reference I did see this in a dataset where I did not explicitly use the res-2 option, but also did not specify res-1 explicitly. Would I expect the .5 shift to go away if I reran with res-1 explicitly set?