nitransforms
nitransforms copied to clipboard
Problem applying h5-files from fmriprep outputs for reproduction of normalization
Dear Developers,
currently I am aiming to reproduce the normalization steps in fmriprep (e.g. _desc-preproc_T1w.nii.gz -> 1_space-MNI152NLin6Asym_desc-preproc_T1w.nii.gz) with nitransforms. The bigger goal is to check bit-identity between fmriprep outputs and manually produced normalization outputs allowing us to easily reproduce just the normalization with datalad (rerun) and hence throw away the normalized images alleviating our storage issues. Not being able to identify the exact code related to the normalization in the fmriprep and smriprep code base I was trying to achieve a normalization with the .h5-file produced by fmriprep (_from-T1w_to-MNI152NLin6Asym_mode-image_xfm.h5).
If I understand the documentation correctly loading the h5-file with nt.manip.load and applying / mapping it subsequently should do the job.
My code:
T1w = nib.load("sub-000480a3_ses-1_desc-preproc_T1w.nii.gz")
T1w_MNI_ref = nib.load("sub-000480a3_ses-1_space-MNI152NLin6Asym_desc-preproc_T1w.nii.gz")
xfm = nt.manip.load("sub-000480a3_ses-1_from-T1w_to-MNI152NLin6Asym_mode-image_xfm.h5", reference=T1w_MNI_ref, moving=T1w)
T1w_MNI = xfm.apply(T1w)
However, when visualising the resulting T1w_MNI
with T1w_MNI.orthoview()
the image is empty / black.
I was also messing around with other approaches with no avail.
Is there a suggested way to apply the transforms? I would also greatly appreciate recommendations regarding the exact reproduction of fmriprep normalizations.
Thanks a lot in advance.
Cheers, Marvin
Version is 21.0.0
Hi @m-petersen, have you tried the corresponding conversion with antsApplyTransforms
?
Hi Oscar,
thanks for your reply.
Yes, a conversion using antsApplyTransforms
as described here (https://neurostars.org/t/problem-applying-h5-files-from-fmriprep-outputs-for-reproduction-of-normalization/20959) works fine and that's what we are using now.
Thanks much. Would you be able to share some data so that we can replicate the issue?
I have sent you an email with a link to a shared drive with the according files to phd(at)oscaresteban(dot)es.
Hello! I am running nitransforms 23.0.1 and I get the same issue as OP... are there some ideas around as of why this happen and how we can solve it? Thanks!