Skip to content

Commit

Permalink
download nilearn volumetric data (a stats mao), resample to surf, plot
Browse files Browse the repository at this point in the history
  • Loading branch information
sheyma committed Sep 17, 2019
1 parent e81c5cb commit b425fcb
Showing 1 changed file with 67 additions and 0 deletions.
67 changes: 67 additions & 0 deletions examples/eeg_meg/fmri_stats_map.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
from visbrain.objects import BrainObj, ColorbarObj, SceneObj
from nilearn import datasets, surface

sc = SceneObj(bgcolor='black', size=(1000, 500))

# Colorbar default arguments
CBAR_STATE = dict(cbtxtsz=20, txtsz=20., width=.1, cbtxtsh=3.,
rect=(-.3, -2., 1., 4.))
KW = dict(title_size=14., zoom=1.2)

motor_images = datasets.fetch_neurovault_motor_task()
stat_img = motor_images.images[0]
# stat_img is a nifti file: "image_10426.nii.gz"

print('AAAAA', stat_img)

b_obj = BrainObj('white',
translucent=False)

mesh = [b_obj.vertices, b_obj.faces]

# resample from nifti to mesh
texture = surface.vol_to_surf(stat_img, mesh)

# plot mesh across brain oject
b_obj.add_activation(-1 * texture,
cmap='Blues_r',
clim=(1, 7.9),
vmin=1,
vmax=7.9,
hide_under=1,)

cb_proj = ColorbarObj(b_obj,
cblabel='stats map (-)',
cmap='Blues',
vmin=-7.9,
vmax=-1,
clim=(-7.9, -1),
#over='gainsboro',
**CBAR_STATE)

b_obj.add_activation(texture,
cmap='Reds_r',
vmin=1,
vmax=7.9,
clim=(1, 7.9),
hide_under=1)

cb_proj_2 = ColorbarObj(b_obj,
cblabel='statsmap (+)',
cmap='Reds_r',
vmin = 1,
vmax=7.9,
#under='gainsboro',
**CBAR_STATE)

sc.add_to_subplot(b_obj, row=0, col=0, rotate='right')

sc.add_to_subplot(cb_proj,
row=0, col=1,
width_max=200)

sc.add_to_subplot(cb_proj_2,
row=0, col=2,
width_max=200)

sc.preview()

0 comments on commit b425fcb

Please sign in to comment.