Changes for page Widget 3D Head
Last modified by paulapopa on 2025/05/30 15:03
Summary
-
Page properties (2 modified, 0 added, 0 removed)
Details
- Page properties
-
- Author
-
... ... @@ -1,1 +1,1 @@ 1 -XWiki. paulapopa1 +XWiki.ldomide - Content
-
... ... @@ -1,99 +1,8 @@ 1 1 TODO 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_3d = api.ThreeDWidget() 44 - 45 -face = surfaces.FaceSurface().from_file() 46 - 47 -face.configure() 48 - 49 -widget_3d.add_datatype(face) 50 -display(widget_3d) 51 -))) 52 - 53 -{{html}} 54 -<iframe src="https://drive.google.com/drive/folders/1Q9oTEqoqMRwjzJpngSCNRAIbJzDfUh4q/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_3d.add_datatype(conn) 70 - 71 - 72 -seeg = sensors.SensorsInternal().from_file() 73 - 74 -seeg.configure() 75 - 76 -widget_3d.add_datatype(seeg, api.Config(name='SEEG')) 77 -))) 78 - 79 -We can also provide a **RegionMapping** to be used as colormap for a surface: 80 - 81 -(% class="box" %) 82 -((( 83 -reg_map = region_mapping.RegionMapping.from_file() 84 - 85 -config = api.Config(name='Cortex') 86 - 87 -config.add_region_mapping_as_cmap(reg_map) 88 - 89 - 90 -cortex = surfaces.CorticalSurface().from_file() 91 - 92 -cortex.configure() 93 - 94 -widget_3d.add_datatype(cortex, config) 95 - 96 -{{html}} 97 -<iframe src=" https://drive.google.com/file/d/1PXsxLqydNDDORIK85cQaEgGt9QdWLcC7/preview" width="840" height="480" allow="autoplay"></iframe> 98 -{{/html}} 99 -))) 2 +! pip install -i tvb-widgets 3 +from tvbwidgets.api import SurfaceWidget 4 +from IPython.core.display_functions import display 5 +w3d = SurfaceWidget(...) 6 +display(w3d) 7 + 8 +{{html}}<iframe src=" https://drive.google.com/file/d/1PXsxLqydNDDORIK85cQaEgGt9QdWLcC7/preview" width="840" height="480" allow="autoplay"></iframe>{{/html}}