Annotate 2D#
Display one points layer ontop of one image layer using the add_points and
add_image APIs

click to add points; close the window when finished.
/home/runner/work/docs/docs/.venv/lib/python3.12/site-packages/napari/_qt/qt_event_loop.py:49: UserWarning: System theme detection requires a Qt6 backend. Please switch to PyQt6 or PySide6 to use it.
theme_type=get_system_theme(),
/home/runner/work/docs/docs/.venv/lib/python3.12/site-packages/napari/_qt/qt_event_loop.py:49: UserWarning: System theme detection requires a Qt6 backend. Please switch to PyQt6 or PySide6 to use it.
theme_type=get_system_theme(),
you clicked on:
[]
import numpy as np
from skimage import data
import napari
print('click to add points; close the window when finished.')
viewer = napari.Viewer()
layer = viewer.add_image(data.astronaut(), rgb=True)
points = viewer.add_points(np.zeros((0, 2)))
points.mode = 'add'
if __name__ == '__main__':
napari.run()
print('you clicked on:')
print(points.data)