-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Consider scripting integration with the napari console #297
Comments
Certainly it's possible. Here is the code from SciJava bindings.put("ctx", context);
for (final Service service : context.getServiceIndex().getAll()) {
final String name = serviceName(service);
bindings.put(name, service);
} which would just need to be Pythonified, replacing ctx = napari_imagej.nij.ij.context()
services = {"ctx": ctx}
for (service in ctx.getServiceIndex().getAll()):
name = service_name(service)
viewer.update_console(services) which I guess you would do as soon as napari-imagej finishes initializing the Also need to port the I was unfortunately not able to fully test the above quickly, because:
which happens because I'm wrapping a local Fiji and it still ships with 2.94.2. |
Oh, I didn't see |
@kephale We are discussing whether to keep the dedicated SciJava REPL widget in napari-imagej, versus relying solely on the main napari console with SciJava services injected as globals/locals. Could you briefly comment on your motivating use case for adding the SciJava REPL in the first place? Would the napari console be sufficient if we expose all the services in an analogous way? Or is there some further reason we should keep the SciJava REPL as its own dedicated console in addition? |
I found it to be a convenient way to interactively call into plugins and such. I would definitely want to have a SciJava Context, but sometimes I might want something like the SciviewService... |
@kephale Indeed, that's what I mean by "expose all services in an analogous way". Populate the napari console's bindings the same way we do the SciJava REPL's, so the same code (modulo language syntax differences) would work. It sounds like if we do that, you'll get similar convenience, so that's the way we're currently leaning, in the interest of reducing the number of lines of code to maintain. But still open to the idea of leaving the dedicated SciJava REPL in there if there are things it brings to the table (e.g. scripting in languages besides Python; operating directly in Java land rather than on the Python side) that matter to you. |
In #265, @kephale added a widget that replicates the Script Interpreter in napari-imagej. However we noted on Zulip that ideally, we wouldn't need to add a second console - we could access all of the desired variables through the napari/napari-console plugin that currently exists.
I'm not sure whether this functionality is currently possible though, so I haven't implemented it yet.
The text was updated successfully, but these errors were encountered: