Esempio n. 1
0
"""Create the source object. If you want to previsualize the result without
opening Brain, use s_obj.preview()
"""
s_obj = SourceObj('SourceExample', xyz, **kwargs)
# s_obj.preview()
"""Color sources according to the data
"""
# s_obj.color_sources(data=kwargs['data'], cmap='viridis')
"""Colorbar properties
"""
cb_kw = dict(
    cblabel="Project source activity",
    cbtxtsz=3.,
    border=False,
)
"""Define a brain object with the B3 template and project source's activity
onto the surface
"""
b_obj = BrainObj('B3', **cb_kw)
b_obj.project_sources(s_obj,
                      cmap='viridis',
                      vmin=50.,
                      under='orange',
                      vmax=550.,
                      over='darkred')
"""Create a Brain instance and pass both of the brain and source object defined
After the interface is opened, press C to display the colorbar.
"""
vb = Brain(source_obj=s_obj, brain_obj=b_obj)
vb.show()
s_obj_3.color_sources(data=data3)
s_obj_4 = SourceObj('iEEG', xyz4, data=data4, cmap=cmap)
s_obj_4.color_sources(data=data4)
s_obj_5 = SourceObj('iEEG', xyz5, data=data5, cmap=cmap)
s_obj_5.color_sources(data=data5)
s_obj_6 = SourceObj('iEEG', xyz6, data=data6, cmap=cmap)
s_obj_6.color_sources(data=data6)

#s_obj_all = s_obj_1 + s_obj_2 + s_obj_3 + s_obj_4+ s_obj_5 + s_obj_6 + s_obj_7

s_obj_all = s_obj_6 + s_obj_5 + s_obj_4 + s_obj_3 + s_obj_2 + s_obj_1

b_obj_proj_left = BrainObj(template_brain,
                           hemisphere='left',
                           translucent=False)
b_obj_proj_left.project_sources(s_obj_all, clim=(1, 7), cmap='viridis_spliced')
sc.add_to_subplot(b_obj_proj_left,
                  row=0,
                  col=0,
                  rotate='left',
                  use_this_cam=True)

b_obj_proj_left = BrainObj(template_brain,
                           hemisphere='left',
                           translucent=False)
b_obj_proj_left.project_sources(s_obj_all, clim=(1, 7), cmap='viridis_spliced')
sc.add_to_subplot(b_obj_proj_left,
                  row=1,
                  col=0,
                  rotate='right',
                  use_this_cam=True)
Esempio n. 3
0
    s_obj_12 = SourceObj('iEEG', xyz12, data=data12, cmap=cmap)
    s_obj_12.color_sources(data=data12)
    s_obj_13 = SourceObj('iEEG', xyz13, data=data13, cmap=cmap)
    s_obj_13.color_sources(data=data13)
    s_obj_14 = SourceObj('iEEG', xyz14, data=data14, cmap=cmap)
    s_obj_14.color_sources(data=data14)
    s_obj_15 = SourceObj('iEEG', xyz15, data=data15, cmap=cmap)
    s_obj_15.color_sources(data=data15)

    s_obj_all = s_obj_1 + s_obj_2 + s_obj_3 + s_obj_4 + s_obj_5 + s_obj_6 + s_obj_7 + s_obj_8 + s_obj_9 + s_obj_10 + \
                s_obj_11 + s_obj_12 + s_obj_13 + s_obj_14 + s_obj_15

    b_obj_proj_left = BrainObj(template_brain,
                               hemisphere='left',
                               translucent=False)
    b_obj_proj_left.project_sources(s_obj_all, clim=(0, 16), cmap=cmap)
    sc.add_to_subplot(b_obj_proj_left,
                      row=0,
                      col=0,
                      rotate='left',
                      use_this_cam=True)

    b_obj_proj_left = BrainObj(template_brain,
                               hemisphere='left',
                               translucent=False)
    b_obj_proj_left.project_sources(s_obj_all, clim=(0, 16), cmap=cmap)
    sc.add_to_subplot(b_obj_proj_left,
                      row=0,
                      col=1,
                      rotate='right',
                      use_this_cam=True)
Esempio n. 4
0
KW = dict(title_size=14., zoom=2)

template_brain = 'B3'

bo = se.load(os.path.join(nii_bo_dir, 'best_90th.bo'))

data1 = bo.get_data().values.ravel()
xyz1 = bo.locs.values

s_obj_1 = SourceObj('iEEG', xyz1, data=data1, cmap=cmap)
s_obj_1.color_sources(data=data1)

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

b_obj_proj_left = BrainObj(template_brain, hemisphere='left', translucent=False)
b_obj_proj_left.project_sources(s_obj_1, clim=(0, 2), cmap='binary')
sc.add_to_subplot(b_obj_proj_left, row=0, col=0, rotate='left', use_this_cam=True)


b_obj_proj_left = BrainObj(template_brain, hemisphere='left', translucent=False)
b_obj_proj_left.project_sources(s_obj_1, clim=(0, 2), cmap='binary')
sc.add_to_subplot(b_obj_proj_left, row=0, col=1, rotate='right', use_this_cam=True)

b_obj_proj_right = BrainObj(template_brain, hemisphere='right', translucent=False)
b_obj_proj_right.project_sources(s_obj_1, clim=(0, 2), cmap='binary')
sc.add_to_subplot(b_obj_proj_right, row=0, col=2, rotate='left', use_this_cam=True)

b_obj_proj_right = BrainObj(template_brain, hemisphere='right', translucent=False)
b_obj_proj_right.project_sources(s_obj_1, clim=(0, 2), cmap='binary')
sc.add_to_subplot(b_obj_proj_right, row=0, col=3, rotate='right', use_this_cam=True)
Esempio n. 5
0
freqs = ['delta', 'theta', 'alpha', 'beta', 'lgamma', 'hgamma']

sc = SceneObj(bgcolor='white', size=(1000, 1000))

b_yeo = se.load(os.path.join(nii_bo_dir, 'yeo_bo_6mm.bo'))

data1 = b_yeo.get_data().values.ravel()
xyz1 = b_yeo.locs.values

s_obj_1 = SourceObj('iEEG', xyz1, data=data1, cmap=cmap)
s_obj_1.color_sources(data=data1)

b_obj_proj_left = BrainObj(template_brain,
                           hemisphere='left',
                           translucent=False)
b_obj_proj_left.project_sources(s_obj_1, clim=(1, 7), cmap=cmap)
sc.add_to_subplot(b_obj_proj_left,
                  row=0,
                  col=0,
                  rotate='left',
                  use_this_cam=True)

b_obj_proj_left = BrainObj(template_brain,
                           hemisphere='left',
                           translucent=False)
b_obj_proj_left.project_sources(s_obj_1, clim=(1, 7), cmap=cmap)
sc.add_to_subplot(b_obj_proj_left,
                  row=1,
                  col=0,
                  rotate='right',
                  use_this_cam=True)
Esempio n. 6
0
    sc = SceneObj(bgcolor='white', size=(1000, 1000))

    data1 = bo.get_data().values.ravel()
    xyz1 = bo.locs.values

    s_obj_1 = SourceObj('iEEG', xyz1, data=data1, cmap=cmap)
    s_obj_1.color_sources(data=data1)

    s_obj_all = s_obj_1

    b_obj_proj_left = BrainObj(template_brain,
                               hemisphere='left',
                               translucent=False)
    b_obj_proj_left.project_sources(s_obj_all,
                                    clim=(0, 1),
                                    cmap=cmap,
                                    radius=r)
    sc.add_to_subplot(b_obj_proj_left,
                      row=0,
                      col=0,
                      rotate='left',
                      use_this_cam=True)

    b_obj_proj_left = BrainObj(template_brain,
                               hemisphere='left',
                               translucent=False)
    b_obj_proj_left.project_sources(s_obj_all,
                                    clim=(0, 1),
                                    cmap=cmap,
                                    radius=r)
    sc.add_to_subplot(b_obj_proj_left,
Esempio n. 7
0
""")
b_obj_lw = BrainObj('white', hemisphere='left', translucent=False)
sc.add_to_subplot(b_obj_lw,
                  row=0,
                  col=1,
                  rotate='right',
                  title='Left hemisphere')
b_obj_rw = BrainObj('white', hemisphere='both', translucent=True)

# Define a source object and project data on the right hemisphere:
mat = np.load(download_file('xyz_sample.npz'))
xyz, subjects = mat['xyz'], mat['subjects']
data = np.random.rand(xyz.shape[0])
s_obj = SourceObj('Sources', xyz, data=data, cmap='inferno')
s_obj.color_sources(data=data)
b_obj_rw.project_sources(s_obj, cmap='viridis')
sc.add_to_subplot(s_obj, row=0, col=2)
sc.add_to_subplot(b_obj_rw,
                  row=0,
                  col=2,
                  rotate='left',
                  title='Right hemisphere',
                  use_this_cam=True)

print("""
# =============================================================================
#                   Parcellize the brain (using all parcellates)
# =============================================================================
""")
path_to_file1 = download_file('lh.aparc.a2009s.annot')
b_obj_parl = BrainObj('inflated', hemisphere='left', translucent=False)