Show last authors
author | version | line-number | content |
---|---|---|---|
1 | TODO - Not yet released! | ||
2 | |||
3 | == Purpose == | ||
4 | |||
5 | It is a Jupyter widget intended for visualization of the 3D data available for a patient: | ||
6 | |||
7 | * surfaces of different types (cortex, face, skull, etc) | ||
8 | * connectivity region centers | ||
9 | * sensors locations (SEEG, MEG, EEG) | ||
10 | |||
11 | == Inputs == | ||
12 | |||
13 | It supports the above data in the form of their corresponding TVB datatypes: | ||
14 | |||
15 | * Surface (CorticalSurface, FaceSurface, etc) | ||
16 | * Connectivity | ||
17 | * Sensors (SensorsInternal, SensorsMEG, SensorsEEG) | ||
18 | |||
19 | == Installation == | ||
20 | |||
21 | (% class="box" %) | ||
22 | ((( | ||
23 | pip install tvb-widgets | ||
24 | ))) | ||
25 | |||
26 | == API usage == | ||
27 | |||
28 | We need to first import the widget __API from tvbwidgets__// //package, together with the __TVB API __and the __display__ function: | ||
29 | |||
30 | (% class="box" %) | ||
31 | ((( | ||
32 | import tvbwidgets.api as api | ||
33 | |||
34 | from tvb.simulator.lab import * | ||
35 | |||
36 | from IPython.core.display_functions import display | ||
37 | ))) | ||
38 | |||
39 | Then, we instantiate the **ThreeDWidget** and a **FaceSurface** datatype that we want to visualize. Using the //**add_datatype**// method we add the surface to our widget and __display__ the widget: | ||
40 | |||
41 | (% class="box" %) | ||
42 | ((( | ||
43 | widget = api.SurfaceWidget() | ||
44 | |||
45 | face = surfaces.FaceSurface().from_file() | ||
46 | |||
47 | face.configure() | ||
48 | |||
49 | widget.add_datatype(face) | ||
50 | display(widget) | ||
51 | ))) | ||
52 | |||
53 | {{html}} | ||
54 | <iframe src="https://drive.google.com/file/d/1Egp9Lk-HGMATc9em6Kw_jSHmybTD2vzM/preview" width="840" height="480" allow="autoplay"></iframe> | ||
55 | {{/html}} | ||
56 | |||
57 | Next, we can continue adding other datatypes to this widget, by calling //**add_datatype**// multiple times. A maximum of 10 datatypes are supported by this widget. | ||
58 | |||
59 | The **Config** object can be used to tweak the display options for each datatype. | ||
60 | |||
61 | In the code below, we add a **Connectivity** and SEEG **Sensors:** | ||
62 | |||
63 | (% class="box" %) | ||
64 | ((( | ||
65 | conn = connectivity.Connectivity().from_file() | ||
66 | |||
67 | conn.configure() | ||
68 | |||
69 | widget.add_datatype(conn) | ||
70 | |||
71 | |||
72 | seeg = sensors.SensorsInternal().from_file() | ||
73 | |||
74 | seeg.configure() | ||
75 | |||
76 | widget.add_datatype(seeg, api.SurfaceWidgetConfig(name='SEEG')) | ||
77 | ))) | ||
78 | |||
79 | {{html}} | ||
80 | <iframe src="https://drive.google.com/file/d/1vFqqzXle8VGcHaLB-OdE-6BdetK9aJ1T/preview" width="840" height="480" allow="autoplay"></iframe> | ||
81 | {{/html}} | ||
82 | |||
83 | We can also provide a **RegionMapping** to be used as colormap for a surface: | ||
84 | |||
85 | (% class="box" %) | ||
86 | ((( | ||
87 | reg_map = region_mapping.RegionMapping.from_file() | ||
88 | |||
89 | config = api.SurfaceWidgetConfig(name='Cortex') | ||
90 | |||
91 | config.add_region_mapping_as_cmap(reg_map) | ||
92 | |||
93 | |||
94 | cortex = surfaces.CorticalSurface().from_file() | ||
95 | |||
96 | cortex.configure() | ||
97 | |||
98 | widget.add_datatype(cortex, config) | ||
99 | ))) | ||
100 | |||
101 | {{html}} | ||
102 | <iframe src="https://drive.google.com/file/d/1z2yEuQWUT2Poxh63adYbBdhKPcWGskex/preview" width="840" height="480" allow="autoplay"></iframe> | ||
103 | {{/html}} |