-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbrain_highres.py
53 lines (35 loc) · 1.45 KB
/
brain_highres.py
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
"""
# 3D high-res brain mesh
Showing a ultra-high resolution mesh of a human brain, acquired with a 7 Tesla MRI.
The data is not yet publicly available.
Data courtesy of Anneke Alkemade et al.:
Alkemade A, Pine K, Kirilina E, Keuken MC, Mulder MJ, Balesar R, Groot JM, Bleys RLAW,
Trampel R, Weiskopf N, Herrler A, Möller HE, Bazin P-L and Forstmann BU (2020)
*7 Tesla MRI Followed by Histological 3D Reconstructions in Whole-Brain Specimens*
Front. Neuroanat. 14:536838
doi: 10.3389/fnana.2020.536838
Acknowledgements to Pierre-Louis Bazin and Julia Huntenburg for data access.
"""
from pathlib import Path
import numpy as np
from datoviz import canvas, run, colormap
c = canvas(show_fps=True, width=1024, height=768)
panel = c.scene().panel(controller='arcball')
visual = panel.visual('mesh', transform='auto')
ROOT = Path(__file__).resolve().parent.parent / "datoviz"
pos = np.load(ROOT / "data/mesh/brain_highres.vert.npy")
faces = np.load(ROOT / "data/mesh/brain_highres.faces.npy")
assert pos.ndim == 2
assert pos.shape[1] == 3
assert faces.ndim == 2
assert faces.shape[1] == 3
print(f"Mesh has {len(faces)} triangles and {len(pos)} vertices")
visual.data('pos', pos)
visual.data('index', faces.ravel())
visual.data('clip', np.array([0, 0, 1, 1]))
gui = c.gui("GUI")
slider = gui.control("slider_float", "clip", vmin=-1, vmax=+1, value=+1)
@slider.connect
def on_change(value):
visual.data('clip', np.array([0, 0, 1, value]))
run()