-
Notifications
You must be signed in to change notification settings - Fork 84
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
Optional transform return on Image methods #631
Conversation
I don't have the strongest feeling about this - but is the inverse transform the correct one to return? Or should we just be returning the transform itself? I understand the use case, but I'm wondering if it makes more sense to just give them the transform that was applied? |
After discussing with @patricksnape and @jabooth , the methods now return the actual |
As it is now - this is the order of operations:
Note that the current ordering for composition is rescale THEN crop. I think @jabooth mentioned that he liked that you could apply the transforms in order and then
To be correct then we actually do need to return the |
quite right @patricksnape, and makes complete sense on second thought that this is the case. I don't think it's worth changing back to inverse though. This design of returning simply the transform that you would use with |
Optional transform return on Image methods
This PR adds an extra
return_inverse_transform
to all the methods ofImage
,MaskedImage
andBooleanImage
that utilize aTransform
. Ifreturn_inverse_transform
isTrue
, then theself.pseudoinverse()
of theTransform
is returned along with the transformed image. This logic is basically encoded in thewarp_to_shape()
andwarp_to_mask()
methods, since all the rest (e.g.crop*
,rescale*
, etc.) return calls of those two. There are also some tests added to examine this behaviour.