tueimage / gryds

A Python package for geometric transformations of images for data augmentation in deep learning
https://tue-image.nl
GNU General Public License v3.0
63 stars 14 forks source link

How to get inverse grid #6

Open DominiqueThiem opened 2 years ago

DominiqueThiem commented 2 years ago

Hi, Thanks for sharing this excellent work! I'm trying to generate corresponding flat and warped images with forward transformation grid. Are there any way to get backward grid that recovering generated warped images to origin flat image?

keppenhof commented 2 years ago

Thanks you Dominique!

Currently, inverse transformations are not available out of the box, but for AffineTransformation and TranslationTransformation you can invert them yourself (take the inverse of the affine matrix or mirror the translation) and create a new grid.

For BSplineTransformation, getting the inverse transform of a forward transform is not a trivial problem. If you really need a free-form similar to B-spline transformations to be invertible, have a look at diffeomorphic transformations, which are invertible by definition.