ANTsX / ANTsPy

A fast medical imaging analysis library in Python with algorithms for registration, segmentation, and more.
https://antspyx.readthedocs.io
Apache License 2.0
629 stars 161 forks source link

allow decrop_image to be chained #571

Closed ncullen93 closed 6 months ago

ncullen93 commented 6 months ago

The decrop_image function was not able to be called in a chaining manner as all other image-related functions (including crop_image) can be. This PR fixes that without breaking any existing code.

The function still works exactly the same, but can now be optionally called directly from an image like this:

mni = ants.image_read(ants.get_ants_data('mni'))
mni_crop = mni.crop_image()
mni_decrop = mni_crop.decrop_image(mni) # this didnt work previously
# traditional way still works:
mni_decrop = ants.decrop_image(mni_crop, mni)