File: cursor_position.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 (32 lines) | stat: -rw-r--r-- 641 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
28
29
30
31
32
"""
Cursor position
===============

Add small data to examine cursor positions

.. tags:: interactivity
"""

import numpy as np

import napari

viewer = napari.Viewer()
image = np.array([[1, 0, 0, 1],
                  [0, 0, 1, 1],
                  [1, 0, 3, 0],
                  [0, 2, 0, 0]], dtype=int)

viewer.add_labels(image)

points = np.array([[0, 0], [2, 0], [1, 3]])
viewer.add_points(points, size=0.25)

rect = np.array([[0, 0], [3, 1]])
viewer.add_shapes(rect, shape_type='rectangle', edge_width=0.1)

vect = np.array([[[3, 2], [-1, 1]]])
viewer.add_vectors(vect, edge_width=0.1)

if __name__ == '__main__':
    napari.run()