Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem applying h5-files from fmriprep outputs for reproduction of normalization #137

Open
m-petersen opened this issue Dec 7, 2021 · 6 comments
Labels
bug Something isn't working

Comments

@m-petersen
Copy link

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

@m-petersen
Copy link
Author

Version is 21.0.0

@oesteban
Copy link
Collaborator

Hi @m-petersen, have you tried the corresponding conversion with antsApplyTransforms?

@oesteban oesteban added the bug Something isn't working label Feb 16, 2022
@m-petersen
Copy link
Author

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.

@oesteban
Copy link
Collaborator

Thanks much. Would you be able to share some data so that we can replicate the issue?

@m-petersen
Copy link
Author

I have sent you an email with a link to a shared drive with the according files to phd(at)oscaresteban(dot)es.

oesteban added a commit that referenced this issue Mar 15, 2022
Offset can take negative values and does not need to be integer. Both
assumptions were broken in the reader.

Related: #137.
@arovai
Copy link

arovai commented Apr 8, 2024

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants