Widget Connectivity

Last modified by davidbacter01 on 2023/09/19 10:22

Widget Connectivity

Source code: https://github.com/the-virtual-brain/tvb-widgets

This is part of a Pypi release: https://pypi.org/project/tvb-widgets/

tvb-widgets is also already installed in the official image released for EBRAINS lab, where you can test it directly.

Purpose

Jupyter lab widget for visualizing or do operations on a connectivity

Visualization:

    - in 2D can visualize weights or tracts matrixes;

image-20230919110833-1.png

    - in 3D can visualize regions and their respective edges 

image-20230919110853-2.png

Operations:

 - remove selected nodes from a connectivity, results in a new connectivity containing only the nodes that were not selected;

 - remove unselected nodes from a connectivity, results in a new connectivity containing only the selected nodes;

 - remove unselected edges, results in a new connectivity with the same number of regions but without the edges of unselected regions;

 - remove selected edges,  results in a new connectivity with the same number of regions but without the edges of selected regions.

Usage:

After instantiating the widget it allows export of the currently selected connectivity:

from tvbwidgets.api import ConnectivityWidget
from tvb.datatypes.connectivity import Connectivity

import pyvista as pv


pv.set_jupyter_backend('pythreejs')

conn = Connectivity.from_file() # defaults to connectivy_76.zip
conn.configure()

wid = ConnectivityWidget(conn, default_active_tab='viewers') # default_active_tab can be any value between 'viewers'|'operations'|'both'

display(wid)
# ....do some operations...
# replace None in the method below with the gid of the connectivity you wish to export
# if no gid is provided it will export the connectivity currently viewed

new_connectivity = wid.get_connectivity(gid=None)  
new_connectivity

 

Public

TVB Widgets