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/checks(.:format) route-controller pull_requests route-action checks fetch-nonce v2:0628fb76-8bd5-a07c-4fe1-e032e26c3b1e current-catalog-service-hash 87dc3bc62d9b466312751bfd5f889726f4f1337bdff4e8be7da7c93d6c00a25a request-id 8902:C419C:2197C9:2BF57A:696B382F html-safe-nonce 82e4203357bbc6b17501b6e23f28feecc3143feb92740497423ae0a0fa5943c7 visitor-payload eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4OTAyOkM0MTlDOjIxOTdDOToyQkY1N0E6Njk2QjM4MkYiLCJ2aXNpdG9yX2lkIjoiMjI4MzE2MDkyMzYxOTkzMjIwNyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 visitor-hmac 26ca074b6d9dd668c9157b44e7bf6dd90e2b47dab7e73f4c14d146c0210619ba hovercard-subject-tag pull_request:2327517605 github-keyboard-shortcuts repository,pull-request-list,pull-request-conversation,pull-request-files-changed,checks,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/checks 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-cache 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 full-width-p-0 disable-turbo false 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