InsightSoftwareConsortium / itkwidgets

An elegant Python interface for visualization on the web platform to interactively generate insights into multidimensional images, point sets, and geometry.
https://itkwidgets.readthedocs.io/
Apache License 2.0
576 stars 83 forks source link

Unable to Save Widget State #390

Open stevejpurves opened 3 years ago

stevejpurves commented 3 years ago

Hi Folks,

I'm looking at how to interact with itkwidget's state in the jupyter notebook and jupyer lab. Although I can:

Screenshot 2020-10-27 at 11 52 23

But if I close jupyter lab completely, or kill the active kernel, then reopen it and the notebook, the 3D plot is not visible and I get a message from the extension that it cannot find the model.

In Jupyter lab, i have selected the "Save Widget State Automatically" setting which for ipywidgets serialises the model to the notebook metadata, so that widgets are re-rendered when the notebook is opened.

Screenshot 2020-10-27 at 11 45 48

However, the itk widgets state is not saved.

In parallel, when using the classic notebook there are various controls in the Widgets menu allowing a user to save/download/embed widgets state and these do nothing for my notebook containing the ITKPlotter.

Is this because the itkwidget extension needs to implement something in order to support saving/serialisation of the state?

thewtex commented 3 years ago

Hi @stevejpurves,

Current refactoring is undergoing to enable saving and restoration of the full widget state.