How do I save the widgets

see the example PaintWidget, I want to save the information for the widget,I use scene.renderer = scene.fullScreenRenderer.getRenderer(); scene.renderer.getState() ,but there is no widget information. How do I get all the widget information?
Thank you.

Widgets are not serializable for now.

But more than saving the widgets, it seems that what you want is to save the underlying volume (i.e. vtkImageData) that contains all the painted strokes.

You can use vtkXMLImageDataWriter to do that.

Hth,
Julien.


But how does this example get the widget’s information? Do you know which API it uses?

Glance uses explicit serialization, i.e. it constructs a serialization from the widget state in a manner akin to the following:

const serializedRuler = {
  points: widgetState.getHandles().map((handleState) => handleState.getOrigin()),
  color: '#ffee00',
  ...
}