Skip to content

Commit ba66a89

Browse files
committed
feat: example annotation oriented as annotation and mesh
1 parent b1e09e9 commit ba66a89

File tree

1 file changed

+66
-0
lines changed

1 file changed

+66
-0
lines changed
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
import json
2+
3+
from cryoet_data_portal_neuroglancer.precompute.points import (
4+
encode_annotation,
5+
)
6+
from cryoet_data_portal_neuroglancer.precompute.instance_mesh import (
7+
encode_oriented_mesh,
8+
)
9+
from cryoet_data_portal_neuroglancer.state_generator import (
10+
generate_oriented_point_layer,
11+
combine_json_layers,
12+
generate_segmentation_mask_layer,
13+
)
14+
from cryoet_data_portal_neuroglancer.io import load_glb_file, load_oriented_point_data
15+
from pathlib import Path
16+
from cryoet_data_portal_neuroglancer.precompute.glb_meshes import (
17+
generate_standalone_sharded_multiresolution_mesh,
18+
)
19+
20+
21+
JSON_PATH = Path(
22+
r"/media/starfish/LargeSSD/data/cryoET/data/Annotations-test-run/100-proton_transporting_atp_synthase_complex-1.0.json"
23+
)
24+
25+
MESH_PATH = Path(
26+
r"/media/starfish/LargeSSD/data/cryoET/data/meshes-oriented/atpase.glb"
27+
)
28+
29+
OUTPUT_PATH = Path(r"/media/starfish/LargeSSD/data/cryoET/data/converted-01122021/")
30+
31+
metadata, data = load_oriented_point_data(
32+
JSON_PATH, JSON_PATH.with_name(JSON_PATH.stem + "_orientedpoint.ndjson")
33+
)
34+
35+
encode_annotation(
36+
data, metadata, OUTPUT_PATH, 0.784 * 1e-9, shard_by_id=(0, 10), is_oriented=True
37+
)
38+
mesh = load_glb_file(MESH_PATH)
39+
40+
sub_result = encode_oriented_mesh(mesh, data, metadata, OUTPUT_PATH, 2)
41+
generate_standalone_sharded_multiresolution_mesh(
42+
sub_result,
43+
OUTPUT_PATH / "meshoutput",
44+
)
45+
46+
SOURCE = "http://127.0.0.1:9000/converted-01122021/"
47+
48+
output = generate_oriented_point_layer(
49+
source=SOURCE,
50+
name="Test Oriented Points",
51+
color="#FFFFFF",
52+
point_size_multiplier=0.5,
53+
line_width=2.0,
54+
is_visible=True,
55+
is_instance_segmentation=False,
56+
scale=0.784 * 1e-9,
57+
)
58+
59+
output2 = generate_segmentation_mask_layer(
60+
source="http://localhost:1337",
61+
name="Test Mesh",
62+
color="#FF0000",
63+
scale=0.784 * 1e-9,
64+
)
65+
layer_json = combine_json_layers([output, output2], 0.784, units="nm")
66+
json.dump(layer_json, open("oriented_point_layer.json", "w"), indent=2)

0 commit comments

Comments
 (0)