-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexample_annotation_properties.py
More file actions
55 lines (53 loc) · 1.73 KB
/
example_annotation_properties.py
File metadata and controls
55 lines (53 loc) · 1.73 KB
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
from __future__ import print_function
import argparse
import neuroglancer
import neuroglancer.cli
if __name__ == '__main__':
ap = argparse.ArgumentParser()
neuroglancer.cli.add_server_arguments(ap)
args = ap.parse_args()
neuroglancer.cli.handle_server_arguments(args)
viewer = neuroglancer.Viewer()
with viewer.txn() as s:
s.dimensions = neuroglancer.CoordinateSpace(names=["x", "y"], units="nm", scales=[1, 1])
s.position = [150, 150]
s.layers.append(
name="a",
layer=neuroglancer.LocalAnnotationLayer(
dimensions=s.dimensions,
annotation_properties=[
neuroglancer.AnnotationPropertySpec(
id='color',
type='rgb',
default='red',
),
neuroglancer.AnnotationPropertySpec(
id='size',
type='float32',
default=10,
)
],
annotations=[
neuroglancer.PointAnnotation(
id='1',
point=[150, 150],
props=['#0f0', 5],
),
neuroglancer.PointAnnotation(
id='2',
point=[250, 100],
props=['#ff0', 30],
),
],
shader='''
void main() {
setColor(prop_color());
setPointMarkerSize(prop_size());
}
''',
),
)
s.layout = 'xy'
s.selected_layer.layer = 'a'
print('Use `Control+right click` to display annotation details.')
print(viewer)