forked from dagush/WholeBrain
-
Notifications
You must be signed in to change notification settings - Fork 0
/
DecoKringelbach2020_Fig1E.py
66 lines (55 loc) · 2.98 KB
/
DecoKringelbach2020_Fig1E.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# =================================================================
# Plotting brain functions with
# NiBabel for the gifti files, and
# matplotlib for plotting
#
# Based on the code from the paper:
# [DecoKringelbach2020] Turbulent-like Dynamics in the Human Brain, Deco & Kringelbach,
# 2020, Cell Reports 33, 108471
# https://doi.org/10.1016/j.celrep.2020.108471
#
# To Do: increase the size of the plots
# =================================================================
#
# These files can be usually computed with the Connectome Workbench
# Workbench Command Quick reference (https://www.humanconnectome.org/software/workbench-command/-volume-to-surface-mapping)
# wb_command -volume-to-surface-mapping
# <volume> - the volume to map data from
# <surface> - the surface to map the data onto
# <metric-out> - output - the output metric file
# [-trilinear] - use trilinear volume interpolation
#
# Example:
# wb_command -volume-to-surface-mapping different_regions_CNT-UWS.nii.gz
# Q1-Q6_R440.R.inflated.32k_fs_LR.surf.gii
# CNT-UWSR.shape.gii
# -trilinear
import numpy as np
import nibabel as nib
from matplotlib import cm
import matplotlib.pyplot as plt
import functions.Utils.plotBrain as plot
base_folder = "./Data_Raw"
# ====================================================
# =============== Load the geometry ==================
glassers_L = nib.load(base_folder + '/Glasser360/' + 'Glasser360.L.mid.32k_fs_LR.surf.gii')
# glassers_L = nib.load(base_folder + '/Glasser360/' + 'Glasser360.L.inflated.32k_fs_LR.surf.gii')
# glassers_L = nib.load(base_folder + '/Glasser360/' + 'Glasser360.L.very_inflated.32k_fs_LR.surf.gii')
glassers_R = nib.load(base_folder + '/Glasser360/' + 'Glasser360.R.mid.32k_fs_LR.surf.gii')
# glassers_R = nib.load(base_folder + '/Glasser360/' + 'Glasser360.R.inflated.32k_fs_LR.surf.gii')
# glassers_R = nib.load(base_folder + '/Glasser360/' + 'Glasser360.R.very_inflated.32k_fs_LR.surf.gii')
flat_L = nib.load(base_folder + '/Glasser360/' + 'Glasser360.L.flat.32k_fs_LR.surf.gii')
flat_R = nib.load(base_folder + '/Glasser360/' + 'Glasser360.R.flat.32k_fs_LR.surf.gii')
# =============== Load the information to display =====
atlas_l = nib.load(base_folder + '/DecoKringelbach2020/Schaefer1000_L.func.gii').agg_data()
atlas_r = nib.load(base_folder + '/DecoKringelbach2020/Schaefer1000_R.func.gii').agg_data()
# =============== Plot!!! =============================
leftColors = cm.tab20c
rightColors = cm.brg
cortex = {'model_L': glassers_L, 'model_R':glassers_R,
'flat_L': flat_L, 'flat_R': flat_R}
data = {'func_L': atlas_l, 'func_R': atlas_r}
plot.multiview6(cortex, data, leftColors, rightColors, shaded=False) # shadowed=True)
# ====================================================
# ====================================================
# ====================================================EOF