Hello, I am seeing a possible version-dependent BOLD-to-T1 misalignment issue.
Using the same input data, fMRIPrep 23.0.0rc0 produces correct functional-to-anatomical alignment, but 24.1.1 and 25.2.5 show visible misalignment for some runs.
Screenshots from 24.1.1 are shown below (25.2.5 gives similar results, but is not shown here)
the problematic runs have original orientation = LPI in the newer versions (24.1.1 and 25.2.5)
runs from the same subject/session with original orientation = LPS align correctly in all three versions I tested
in my input files, qform is invalid and sform is valid, so these are effectively sform-only inputs
fMRIPrep reports that it copies qform from sform
importantly, the raw functional image is reasonably aligned with the anatomical image in world coordinates before running fMRIPrep, so the input header does not appear to be grossly incorrect
Because the exact same inputs work in 23.0.0rc0 but not in 24.1.1 / 25.2.5, is there anything you would recommend I check or try on my side to make this work in the newer versions?
Command used (and if a helper script was used, a link to the helper script or the command generated):
Thank you for sharing all those investigations.
Looking at the first screenshot, the contrast of the T1w image in the underlay is very low, is it normal?
What you could do is to check in the temporary files of the fmriprep runs to see at which point one process fails to perform correctly. For instance, it happened to me that the bold mask failed, which made the N4 bias correction of the reference bold image fail and in fine, the bold-to-anat registration failed.
You could also try another option for the bold-to-anat registration: `–bold2anat-init header` (by default it is `auto`).
Hi @jsein, thank you so much for your reply! So far, I have tried the following options: --ignore fieldmaps, --bold2anat-init header, turning off --force-bbr, and running fslreorient2std on bold and fmap images before passing them to fmriprep. Unfortunately, none of these worked.
I also checked the temporary files, and it seems that every step before writing the BOLD-to-T1w transformation matrix looks fine. So at this point, it seems like the issue may occur when the transform is being applied. To test this, I ran the exact same command to apply the transformation matrix to the BOLD mask, and that output looked correct to me. In other words, the input image, transformation matrix, and reference image were all the same. However, when I apply it to the image itself, I get the correct output, while both fMRIPrep 25 and 24 produce the wrong result. cmdline : antsApplyTransforms --default-value 0 --float 0 --input /out/sub-165/func/sub-165_task-AssocMemStudy_dir-PA_run-03_desc-brain_mask.nii.gz --interpolation MultiLabel --output sub-165_task-AssocMemStudy_dir-PA_run-03_desc-brain_mask_trans.nii.gz --reference-image /work/fmriprep_24_1_wf/sub_165_wf/bold_task_AssocMemStudy_run_03_dir_PA_wf/bold_anat_wf/gen_ref/sub-165_desc-preproc_T1w_reference.nii.gz --transform /out/sub-165/func/sub-165_task-AssocMemStudy_dir-PA_run-03_from-boldref_to-T1w_mode-image_desc-coreg_xfm.txt. Would you happen to have any thoughts on what might be causing this?
One more thing I wanted to highlight is that our data somehow has mixed orientations within subjects, and the func-to-anat misalignment only occurs for one of those orientations. For example, in three subjects, some functional runs are in LPS orientation, while others are in LPI orientation. The failed func-to-anat alignment occurs only for the LPI-oriented runs; the LPS runs are fine. This pattern is consistent across all three subjects, so there definitely seems to be a systematic issue. Importantly, these same LPI-oriented runs fail in fMRIPrep 24/25 but succeed in fMRIPrep 23.
Interesting issue, I never encounter such a problem with fmriprep but I also never was in this case with a mix of orentations among the functional runs of one subject. I am curious why is this the case originally for you?
What you could try is to group the runs with the same orientation and run fmriprep seperately for the 2 groups to see if ,for fmriprep 24 and 25, you get a correct result for both cases.
Alternatively you may, for the runs with another orientation, convert them into the same orientation as the other runs to see if that solve you problem.
If you have FSL, you can use:
fslswapdim my_image_in_neurological x y -z my_image_in_radiological fslorient -forceradiological my_image_in_radiological
These two commands used together will convert a neurological image (such as your LPI image) into radiological orientation (like your LPS image).
As why it is an issue for fmriprep 24 and 25 and not 23, I don’t know yet, maybe one fmriprep developper can explain why?
Thank you for the suggestions! I’ll try it and let you know. As for the mixed orientations in our data, I’m not really sure what caused them. Since this is an older dataset, I wonder whether they could be due to differences in scanner export or dicom conversion, especially since some participants came out of the scanner for a short break and were then scanned again.