Skip to content
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

Avoid recomputatation of transformation inside of DisplacementField.warp #64

Open
jankrepl opened this issue Aug 25, 2021 · 0 comments
Open

Comments

@jankrepl
Copy link
Contributor

jankrepl commented Aug 25, 2021

Whenever one calls warp the transformation needs to be computed from the displacements.

fx, fy = self.transformation

This operation requires np.meshgrid or np.indices and can be costly for big shapes. Anyway, the DisplacementField should be immutable and it should be enough to compute the transformation once.

Some ideas

  • LRU cache
  • Explicit caching e.g. (self._tx, self._ty)
  • Optionally pass it in the constructor (assuming it was computed already)

Why relevant?

The primary example is when we download both the section and the expression image. We use the same DisplacementField to warp them, however, transformation is computed twice.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant