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
650 stars 164 forks source link

The inverse transform about ants.apply_transforms #696

Closed windyjunfeng closed 3 months ago

windyjunfeng commented 3 months ago

Hi, I have a question about the inverse transform when using ants.apply_transforms function. I see the ANTsPy documents. It says if the transform list is a matrix followed by a warp field, whichtoinvert defaults to (True,False). I wonder if this inverse transform only involves the affine matrix not the deformable transformation. If yes, is there any way to involve deformable transformation in the inverse transform? Thank you~

cookpa commented 3 months ago

ants.registration returns both forward and inverse transforms. For historical reasons, the warp field in invtransforms is already the inverse, but the affine is not - it's the same thing as in fwdtransforms. The affine is inverted at run time according to whichtoinvert. You generally don't need to modify whichtoinvert unless chaining transforms from multiple registrations together. For pairwise registration, just pass fwdtransforms or invtransforms as needed.

windyjunfeng commented 3 months ago

Thank you. I got it~