Attention: The Keycloak upgrade has been completed. As this was a major upgrade, there may be some unexpected issues occurring. Please report any issues you find to support by using the contact form found at https://www.ebrains.eu/contact/. Thank you for your patience and understanding. 


Wiki source code of Widget Connectivity

Version 8.1 by paulapopa on 2025/06/24 11:49

Show last authors
1 == Widget Connectivity ==
2
3 Source code: [[https:~~/~~/github.com/the-virtual-brain/tvb-widgets>>url:https://github.com/the-virtual-brain/tvb-widgets]]
4
5 This is part of a Pypi release: [[https:~~/~~/pypi.org/project/tvb-widgets/>>url:https://pypi.org/project/tvb-widgets/]]
6
7 //**tvb-widgets**// is also already installed in the official image released for EBRAINS lab, where you can test it directly.
8
9
10 == Purpose ==
11
12 Jupyter lab widgets for visualizing or do operations on a connectivity
13
14
15 === 1. ConnectivityWidget ===
16
17 ==== Visualization: ====
18
19 - in 2D can visualize weights or tracts matrixes;
20
21 [[image:conn2d.png||height="741" width="1700"]]
22
23 - in 3D can visualize regions and their respective edges
24
25 ==== [[image:conn3d.png||height="688" width="1700"]] ====
26
27 To show/hide the Connectivity centers/edges, access the controls available in the upper-right corner:
28
29 [[image:visible.png||height="543" width="500"]]
30
31 ==== Operations: ====
32
33 - remove selected nodes from a connectivity, results in a new connectivity containing only the nodes that were not selected;
34
35 - remove unselected nodes from a connectivity, results in a new connectivity containing only the selected nodes;
36
37 - remove unselected edges, results in a new connectivity with the same number of regions but without the edges of unselected regions;
38
39 - remove selected edges,  results in a new connectivity with the same number of regions but without the edges of selected regions.
40
41
42 ==== Usage: ====
43
44 After instantiating the widget it allows export of the currently selected connectivity:
45
46 {{code language="python"}}
47 from tvbwidgets.api import ConnectivityWidget
48 from tvb.datatypes.connectivity import Connectivity
49
50 conn = Connectivity.from_file() # defaults to connectivy_76.zip
51 conn.configure()
52
53 wid = ConnectivityWidget(conn, default_active_tab='viewers') # default_active_tab can be any value between 'viewers'|'operations'|'both'
54
55 display(wid)
56 # ....do some operations...
57 # replace None in the method below with the gid of the connectivity you wish to export
58 # if no gid is provided it will export the connectivity currently viewed
59
60 new_connectivity = wid.get_connectivity(gid=None)
61 new_connectivity
62 {{/code}}
63
64
65 === 2. SpaceTimeVisualizerWidget ===
66
67
Public

TVB Widgets