siavashk / pycpd

Pure Numpy Implementation of the Coherent Point Drift Algorithm
MIT License
522 stars 118 forks source link

Invert transforms #54

Open schlegelp opened 3 years ago

schlegelp commented 3 years ago

Hi! First off: Thanks for this great library!

I'm working with data where I frequently also need to apply the inverse transform, i.e target->source instead of source->target. I was wondering if you would consider adding functionality for this? E.g. by implementing a __neg__ method for the transforms.

Best, Philipp

vinceTapioca commented 2 years ago

I mostly appreciated

gattia commented 2 years ago

sorry @schlegelp I didnt see this before. I hoped you found a solution.

For you & @vinceTapioca here is a gist on how you could do this yourself using the package as it is. Note that this method is written for rigid, but it should work just fine for affine with some tweaks (I made comments). It wont work for deformable - its less trivial to do it for deformable.

https://gist.github.com/gattia/3408708b1c3b03bd3502fd7528ad4bac

When I get the time I will use this gist to update the repository - if you have time to add the functionality, a pull request would be amazing.

thanks!