nipreps / fmriprep

fMRIPrep is a robust and easy-to-use pipeline for preprocessing of diverse fMRI data. The transparent workflow dispenses of manual intervention, thereby ensuring the reproducibility of the results.
https://fmriprep.org
Apache License 2.0
638 stars 295 forks source link

bold2target transforms applied in incorrect order to boldref, mask, t2star map #3237

Closed madisoth closed 9 months ago

madisoth commented 9 months ago

What happened?

In a subject processed with --output-spaces MNI152NLin6Asym:res-2, the MNI-space boldref, t2star, and BOLD mask volumes appear misregistered to the MNI template, though the BOLD timeseries appear correctly registered. No errors in processing reported

What command did you use?

/opt/conda/envs/fmriprep/bin/fmriprep --output-spaces MNI152NLin6Asym:res-2 --fs-license-file /license.txt --project-goodvoxels --omp-nthreads 3 --cifti-output 91k -vv -w /wd /bids_dir /output_dir participant

What version of fMRIPrep are you running?

current Dockerhub unstable

How are you running fMRIPrep?

Singularity

Is your data BIDS valid?

Yes

Are you reusing any previously computed results?

No

Please copy and paste any relevant log output.

No response

Additional information / screenshots

from the command.txts in the work dir, it looks like xfms are being passed in the opposite of the expected order for antsApplyTransforms:

antsApplyTransforms --default-value 0 --dimensionality 3 --float 1 --input /wd/fmriprep_0_0_wf/sub_XXXXXX_wf/bold_ses_1_task_rest_run_01_echo_1_wf/bold_native_wf/bold_t2smap_wf/t2smap_node/T2starmap.nii.gz --interpolation LanczosWindowedSinc --output T2starmap_trans.nii.gz --reference-image /home/feczk001/tmadison/.cache/templateflow/tpl-MNI152NLin6Asym/tpl-MNI152NLin6Asym_res-02_T1w.nii.gz --transform /output_dir/sub-XXXXXX/ses-1/func/sub-XXXXXX_ses-1_task-rest_run-01_from-boldref_to-T1w_mode-image_desc-coreg_xfm.txt --transform /output_dir/sub-XXXXXX/ses-1/anat/sub-XXXXXX_ses-1_from-T1w_to-MNI152NLin6Asym_mode-image_xfm.h5
effigies commented 9 months ago

Just rewriting for readability:

antsApplyTransforms --default-value 0 --dimensionality 3 --float 1 \
    --input /wd/fmriprep_0_0_wf/sub_XXXXXX_wf/bold_ses_1_task_rest_run_01_echo_1_wf/bold_native_wf/bold_t2smap_wf/t2smap_node/T2starmap.nii.gz \
    --interpolation LanczosWindowedSinc --output T2starmap_trans.nii.gz \
    --reference-image /home/feczk001/tmadison/.cache/templateflow/tpl-MNI152NLin6Asym/tpl-MNI152NLin6Asym_res-02_T1w.nii.gz \
    --transform /output_dir/sub-XXXXXX/ses-1/func/sub-XXXXXX_ses-1_task-rest_run-01_from-boldref_to-T1w_mode-image_desc-coreg_xfm.txt \
    --transform /output_dir/sub-XXXXXX/ses-1/anat/sub-XXXXXX_ses-1_from-T1w_to-MNI152NLin6Asym_mode-image_xfm.h5
tsalo commented 9 months ago

So it seems like the problem is specifically with the order of transforms in boldref2target in init_ds_volumes_wf, right?

effigies commented 9 months ago

Ah, okay. Yes, the problem is that nitransforms builds a list of transforms while antsApplyTransforms builds a stack, so we can't pass the same sequence to our own resampler versus antsApplyTransforms.