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
RandomAccessibleIntervalsvia wrapping, has been taken over to add a new feature to Op conversion. Namely:Can we convert
Computers 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.convertOp that transforms yourAobject into anIobject.engine.convertOp that transforms yourBobject into anOobject.engine.copyOp that puts the data from anOobject into yourBobject or anengine.convertOp that transforms yourOobject into aBobject and anengine.copyOp to put the data from the intermediaryBobject into the one you gave it.In many cases, however, those
engine.convertOps will be most performant when wrapping the object. If that wrapper is read/write (as is the case for ndarray ->RAIwrapping via imglyb, for example), when theComputer<I, O>backing yourComputer<A, B>Op is called, the changes will be written through into the originalBobject, and the laterengine.convert/engine.copyis unnecessary work.A new Op name:
engine.wrapengine.wrapOps are object conversions via a read/write wrapper. While not enforced, allengine.wrapOps should be aliasedengine.convert(and likely alsoconvert.X).When performing conversion, the Op conversion
MatchingRoutinewill watch for the usage ofengine.wrapOps. If used for a preallocated output, the matching routine will avoid matching the outputengine.convert/engine.copyOps.engine.identityOpTODO:
ComplexTypeimage conversion, and as of right now the tests fail 😦. These tests must be fixed.