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

add nibabel conversion (lacey import to prevent forced dependency) #698

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

robert-graf
Copy link

Adding back the convert to and from nibabel, without forcing nibabel as a dependency if never used.

There was a lot of renaming going on from 0.4 to 0.5. I would like to have the same naming scheme as in the older version for backward compatibility, but I kept it the 0.5 way as I do not know why things are renamed.

nifti_to_ants works without the image decorating. So, I also did not use the add-to-image decorator.

See:
#693 #64 #52

@cookpa
Copy link
Member

cookpa commented Aug 15, 2024

The new name is a bit confusing but I think the intent was to convey that they will convert any NIFTI image, not just nibabel. I guess the key functionality is the ability to translate an image object with an RAS transform to an ANTsImage with an LPI transform.

@cookpa
Copy link
Member

cookpa commented Aug 15, 2024

Then again, while the methodology is generic, the implementation does seem to rely on having nibabel Nifti1Image objects. So I would agree the function naming of nibabel_to_ants makes most sense.

Other packages requiring RAS coordinates could call get_ras_affine_from_ants and get the voxel data via numpy.

@robert-graf
Copy link
Author

I missed a ants_mni.to_nibabel(), which used the 0.4 version.

And then, I noticed the given nifti_to_ants were not invariant.

The get_ras_affine_from_ants form Torchio assumes that the axis is mirrored and mirrors the original as well.
The q-form does not do this; rotating the image with ants to the same orientation shows this is not invariant.

Maybe this Q-form stuff was a red herring, and that's why you had trouble writing this code.

@coveralls
Copy link

Coverage Status

coverage: 83.789% (-0.9%) from 84.726%
when pulling 7dcc27f on robert-graf:nibable_conversion
into 5f550b8 on ANTsX:master.

@robert-graf robert-graf marked this pull request as ready for review August 15, 2024 14:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants