This jupyter notebook generates an interactive brain network graph starting from a connectivity matrix and the related nodes coordinates using plotly
. The example data used here are available on the USC Multimodal Connectivity Database. More details available in this post.
To run it, you need python
(3.7
) and the following packages:
numpy
(1.18.4
);plotly
(4.14.3
). To regenerate the brain surface file,freesurfer
(6.0.0
) is required. The script was tested on macOS10.15.7
.
Some things to keep in mind:
- The script
srf2obj
is available on Brainder; - For visualization purposes, only the left half of the brain surface is visualized on top of the graph - despite being qualitatively aligned, one needs to take in mind that the nodes' coordinates and the surface have not been registered;
- More detailed examples on 3D plotting with
plotly
are available here and here; - To display the brain surface, the
lh.pial
file from the FreeSurfersurf
folder is first converted to ASCII, then to.obj
format and finally is rearranged with a tailored function (as described here); if you have a more direct way to do this, please get in touch!