Skip to content

rtybanana/brainboard

Repository files navigation

Contributors Forks Stargazers Issues


Logo

BrainBoard

A web-based MRI data visualisation tool which combines multiple graphical representations of brain connectivity into a single interactive dashboard.
View Demo · Report Bug · Request Feature

Table of Contents

  1. About The Project
  2. Getting Started
  3. Usage
  4. Contact

About The Project

Built With

Getting Started

There are two ways to use BrainBoard. The easiest way is to use the live hosted version here; however, you may also clone the repo and host the website locally using VS Code LiveServer or a similar method.

Usage

BrainBoard expects visualisation data to be provided in the following JSON format:

{
  "timeseries": [
    // n_regions x n_timepoints  timeseries data
  ],
  "connectivity": [
    // n_regions x n_regions  connectivity matrix 
  ],
  "regions": [
    // n_regions x 3  region coordinates in world space
  ],
  "region_names": [
    // n_regions x 1  string names of regions
  ],
  "threshold": 0.3    // between 0 and 1 proportion of strong connections
} 

threshold refers to the default proportion of strong connections to include in the plots. This can be dynamically changed within BrainBoard using a slider.

For fMRI data, all of the above information can be created and exported with Nilearn after constructing timeseries data for your chosen atlas and niimg.

Here is an example of one way you might create the JSON object using Nilearn and Python. The timeseries variable refers to your atlased timeseries data. A description of how to get that is beyond the scope of this example.

from nilearn.datasets import fetch_atlas_harvard_oxford
from nilearn.plotting import find_parcellation_cut_coords
from nilearn.connectome import ConnectivityMeasure
import json

correlation_measure = ConnectivityMeasure(kind='correlation')
correlation_matrices = correlation_measure.fit_transform([timeseries])
connectivity = correlation_matrices[0]

atlas = fetch_atlas_harvard_oxford(atlas_name='cort-maxprob-thr25-2mm')
regions = find_parcellation_cut_coords(atlas.maps)
region_names = atlas.labels

jsonobj = {
    'timeseries': timeseries.T.tolist(),
    'connectivity': connectivity.tolist(),
    'regions': regions.tolist(),
    'region_names': region_names,
    'threshold': 0.3
}

with open('harvard.json', 'w') as out:
    json.dump(jsonobj, out)

Acknowledgements

Contact

Rory Pinkney - @rorypinknee - rorypinkney@yahoo.co.uk

About

A web-based MRI data visualisation tool.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published