scijava / scijava-jupyter-kernel

[RETIRED] Try IJava or BeakerX
Apache License 2.0
178 stars 42 forks source link

Investigate a better integration with Jupyter lab #82

Closed hadim closed 5 years ago

hadim commented 6 years ago

Try to get some IJ specific widgets working with the kernel.

A widget to visualize nD images would be great!

ctrueden commented 6 years ago

Turns out that widget support is already in regular Jupyter. No Lab needed, I guess. At least, I ran these notebooks in Binder without a problem.

The trouble is: all the interactive widgets are Python-specific. You have to write Python code to link widgets together, deal with callbacks, etc. So I guess for SJJK, we will need to implement our own widget rendering using HTML <input> tags in the output? I don't know what the JavaScript looks like to re-invoke that cell of the kernel when the widgets change, though.

Maybe I am on the wrong track here?

hadim commented 6 years ago

Custom JS code provided by the kernel is one way to do it but I feel like Jupyterlab is pushing in a slightly different direction with the renderers thing: https://github.com/jupyterlab/jupyter-renderers

The idea would be for the kernel to provide data as JSON and then have a "renderers" that take care of the rendering part.

I like this separation of the model and view but I don't think any interactive things with the kernel can be done that way (or maybe by sending back a modified JSON file to the kernel after an interaction is done?).

ctrueden commented 6 years ago

maybe by sending back a modified JSON file to the kernel after an interaction is done?

Right... I don't see any other way to do it, in general, than to send the new input values back to the kernel for recomputation. There's no way to compile all possible results into a big JSON data structure in advance.

ctrueden commented 5 years ago

Gonna close this, since we won't do anything with it here.