The idea of this project is two-fold:
- I needed to be able to interpolate data from the 90-node AAL atlas onto subjects' cortical meshes.
- I wanted to be able to plot both a functional overlay and a network (nodes & edges) simultaneously.
There are two versions:
- Code version now uses Qt, has traits(ui) rather than Tkinter interface and uses mayavi. Fast. Use this version.
- Old compiled version is still the old tkinter + matplotlib version (slow).
- Read gifti files (using nibabel)
- Fit a cortical mesh (e.g. template, glass brain) to AAL90 template source model
- Align & interpolate functional overlay onto mesh
- Plot mesh (using mayavi)
- Plot overlay
- Plot network from nxn numpy array
- Inflate mesh
- Compute mesh normals
- Compute mesh adjacency
- Sphere fitting
-
Download this repo, navigate to it and launch the gui from command line using: $python New_PyBP.py
-
Download this repo and use pyinstaller to compile it to a mac app or windows exe. Code for this included, see PyCompile_PyBP
-
Download this repo, open up your python ide (e.g. spyder) and take a look at the example UserScript.py for how to call the functions and plots
-
(not recommended, slow) Download the older, slower, tkinter based mac app (.dmg contains .app) from here!
-
If you just want the functions, import PyBP:
from PyBP import *
-
(Get a template mesh & example overlay and network files, here)
For command line / Spyder use:
- Mayavi
- Traits / Traitsui
- (Spyder / Anaconda)
For compiled use:
- PySide
Download the code and compile it using pyinstaller, as per examples in PyCompile_PyBP.
Here's some screenshots of the standalone.
Overlay & Network
Network
Overlay
Access to options in gui by going to 'file'. Select load gifti, or inflate gifti, and select the .gii mesh to plot. Inflating is relatively quick, although it depends on the number of vertices in the mesh. Try out the 'NewSmoothed.gii' in the example directory.
To load a functional overlay, select it from file and choose a textfile with 90 new-line delimited values corresponding to the usual order of the 90 nodes. See OverlayData.txt in the example download to see how this file should look. Once opened, the iterative closest point algorithm interpolates the values onto the mesh, after centering and scaling both cloud points (AAL and mesh vertices).
To load a network, select it from the file menu and pick your .edge file. This is a usual .edge file (no .node file needed since it's always going to be the same set of nodes). The .edge contains a 90-by-90 matrix of connectivity values. (Note this can be easily written out from matlab using dlmwrite).