Skip to content

Commit a16d59a

Browse files
committed
Simple brain_plot function and data.
1 parent c644926 commit a16d59a

3 files changed

Lines changed: 21 additions & 0 deletions

File tree

setup.cfg

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ packages = find:
2020
python_requires = >=3.6
2121
include_package_data = True
2222

23+
install_requires =
24+
numpy
25+
matplotlib
26+
2327
[options.package_data]
2428
brainplotlib =
2529
data/*.npy

src/brainplotlib/__init__.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import os
2+
import numpy as np
3+
from matplotlib import cm
4+
5+
6+
DIR_PATH = os.path.dirname(os.path.realpath(__file__))
7+
mapping = np.load(os.path.join(DIR_PATH, 'data', 'icoorder3_mapping.npy'))
8+
9+
10+
def brain_plot(values, vmax, vmin, cmap=None):
11+
r = (vmax - values) / (vmax - vmin)
12+
r = np.clip(r, 0.0, 1.0)
13+
cmap = cm.get_cmap(cmap)
14+
c = cmap(r)
15+
c = np.concatenate([c, [[0.8] * c.shape[1], [1.0] * c.shape[1]]], axis=0)
16+
img = c[mapping]
17+
return img
5.14 MB
Binary file not shown.

0 commit comments

Comments
 (0)