René's URL Explorer Experiment


Title: Develop a way to make Ops usable easily from CompGraph framework · Issue #37 · scijava/scijava · GitHub

Open Graph Title: Develop a way to make Ops usable easily from CompGraph framework · Issue #37 · scijava/scijava

X Title: Develop a way to make Ops usable easily from CompGraph framework · Issue #37 · scijava/scijava

Description: Here are some interfaces we came up with that could deliver what CompGraph needs on the SciJava/ImageJ Ops side: Base interface for structured computations: public ComputationStructure { default S transform(S in) { return in1; } // e....

Open Graph Description: Here are some interfaces we came up with that could deliver what CompGraph needs on the SciJava/ImageJ Ops side: Base interface for structured computations: public ComputationStructure { default...

X Description: Here are some interfaces we came up with that could deliver what CompGraph needs on the SciJava/ImageJ Ops side: Base interface for structured computations: public ComputationStructure<S> { d...

Opengraph URL: https://github.com/scijava/scijava/issues/37

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Develop a way to make Ops usable easily from CompGraph framework","articleBody":"Here are some interfaces we came up with that could deliver what CompGraph needs on the SciJava/ImageJ Ops side:\r\n\r\n\u003cdetails\u003e\u003csummary\u003eBase interface for structured computations:\u003c/summary\u003e\r\n\r\n```java\r\npublic ComputationStructure\u003cS\u003e {\r\n\tdefault S transform(S in) { return in1; } // e.g. identity\r\n\tS requiredInput(S out, S in);\r\n}\r\n\r\npublic ComputationBiStructure\u003cS\u003e {\r\n\tdefault S transform(S in1, S in2) { return in1; } // e.g. identity\r\n\tdefault S requiredInput1(S out, S in1, S in2) { }\r\n\tdefault S requiredInput2(S out, S in1, S in2) { }\r\n}\r\n```\r\n\r\n\u003c/details\u003e\r\n\r\nSciJava/ImageJ Ops need a way to deliver objects implementing the appropriate (unary or binary) base interface. The issue is that a higher-arity op needs to lock down its \"secondary\" parameters (i.e. non-images; things that KNIME would have a user specify in the configuration dialog), to reduce arity down to unary or binary. We could have interfaces like the following to accomplish this:\r\n\r\n\u003cdetails\u003e\u003csummary\u003eStructured, BiStructured, etc.\u003c/summary\u003e\r\n\r\n```java\r\npublic final class Structured\u003cS\u003e {\r\n\tComputationStructure\u003cS\u003e structure();\r\n}\r\n\r\npublic final class BiStructured\u003cS\u003e {\r\n\tComputationBiStructure\u003cS\u003e structure();\r\n}\r\n\r\npublic final class Structured.With1Param\u003cS, P\u003e {\r\n\tComputationStructure\u003cS\u003e structure(P param);\r\n}\r\n\r\npublic final class Structured.With2Params\u003cS, P1, P2\u003e {\r\n\tComputationStructure\u003cS\u003e structure(P1 param1, P2 param2);\r\n}\r\n\r\npublic final class BiStructured.With1Param\u003cS, P\u003e {\r\n\tComputationBiStructure\u003cS\u003e structure(P param);\r\n}\r\n\r\npublic final class BiStructured.With2Params\u003cS, P1, P2\u003e {\r\n\tComputationBiStructure\u003cS\u003e structure(P1 param1, P2 param2);\r\n}\r\n```\r\n\r\n\u003c/details\u003e\r\n\r\nThen for ImageJ Ops, we need to specify the structure `S` as some metadata container. Probably something like this:\r\n\r\n```java\r\npublic class ImageInfo {\r\n\tObject elementType(); // i.e. the ImgLib2 pixel type T\r\n\tInterval interval();\r\n}\r\n```\r\n\r\nHere is an example: gaussian convolution with locked down `double[] sigmas`:\r\n\r\n\u003cdetails\u003e\u003csummary\u003eGaussianConvolveWithSigmas\u003c/summary\u003e\r\n\r\n```java\r\npublic class GaussianConvolveWithSigmas\u003cT extends RealType\u003cT\u003e\u003e implements Computers.Arity2\u003cRAI\u003cT\u003e, double[], RAI\u003cT\u003e\u003e, Structured.With1Param\u003cImageInfo, double[]\u003e {\r\n\tpublic void compute(RAI\u003cT\u003e image, double[] sigmas, RAI\u003cT\u003e output) {\r\n\t\t// ...\r\n\t}\r\n\r\n\tpublic ComputationStructure\u003cImageInfo\u003e structure(final double[] sigmas) {\r\n\t\treturn new ComputationStructure\u003cImageInfo\u003e() {\r\n\t\t\t@Override\r\n\t\t\tpublic ImageInfo transform(final ImageInfo in) {\r\n\t\t\t\t// e.g. identity\r\n\t\t\t\treturn in;\r\n\t\t\t}\r\n\t\t\t@Override\r\n\t\t\tpublic ImageInfo requiredInput(final ImageInfo out, final ImageInfo in) {\r\n\t\t\t\treturn new ImageInfo() {\r\n\t\t\t\t\t@Override\r\n\t\t\t\t\tpublic Object elementType() { return in.elementType(); }\r\n\t\t\t\t\t@Override\r\n\t\t\t\t\tpublic Interval interval() {\r\n\t\t\t\t\t\t// NB: Derive required input interval from output interval + sigmas.\r\n\t\t\t\t\t\treturn requiredInputComputedFromSigmas(out.interval(), sigmas); // Could also rely on in.interval() if needed.\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}\r\n```\r\n\r\n\u003c/details\u003e\r\n\r\nThe `double[] sigmas` state here is implicit in the new `ComputationStructure` anonymous class we define.\r\n\r\nOne question this does not answer is: how to go from an actual input object (e.g., `RandomAccessibleInterval\u003cDoubleType\u003e` to its corresponding structure (`ImageInfo`)? We could use an extensible service/plugin mechanism. Or just keep it simple and rely on the caller to take care of this somehow—in which case maybe `ImageInfo` has constructors that are helpful for this.\r\n\r\nFor now, let's assume we have method `structureOf(inputValue)\" available that returns `ImageInfo`.\r\n\r\nHere is another example that maps to a binary structured computation:\r\n\r\n\u003cdetails\u003e\u003csummary\u003eMatrix multiplication\u003c/summary\u003e\r\n\r\n```java\r\npublic class MatMultiply\u003cT extends RealType\u003cT\u003e\u003e implements Computers.Arity2\u003cRAI\u003cT\u003e, RAI\u003cT\u003e, RAI\u003cT\u003e\u003e, BiStructured\u003cImageInfo\u003e {\r\n\tpublic void compute(RAI\u003cT\u003e mat1, RAI\u003cT\u003e mat2, RAI\u003cT\u003e out) {\r\n\t\t// NB: We can validate the inputs+output structure here! Nice!\r\n\t\tcheckStructure(mat1, mat2, out);\r\n\t\tS s1 = structureOf(mat1), s2 = structureOf(mat2);\r\n\t\tS expectedStructure = structure().transform(s1, s2);\r\n\t\tif (!expectedStructure.equals(structureOf(out))) throw new IllegalArgumentException(\"Output structure not compatible with input structures.\");\r\n\t\t// OR: Better might be to do this the builder, to avoid repeated checking in loops over the same op instance with \"known good\" args.\r\n\r\n\t\t// Finally, do the algorithm here ...\r\n\t}\r\n\r\n\tpublic ComputationBiStructure\u003cImageInfo\u003e structure() {\r\n\t\treturn new ComputationBiStructure\u003cImageInfo\u003e() {\r\n\t\t\t@Override\r\n\t\t\tpublic ImageInfo transform(final ImageInfo in1, final ImageInfo in2) {\r\n\t\t\t\tif (in1.numDimensions() != 2 || in2.numDimensions() != 2) alsoFail(); // also check matching offsets? what is a mat multiply with non-zero offset ???\r\n\t\t\t\tif (!in1.equals(in2)) throw new IllegalArgumentException(\"Input structures do not match.\");\r\n\t\t\t\treturn Interval(in1.interval().dimension(0) + in2.interval().dimension(1)); // too naive -- need to preserve offset\r\n\t\t\t}\r\n\t\t\t@Override\r\n\t\t\tpublic ImageInfo requiredInput(final ImageInfo out, final ImageInfo in) {\r\n\t\t\t\treturn new ImageInfo() {\r\n\t\t\t\t\t@Override\r\n\t\t\t\t\tpublic Object elementType() { return in.elementType(); }\r\n\t\t\t\t\t@Override\r\n\t\t\t\t\tpublic Interval interval() {\r\n\t\t\t\t\t\t// NB: Derive required input interval from output interval + sigmas.\r\n\t\t\t\t\t\t//\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}\r\n```\r\n\r\n\u003c/details\u003e\r\n\r\nNotice that we can check the structure of a computation before trying to do it. We may want to do this outside the actual `compute` method, however, for performance reasons. The builder is a possible place this could happen. Or a new layer could be introduced, perhaps. Regardless, helper methods to validate seem to make sense.\r\n\r\nA key question is whether things behave correctly when computing on non-zero offset tiles/blocks of inputs—since that is the entire point of CompGraph. More thought needed!\r\n\r\n## Next steps\r\n* Consider whether to create composition interfaces for e.g. `Computers.Arity2\u003cI1, I2, O\u003e` + `Structured.With1Param\u003cS, I2(?)\u003e` :arrow_right: `StructuredComputers.Arity2_With1Param\u003cS, I1, I2, O\u003e`\r\n* Ideally, the `structure(...)` implementations should be able to use a lambda in the common case of identity interval transform: we often have same-size input -\u003e output—but the requiredInput computation varies more.\r\n* Abstract base classes can define common behavior for e.g. neighborhood ops. Ideally we make this an interface again with default method(s), rather than abstract class, so lambdas are still usable.\r\n* Consider what to do about `@OpDependency` chaining—can we leverage this somehow in CompGraph? Can we build multiple CompGraph nodes out of composed Ops?\r\n","author":{"url":"https://github.com/ctrueden","@type":"Person","name":"ctrueden"},"datePublished":"2019-09-27T11:48:55.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":2},"url":"https://github.com/37/scijava/issues/37"}

route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:7bbc0852-e9c4-4779-f48d-11d0c36d2ae2
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-id9E80:24CD64:2A159E3:3783533:696B2F75
html-safe-noncec477cc56fb9ff123de6012feceafe1ab625c8d4ebd5255a63d771db951eddd3c
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5RTgwOjI0Q0Q2NDoyQTE1OUUzOjM3ODM1MzM6Njk2QjJGNzUiLCJ2aXNpdG9yX2lkIjoiNzEyMTIwMzY4NDMyNTQwNDUzMyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmac38489a7b465fb1e970ae36f4ed8f111d7abc8c118112ee860d0e90f1d79885f5
hovercard-subject-tagissue:499400080
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/scijava/scijava/37/issue_layout
twitter:imagehttps://opengraph.githubassets.com/bc7eebd3dedc80b835957455ced2bfac312c7b3a69f11cda5f1d9785f3ea4809/scijava/scijava/issues/37
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/bc7eebd3dedc80b835957455ced2bfac312c7b3a69f11cda5f1d9785f3ea4809/scijava/scijava/issues/37
og:image:altHere are some interfaces we came up with that could deliver what CompGraph needs on the SciJava/ImageJ Ops side: Base interface for structured computations: public ComputationStructure { default...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamectrueden
hostnamegithub.com
expected-hostnamegithub.com
None5f99f7c1d70f01da5b93e5ca90303359738944d8ab470e396496262c66e60b8d
turbo-cache-controlno-preview
go-importgithub.com/scijava/scijava git https://github.com/scijava/scijava.git
octolytics-dimension-user_id1262770
octolytics-dimension-user_loginscijava
octolytics-dimension-repository_id85618439
octolytics-dimension-repository_nwoscijava/scijava
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id85618439
octolytics-dimension-repository_network_root_nwoscijava/scijava
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release82560a55c6b2054555076f46e683151ee28a19bc
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/scijava/scijava/issues/37#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fscijava%2Fscijava%2Fissues%2F37
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub SparkBuild and deploy intelligent appshttps://github.com/features/spark
GitHub ModelsManage and compare promptshttps://github.com/features/models
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
GitHub SponsorsFund open source developershttps://github.com/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/accelerator
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://github.com/security/advanced-security
Copilot for BusinessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/premium-support
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fscijava%2Fscijava%2Fissues%2F37
Sign up https://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=scijava%2Fscijava
Reloadhttps://github.com/scijava/scijava/issues/37
Reloadhttps://github.com/scijava/scijava/issues/37
Reloadhttps://github.com/scijava/scijava/issues/37
scijava https://github.com/scijava
scijavahttps://github.com/scijava/scijava
Notifications https://github.com/login?return_to=%2Fscijava%2Fscijava
Fork 0 https://github.com/login?return_to=%2Fscijava%2Fscijava
Star 8 https://github.com/login?return_to=%2Fscijava%2Fscijava
Code https://github.com/scijava/scijava
Issues 63 https://github.com/scijava/scijava/issues
Pull requests 1 https://github.com/scijava/scijava/pulls
Actions https://github.com/scijava/scijava/actions
Security Uh oh! There was an error while loading. Please reload this page. https://github.com/scijava/scijava/security
Please reload this pagehttps://github.com/scijava/scijava/issues/37
Insights https://github.com/scijava/scijava/pulse
Code https://github.com/scijava/scijava
Issues https://github.com/scijava/scijava/issues
Pull requests https://github.com/scijava/scijava/pulls
Actions https://github.com/scijava/scijava/actions
Security https://github.com/scijava/scijava/security
Insights https://github.com/scijava/scijava/pulse
New issuehttps://github.com/login?return_to=https://github.com/scijava/scijava/issues/37
New issuehttps://github.com/login?return_to=https://github.com/scijava/scijava/issues/37
Develop a way to make Ops usable easily from CompGraph frameworkhttps://github.com/scijava/scijava/issues/37#top
unscheduledhttps://github.com/scijava/scijava/milestone/2
https://github.com/ctrueden
https://github.com/ctrueden
ctruedenhttps://github.com/ctrueden
on Sep 27, 2019https://github.com/scijava/scijava/issues/37#issue-499400080
unscheduledNo due datehttps://github.com/scijava/scijava/milestone/2
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.