Replies: 1 comment 1 reply
|
for me
There is plenty interest in our side in being able to tailor the capabilities of Neuroglancer for specific workflows |
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Hi all - I thought I would start a discussion on this topic, as there is an open PR #1072 which touches on some features that are related.
I'd like to explore whether the
CommandCatalogintroduced in #1072 could become the single, neuroglancer-native place where the viewer's available commands are both enumerated and registered — with the command palette, the keyboard bindings, and any host-built control surface all being consumers of it, rather than each maintaining its own list.Firstly some context, I am using neuroglancer as a 3d tomographic viewer for rendering muon tomography scans at GScan. Whilst our domain is quite far from the neuroscience/connectomics use cases neuroglancer is built around, neuroglancer is far and away the best library I've used for looking at 3D scans in the browser. There is an email-gated demo here if you'd like to take a look at how we are using it.
Because my requirements diverge quite a bit, I have forked neuroglancer to make it "headless": I keep the WebGL rendering, viewer/state internals, chunk loading, and camera controls, but strip out essentially all of the built-in UI chrome. I then use a host application to drive everything, which supplies its own UI elements. I do this by:
ViewerclassCommandCatalogThe PR #1072 introduces a
CommandCatalogclass, which is an introspective enumeration of everything the viewer can currently do, kept in sync via signals. That class is very useful from an embed/host application point of view, and does much of the work my fork currently does (maintaining a list of "what can the viewer do right now" so that I can build UI elements and control the viewer).There are a few other forks/wrappers of neuroglancer which I think would benefit from being able to use the
CommandCatalog:CommandCataloginstead.There are also a few issue threads in the same space: #326 #427 #439 and #731
Proposal / Discussion
There are two parts to this: a small near-term proposeal that's already raised as comments on the PR, and a larger direction I'd like to get feedback on.
Near-term: I've left a few suggestions on #1072 that would let my fork — and other consumers — use the
CommandCatalogdirectly, by keeping it separable from the palette UI (a DOM-free module, a reachable catalog instance, and invocation lifted onto the catalog). None of these change behaviour; they just make the enumeration primitive usable without pulling in the UI aspects.Larger: building on that, I'd propose a first-class way to register a command into the same catalog. My reasoning is that neuroglancer currently has two partial notions of "a thing the viewer can do", and neither is quite the right home for a host-defined command:
SUPPLEMENTAL_COMMANDSlist to surface things likescreenshotandedit-json-state. They also carry no metadata, so the palette reverse-engineers a label from the action-id (here).getMatchingTools) and self-describing viatool.description. A tool is stateful and layer-aware (e.g. an annotation tool), which is a lot of machinery for a plain "do X now" command.There is a gap then for a labelled, enumerable command that a host can register, for which a keyboard binding is optional rather than the thing that makes it exist. A
registerCommandfunction could fill this gap, and then the same mechanism would be available to host applications that embed neuroglancer. In my fork we have clipping planes, for example; registering that control might look like:The catalog would then be the union of registered commands + tools + built-in actions, and stay signal-driven —
isAvailablewould feed the same "what's usable right now" mechanism the palette already relies on. The palette renders that union as its UI; an embedder like me maps each command'sinvokeonto our own UI chrome.Lastly, if this was all in place you could then completely split the UI concerns from the engine concerns internally, if all tools/actions/inputs were registered via the catalog. You could have a
setupEngine()function which instantiates the rendering engine, mounts to DOM but doesn't create any UI chrome - this would go along withsetupDefaultViewerwhich would remain unchanged. Applications which host neuroglancer could then usesetupEngine()if they need to create their own UI, or use the default one instead.Questions
All reactions