File: annotate-2d.py

package info (click to toggle)
napari 0.6.6-3
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 12,036 kB
  • sloc: python: 112,264; xml: 72; makefile: 44; sh: 5
file content (27 lines) | stat: -rw-r--r-- 516 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
"""
Annotate 2D
===========

Display one points layer ontop of one image layer using the ``add_points`` and
``add_image`` APIs

.. tags:: analysis
"""

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)