Nilearn: Resize nii image getting the modified affine information

Created on 17 Feb 2021  路  4Comments  路  Source: nilearn/nilearn

Hello every body!

I'm trying to resize nii images but I don't know how to modify its affine information to have the reference space information.
I've seen some ways to do that but you have to put your "target_affine" and for me it's a unknown data.

Could you help me, please?
Thank you very much in advance :)

All 4 comments

Hi @SouthAmericaB ! I just wanted to link this discussion with the ongoing one in Nibabel which has a bit more detail : https://github.com/nipy/nibabel/issues/998

It sounds like rescale_affine might be what you need since you don't have a target_affine in mind ? I don't know that Nilearn has a way to calculate this in your case, though Nibabel can.

Of course, if anyone knows of a function I'm forgetting, please don't hesitate to add it in here !

I am rarely in that situation: usually, I resample images to a space corresponding to some MNI template, such as those in SPM or FSL: those impose a certain target_affine. What is you use case ?

The use case is expanded a bit more in the linked Nibabel issue, but I think this issue can be closed as it sounds like it was (1) successfully addressed with Nibabel and (2) doesn't match a standard Nilearn use case.

In general, I'd encourage posting usage questions like this one on NeuroStars (https://neurostars.org) over this issue tracker. If you include the nilearn tag, the Nilearn developers will also be notified there, too !

Thank you all!
rescale_affine is what I need! :)

All the best @bthirion @emdupre !

Was this page helpful?
0 / 5 - 0 ratings

Related issues

NicolasGensollen picture NicolasGensollen  路  4Comments

rhodricusack picture rhodricusack  路  3Comments

kchawla-pi picture kchawla-pi  路  5Comments

NicolasGensollen picture NicolasGensollen  路  3Comments

xuesongwang picture xuesongwang  路  3Comments