Image contains only zeros after antsApplyTransforms

After fmriprep I tried to reproduce the *space-MNI152NLin2009cAsym_desc-preproc_bold.nii.gz file stored in the func folder using the *T1w_to-MNI152NLin2009cAsym_mode-image_xfm.h5 file.
This is the command I ran:

antsApplyTransforms -i sub-001_task-stroop_space-T1w_desc-preproc_bold.nii.gz -o bold_in_mni.nii.gz -t sub-001_from-T1w_to-MNI152NLin2009cAsym_mode-image_xfm.h5 -r MNI152NLin2009cAsym_res-02_desc-brain_T1w.nii.gz

I expected to get the same file as the one in the func folder (sub-001_task-stroop_space-MNI152NLin2009cAsym_desc-preproc_bold.nii.gz). However the output from the antsApplyTransforms (bold_in_mni.nii.gz) contains only zeros (the dimensions are correct though).

What am I missing?
Thanks!

Hi @mri,

Iā€™m getting the exact same issue (this time with a custom Nipype pipeline that includes antsApplyTransforms). Were you ever able to solve this issue?

Edit: I managed to fix my issue at least, which was solved by 1) checking the order of the transforms, and b) checking that the 0GenericAffine.mat was the correct file.

antsApplyTransforms AFAIK will not work if applied directly to 4D data (as in the OP).
Try applying the transform to the first volume only to check that this solves the issue. If it does, then you can try using fslsplit (for example) to split the volumes, apply the transforms in each volume, then concatenate them again.

2 Likes

@dangom: just to note, you can provide the -e 3 flag (or --input-image-type 3) to antsApplyTransforms and it should accept time series data, if you want to avoid having to split, transform, and concatenate your 4D data!

2 Likes