-
Notifications
You must be signed in to change notification settings - Fork 76
Export Brain Net Viewer
Patricia Wollstadt edited this page Jul 18, 2018
·
1 revision
Export networks to BrainNet Viewer MATLAB
toolbox. BrainNet Viewer offers brain network visualisation (e.g., 'glass'
brains). The export function creates text files *.node
and *.edge
,
containing information on node location (in MNI coordinates), directed edges,
node color and size.
Reference:
- Xia, M., Wang, J., & He, Y. (2013). BrainNet Viewer: A Network Visualization Tool for Human Brain Connectomics. PLoS ONE 8(7): e68910. https://doi.org/10.1371/journal.pone.0068910
import pickle
import numpy as np
from idtxl import idtxl_io as io
results = pickle.load(open('test/data/mute_results_0.p', 'rb'))
Example: export inferred network, using the lag of the past variable with maximum information transfer into the target to weight edges
outfile = 'brain_net'
n_nodes = results.data_properties.n_nodes
mni_coord = np.random.randint(10, size=(n_nodes, 3))
node_color = np.random.randint(10, size=n_nodes)
node_size = np.random.randint(10, size=n_nodes)
labels = ['node_0', 'node_1', 'node_2', 'node_3', 'node_4']
adj_matrix = results.get_adjacency_matrix(
weights='max_te_lag', fdr=False,)
io.export_brain_net_viewer(adjacency_matrix=adj_matrix,
mni_coord=mni_coord,
file_name=outfile,
labels=labels,
node_color=node_color,
node_size=node_size)