ANTsPy icon indicating copy to clipboard operation
ANTsPy copied to clipboard

forward and inverse affine transforms are identical

Open rueberger opened this issue 2 years ago • 5 comments

I've noticed that:

aff = ants.registration(fix, mov, type_of_transform='Affine')

# true
aff['fwdtransforms'][0] == aff['invtransforms'][0] 

Is this intentional? Affine transforms are easy to invert of course but this behavior seems misleading

rueberger avatar Mar 11 '22 01:03 rueberger

It is intentional.

On Thu, Mar 10, 2022 at 8:13 PM Andrew Berger @.***> wrote:

I've noticed that:

aff = ants.registration(fix, mov, type_of_transform='Affine')

true

aff['fwdtransforms'][0] == aff['invtransforms'][0]

Is this intentional? Affine transforms are easy to invert of course but this behavior seems misleading

— Reply to this email directly, view it on GitHub https://github.com/ANTsX/ANTsPy/issues/340, or unsubscribe https://github.com/notifications/unsubscribe-auth/AACPE7Q76UXISIYMKUD5LBTU7KM4DANCNFSM5QOH7QEA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you are subscribed to this thread.Message ID: @.***>

--

brian

stnava avatar Mar 11 '22 01:03 stnava

Reason we did it this way originally is so that we didn’t have to keep track of forward and inverse transforms as separate files and ensure their consistency.

Trade off either way

On Thu, Mar 10, 2022 at 8:23 PM brian avants @.***> wrote:

It is intentional.

On Thu, Mar 10, 2022 at 8:13 PM Andrew Berger @.***> wrote:

I've noticed that:

aff = ants.registration(fix, mov, type_of_transform='Affine')

true

aff['fwdtransforms'][0] == aff['invtransforms'][0]

Is this intentional? Affine transforms are easy to invert of course but this behavior seems misleading

— Reply to this email directly, view it on GitHub https://github.com/ANTsX/ANTsPy/issues/340, or unsubscribe https://github.com/notifications/unsubscribe-auth/AACPE7Q76UXISIYMKUD5LBTU7KM4DANCNFSM5QOH7QEA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you are subscribed to this thread.Message ID: @.***>

--

brian

--

brian

stnava avatar Mar 11 '22 01:03 stnava

I can't say that I understand this design decision, as it is up to the user to keep track of the forward/inverse transformation files anyway, and makes proper use of apply_transforms more confusing. I realize it would be a breaking change to change this behavior, but it would allow simplification of the default behavior of the whichtoinvert kwarg of apply_transforms

I think it would be a good idea to better document this gotcha.

rueberger avatar Apr 05 '22 00:04 rueberger

Great. Since you find it confusing, you would probably be in the best position to alleviate that confusion with updated documentation.

ntustison avatar Apr 05 '22 01:04 ntustison

another aspect of this behavior that I am confused about is that for SyN registration, the fwdtransform list is ['warp.nii.gz', 'aff.mat'] - which under the described behavior which would result in a default whichtoinvert argument of [False, False]. however, the default whichtoinvert value for an affine transform is [True].

suggesting that the affine matrices returned by the two transform types are inverted relative to each other. do I have that right?

rueberger avatar May 02 '22 21:05 rueberger