Transforming ACPC to T1 space using QSIPrep transforms

i tried to transform the qsiprep dwi output from ACPC to T1 space with the following command:

antsApplyTransforms -d 3 -e 3 \
-i dwi/sub-00300_space-ACPC_desc-preproc_dwi.nii.gz \
-r dwi/sub-00300_space-ACPC_desc-preproc_dwi.nii.gz \
-t anat/sub-00300_from-ACPC_to-anat_mode-image_xfm.mat -o transformed.nii.gz

when i overlay transformed.nii.gz on top of the original T1w image (e.g., sub-0300_T1w.nii.gz), they dont seem to align well

am i doing it wrong?

Try with -r sub-0300_T1w.nii.gz. The image passed with -r should describe the space into which you want to resample the moving image.

I know it’s confusing because you have a 4D input image but a 3D reference image. It’s because antsApplyTransforms expects the reference image to match the dimension of the transform specified with -d, which is 3.

i did this

antsApplyTransforms -d 3 -e 3 \
-i dwi/sub-00300_space-ACPC_desc-preproc_dwi.nii.gz \
-r $BIDS_dir/sub-00300/anat/sub-00300_T1w.nii.gz \
-t anat/sub-00300_from-ACPC_to-anat_mode-image_xfm.mat -o transformed.nii.gz

but when i overlay the transformed.nii.gz (in red) on top of sub-00300_T1w.nii.gz, it still doesnt look right

@gerardyu can you check the affine of your raw BIDS T1w? Sometimes these affines aren’t compatible with ITK, so we convert them to something that is compatible but maintains the correct voxel spacing.

i’m new to this, how do i check the affine of the T1w?