forked from napari/napari
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnD_points.py
More file actions
41 lines (35 loc) · 862 Bytes
/
Copy pathnD_points.py
File metadata and controls
41 lines (35 loc) · 862 Bytes
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
33
34
35
36
37
38
39
40
41
"""
nD points
=========
Display one points layer on top of one 4-D image layer using the
add_points and add_image APIs, where the markes are visible as nD objects
across the dimensions, specified by their size
"""
import numpy as np
from skimage import data
import napari
blobs = np.stack(
[
data.binary_blobs(
length=128, blob_size_fraction=0.05, n_dim=3, volume_fraction=f
)
for f in np.linspace(0.05, 0.5, 10)
],
axis=0,
)
viewer = napari.view_image(blobs.astype(float))
# add the points
points = np.array(
[
[0, 0, 100, 100],
[0, 0, 50, 120],
[1, 0, 100, 40],
[2, 10, 110, 100],
[9, 8, 80, 100],
], dtype=float
)
viewer.add_points(
points, size=[0, 6, 10, 10], face_color='blue', out_of_slice_display=True
)
if __name__ == '__main__':
napari.run()