Title: engine.wrap Ops by gselzer · Pull Request #283 · scijava/scijava · GitHub
Open Graph Title: engine.wrap Ops by gselzer · Pull Request #283 · scijava/scijava
X Title: engine.wrap Ops by gselzer · Pull Request #283 · scijava/scijava
Description: 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 Computers without that annoying copy at the end??
Background
Suppose you want to convert a Computer into a Computer. Currently, you need (at a minimum):
An engine.convert Op that transforms your A object into an I object.
An engine.convert Op that transforms your B object into an O object.
An engine.copy Op that puts the data from an O object into your B object or an engine.convert Op that transforms your O object into a B object and an engine.copy Op to put the data from the intermediary B 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 the Computer backing your Computer Op is called, the changes will be written through into the original B object, and the later engine.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, all engine.wrap Ops should be aliased engine.convert (and likely also convert.X).
When performing conversion, the Op conversion MatchingRoutine will watch for the usage of engine.wrap Ops. If used for a preallocated output, the matching routine will avoid matching the output engine.convert/engine.copy Ops.
In practice, this is a very simple change, as it is equivalent to the existing behavior that watches out for the engine.identity Op
TODO:
The proof of correctness here will be with inter-ComplexType image conversion, and as of right now the tests fail 😦. These tests must be fixed.
Clean up PR (commits + code)
Additional tests?
Bump SciJava Ops Engine minor version, signifying new behavior.
Open Graph Description: 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...
X Description: 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...
Opengraph URL: https://github.com/scijava/scijava/pull/283
X: @github
Domain: github.com
route-pattern /:user_id/:repository/pull/:id/files(.:format) route-controller pull_requests route-action files fetch-nonce v2:84257e3b-a673-17eb-67e1-6767b3274753 current-catalog-service-hash ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b request-id 8908:BAB60:2F22E92:3DF1625:696B8343 html-safe-nonce 81e8e64d937f8e350f43570c7b3bdd76f06371c1f47187d76445e32a6ebb658c visitor-payload eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4OTA4OkJBQjYwOjJGMjJFOTI6M0RGMTYyNTo2OTZCODM0MyIsInZpc2l0b3JfaWQiOiIyNjI0Mjg1ODMyMDY2NTk3Njk5IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= visitor-hmac dcfef33035e50666fa85850380ff10c7fd17bcfc6ae491670ef3df6d3c8169bb hovercard-subject-tag pull_request:2327517605 github-keyboard-shortcuts repository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot google-site-verification Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I octolytics-url https://collector.github.com/github/collect analytics-location / fb:app_id 1401488693436528 apple-itunes-app app-id=1477376905, app-argument=https://github.com/scijava/scijava/pull/283/files twitter:image https://avatars.githubusercontent.com/u/29754838?s=400&v=4 twitter:card summary_large_image og:image https://avatars.githubusercontent.com/u/29754838?s=400&v=4 og:image:alt 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... og:site_name GitHub og:type object hostname github.com expected-hostname github.com None 5f99f7c1d70f01da5b93e5ca90303359738944d8ab470e396496262c66e60b8d turbo-cache-control no-preview diff-view unified go-import github.com/scijava/scijava git https://github.com/scijava/scijava.git octolytics-dimension-user_id 1262770 octolytics-dimension-user_login scijava octolytics-dimension-repository_id 85618439 octolytics-dimension-repository_nwo scijava/scijava octolytics-dimension-repository_public true octolytics-dimension-repository_is_fork false octolytics-dimension-repository_network_root_id 85618439 octolytics-dimension-repository_network_root_nwo scijava/scijava turbo-body-classes logged-out env-production page-responsive full-width disable-turbo true browser-stats-url https://api.github.com/_private/browser/stats browser-errors-url https://api.github.com/_private/browser/errors release 82560a55c6b2054555076f46e683151ee28a19bc ui-target full theme-color #1e2327 color-scheme light dark
Links:
Viewport: width=device-width