imglib / imglib2-realtransform

Spatial transformations for ImgLib2
Other
7 stars 7 forks source link

Transform sequences act as the identity when empty. #25

Closed bogovicj closed 4 years ago

bogovicj commented 4 years ago

see #24

bogovicj commented 4 years ago

In response to @imagejan 's comments above, I put some work toward simplifying (Invertible)RealTransformSequences when possible. Here's the work: https://github.com/bogovicj/imglib2-realtransform/commit/5e553f7b9eb6056d76bf7f8fc5ec1125461f0c3e

What I did 1) Check if any transform that is added is the identity (with isIdentity), and don't add it if it is 2) "unpack" any sequences that are added to a sequence. 3) Check if a transform that is added can be pre-concatenated to the transform preceding it, and if so, do it

(1) and (2) make sense to me.

(3) may be taking things to far, but is nice for optimization, I think. To make (3) thread-safe, it will be necessary to add copies of transforms rather than the originals (since they could be modified).

bogovicj commented 4 years ago

With @axtimwalde , decided against having the sequence itself do the simplifying. Rather it will isIdentity will only return true if every element of the sequence isIdentity. New PR incoming...