Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR, based on a branch that was designed simply to streamline the conversion of
RandomAccessibleIntervals
via wrapping, has been taken over to add a new feature to Op conversion. Namely:Can we convert
Computer
s without that annoying copy at the end??Background
Suppose you want to convert a
Computer<I, O>
into aComputer<A, B>
. Currently, you need (at a minimum):engine.convert
Op that transforms yourA
object into anI
object.engine.convert
Op that transforms yourB
object into anO
object.engine.copy
Op that puts the data from anO
object into yourB
object or anengine.convert
Op that transforms yourO
object into aB
object and anengine.copy
Op to put the data from the intermediaryB
object into the one you gave it.In many cases, however, those
engine.convert
Ops will be most performant when wrapping the object. If that wrapper is read/write (as is the case for ndarray ->RAI
wrapping via imglyb, for example), when theComputer<I, O>
backing yourComputer<A, B>
Op is called, the changes will be written through into the originalB
object, and the laterengine.convert
/engine.copy
is unnecessary work.A new Op name:
engine.wrap
engine.wrap
Ops are object conversions via a read/write wrapper. While not enforced, allengine.wrap
Ops should be aliasedengine.convert
(and likely alsoconvert.X
).When performing conversion, the Op conversion
MatchingRoutine
will watch for the usage ofengine.wrap
Ops. If used for a preallocated output, the matching routine will avoid matching the outputengine.convert
/engine.copy
Ops.engine.identity
OpTODO:
ComplexType
image conversion, and as of right now the tests fail 😦. These tests must be fixed.