Napari layers save/load from command line

Hello everyone,

Is there any way to save and load a Point layer and start from where you left the work.

with napari.gui_qt():
                viewer = napari.view_image(IM, rgb=False)
                viewer.add_points(name='spot', face_color='red', opacity=0.4, symbol='square', size=pad)
layer = [i for i in viewer.layers if i.name == 'spot']

After selecting the points I just close the window and the layers stay stored in the viewer.layer
How can I make to save the layer as it is, and load it again to the viewer and continuing from there?

Thank you,
Best regards,
Miguel

You should be able to use viewer.layers.save('my_file.csv') and viewer.open('my_file.csv') to save an load your points data. Right now though we don’t include things like colors of your points etc. Let me know if this works for you as expected or not.

I’m running it in Jupyter notebook so to save/load the layers that were created I need to do it in the window interactively. For some reason I can not access to the terminal when I started napari from Jupyter. There is any way to access to it or add the command in the jupyter script to add it automatically?

And after adding I guess is possible to change the specific parameters like _face_color, size…etc but still I didn’t figure out how to.

Thanks for the fast answer and amazing work to all developers of Napari.

Terminal from Jupyter should work, but we were actually thinking of disabling it as it is somewhat duplicative the the notebook itself, and we didn’t enable the terminal when launching from IPython. Remember when in the notebook you don’t need with napari.gui_qt() as you have the %gui qt syntax. See here for some example notebooks https://github.com/sofroniewn/napari-training-course/tree/master/lessons