-
Notifications
You must be signed in to change notification settings - Fork 164
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
to_nibabel and from_nibabel missing from version 0.5.3 api #693
Comments
I'm not sure why but it looks like the file ants/utils/convert_nibabel.py was renamed to ants/utils/nifti_to_ants.py in #637 The new function is nifti_to_ants(img) |
The old functions used to explicitly use nibabel
|
I see, thanks! Is there a replacement for the other direction as well? (i.e., ants_to_nifti) |
I'm not sure why that wasn't added, perhaps to remove a dependency on nibabel? Looking at the code, it didn't actually do anything except write the nifti file to disk, then call nibabel.load. |
This change crashes our downstream. And the replaced function does not work. The function uses get_data() and has been deprecated since version 3 (current version 5) and crashes. It should be The other way around could also be implemented without saving a temporary file.
|
Thanks for the suggestion of It seems we've had some problems with orientations during nibabel conversions, eg #64, #52. @ncullen93 @stnava what do you think of the proposed solution above? To test we would need to have nibabel as a dependency. |
Oh, you probably use the SimpleITK definition of affines. Then the above code is not yet functioning. As you already figured out in the other issues, you must mirror the first two directions. |
Yeah, now I am remembering how complicated this is. The other limitation is that software conventions differ on whether to use the sform or qform transform. It looks like nibabel's algorithm uses the sform if the sform_code is > 0. ITK will only use the sform if it describes a rigid transform. You should be good to go if the sform is rigid and the sform_code == 1. But it may diverge from nibabel's behavior in other circumstances. |
Yes, it was removed because it was just calling nibabel in a very simple way and we really shouldn't have nibabel as a dependency. The proposed solution looks OK to me though. |
I don't use nibabel directly so would need some help crafting a solution that works across different image orientations. Happy to review PRs |
Describe the bug
The functions
ants.to_nibabel(ants_img)
andants.from_nibabel(nib_img)
appear to be missing from the 0.5.3 release. Have they been removed intentionally?To reproduce
With antspyx==0.5.3:
ants.from_nibabel?
now returns
Object `ants.from_nibabel` not found.
The same behavior is observed for
ants.to_nibabel?
Expected behavior
Screenshots
ANTsPy installation (please complete the following information):
Additional context
Add any other context about the problem here. Many issues are specific to particular data
so please include example data if possible.
The text was updated successfully, but these errors were encountered: