I tried to follow the landmark alignment tutorial and created a “points” layer that highlights some landmark features of the image as shown in the tutorial.
How can I save the points layer back in the spatialdata object? The tutorial suggests Ctrl+E, but that doesn’t seem to do anything.
This happens irrespective of if I open a spatialdata zarr file in napari, or open it by using Interactive().
Versions:
spatialdata v0.0.12
napari_spatialdata v0.2.6
on Linux installed via pip into a conda env
Thanks for the quick response! Now at least something is happening, but pressing Ctrl+E raises the following error:
Traceback (most recent call last):
File "<path redacted>lib/python3.10/site-packages/napari/_qt/widgets/qt_viewer_dock_widget.py", line 230, in keyPressEvent
return self._ref_qt_viewer().keyPressEvent(event)
File "<path redacted>lib/python3.10/site-packages/napari/_qt/qt_viewer.py", line 1250, in keyPressEvent
self.canvas._backend._keyEvent(self.canvas.events.key_press, event)
File "<path redacted>lib/python3.10/site-packages/vispy/app/backends/_qt.py", line 622, in _keyEvent
func(native=ev, key=key, text=str(ev.text()), modifiers=mod)
File "<path redacted>lib/python3.10/site-packages/vispy/util/event.py", line 453, in __call__
self._invoke_callback(cb, event)
File "<path redacted>lib/python3.10/site-packages/vispy/util/event.py", line 471, in _invoke_callback
_handle_exception(self.ignore_callback_errors,
File "<path redacted>lib/python3.10/site-packages/vispy/util/event.py", line 469, in _invoke_callback
cb(event)
File "<path redacted>lib/python3.10/site-packages/napari/utils/key_bindings.py", line 545, in on_key_press
self.press_key(combo)
File "<path redacted>lib/python3.10/site-packages/napari/utils/key_bindings.py", line 470, in press_key
generator_or_callback = func()
File "<path redacted>lib/python3.10/site-packages/napari_spatialdata/_view.py", line 305, in export
assert len(set(row)) == 1
TypeError: 'numpy.int64' object is not iterable
Thanks for reporting back. I have just tried again the notebook and I don’t get the error, could you please try the following?
run the first 2 cells of the notebook
the 3rd cell (Interactive(visium_sdata)) needs to be set as a code cell
run the 3rd cell
napari opens, now create a new points layer
add a few points (n >= 1)
press Shift-E. You will see a tooltip in the bottom right interface of napari saying that the data was saved. Note: if you are running napari in a Jupyter Notebook you may see no tooltip, we haven’t investigated yet why this happens.
try to print the sdata object (print(visium_sdata)), you should see the points.
In your case are you doing something substantially different from this?
Thanks for reporting.