Public access to Window.qt_viewer.layer_to_visual
See original GitHub issue🚀 Feature
I would like to have public access to Window.qt_viewer.layer_to_visual
Motivation
napari particles (https://github.com/maweigert/napari-particles), which I want to incorporate into a napari dock widget, uses
viewer.window.qt_viewer.layer_to_visual[self].node
as well as
self._viewer.window.qt_viewer.controls.widgets[self]
.
While I found the second one not being necesary for my purpose the first one seems to be.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:25 (17 by maintainers)
Top Results From Across the Web
Qt: Accessing a public object from another window
The object is public and mainwindow.h is included in dialogsavemb.cpp so why can't it access the object or its methods/functions?
Read more >Window.open() - Web APIs - MDN Web Docs
The open() method of the Window interface loads a specified resource into a new or existing browsing context (that is, a tab, a...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
ah, yeah you’re with @superchromix correct? This is going to be an interesting/challenging case. We don’t have a specification for creating a fully custom layer type as a plugin, so this is absolutely pushing the boundaries of what the plugin system is currently supposed to do. Those are two rather core objects to expose there (doing so would be somewhat akin to just going back to allowing private access). If any plugin can modify the vispy visual and layer controls, how does any other plugin (or the user) have any guarantee about the “state” that they might find those controls or visual nodes in?
@maweigert and I discussed this a while back as well and anticipated the difficulty of a custom layer type as a plugin, it would be fantastic if this particles layer could be added to core napari, since it as far as the underlying data model goes, it’s rather similar to points right? (though I recognize that functionally it’s actually a subclass of
Surface
).In any case, all that said, this is clearly awesome functionality that we have to make accessible one way or the other. if we don’t want to try to get this into core, we need to have a more general conversation about how a custom layer should be added via plugins. As a very rough stab for a custom layer type spec, one could imagine:
where
model
is a subclass ofnapari.layers.Layer
,controls
is a subclass of_qt.layer_controls.qt_layer_controls_base.QtLayerControls
andvisual
is a subclass of_vispy.layers.base.VispyBaseLayer
.what do @sofroniewn & @jni think? (and also @maweigert… your thoughts on how you as a developer would have this “ideally” integrated are greatly appreciated, while also keeping your dev hat on asking “should any plugin be able to do this” 😄)
This is also something that I discussed early on with @maweigert. I would also really love to see this be part of points, since at the end of the day our “layers” are more about data models tied to visualizations, and this very naturally fits into a set of coordinates visualized a certain way. The fact that it subclasses surfaces for the visualization seems to be more of an implementation detail to get around some GL limitations; from a model perspective, it feels very much like just another marker for the points layer though.