Esempio n. 1
0
"""Create the connectivity object :
"""
c_obj = ConnectObj('ConnectObj1',
                   xyz,
                   connect,
                   color_by='strength',
                   cmap='Greys',
                   vmin=small_weight_threshold,
                   vmax=large_weight_threshold,
                   under='blue',
                   over='red',
                   antialias=True)
"""Finally, pass source and connectivity objects to Brain :
"""
vb = Brain(source_obj=s_obj, connect_obj=c_obj)
vb.brain_control(alpha=0.1, hemisphere='both')

rotation = 'axial_0'
vb.rotate('axial_0')  # top
#vb.rotate('axial_1') #bottom
#vb.rotate('sagittal_0') # left
#vb.rotate('sagittal_1') # right
#vb.rotate('coronal_0') # front
#vb.rotate('coronal_1') # back

# Save the brain
vb.screenshot('main2.png',
              canvas='main',
              print_size=(10, 20),
              dpi=300,
              autocrop=True)
Esempio n. 2
0
                   vmin=0.,
                   vmax=10.,
                   dynamic=(.1, 1.))
vb.screenshot('count.png', autocrop=True)

# ============= Projection =============
vb.connect_control(show=False)
vb.sources_display('all')
vb.cortical_repartition(cmap='viridis',
                        clim=(1., 6.),
                        vmin=2.,
                        under='gray',
                        vmax=4.,
                        over='#ab4642',
                        radius=16.)
vb.brain_control(transparent=False)
vb.sources_opacity(show=False)
vb.rotate(custom=(-125., 0.))
vb.screenshot('repartition.jpg', autocrop=True)

vb.sources_display('all')
vb.roi_control(selection=[4, 6], roi_type='Brodmann', smooth=5)
vb.cortical_projection(project_on='roi',
                       radius=12.,
                       cmap='inferno',
                       clim=(.1, .5),
                       vmin=0.,
                       vmax=6.)
vb.sources_display('none')
vb.brain_control(template='B3')
vb.brain_control(transparent=True)
Esempio n. 3
0
"""Pass the brain, source and ROI object to the GUI
"""
vb = Brain(brain_obj=b_obj, source_obj=s_obj, roi_obj=roi_obj)

"""Render the scene and save the jpg picture with a 300dpi
"""
save_as = os.path.join(save_pic_path, '0_main_brain.jpg')
vb.screenshot(save_as, dpi=300, print_size=(10, 10), autocrop=True)

"""Project source's activity onto the surface
"""
vb.cortical_projection(clim=(0, 50), cmap='Spectral_r', vmin=10.1,
                       under='black', vmax=41.2, over='green')
vb.sources_control('Sobj', visible=False)        # Hide sources
vb.rotate(custom=(-160., 10.))                   # Rotate the brain
vb.brain_control(translucent=False)              # Make the brain opaque

"""Now, we take a screenthot of the scene but this time, we used the
autocrop argument to crop the image as close as possible to the brain.

Then, we used the print_size, dpi and unit inputs to get higher resolution
image.
Taken together, this mean that the image should have a sufficient size to be
(20 centimeters x 20 centimeters) at 300 dpi.
"""
save_as = os.path.join(save_pic_path, '1_proj_brain.tiff')
vb.screenshot(save_as, autocrop=True, print_size=(20, 20),
              unit='centimeter', dpi=300.)

"""Colorbar screenshot
Esempio n. 4
0
vb.sources_display('none')
vb.connect_control(show=True, cmap='magma', colorby='density', clim=(0., 35.),
                   vmin=10., vmax=30., under='gray', over='darkred',
                   dynamic=(.7, 1.))
vb.screenshot('density.png', autocrop=True)
# Color by number of connections per node :
vb.connect_control(show=True, cmap='viridis', colorby='count', clim=(1., 5.),
                   vmin=0., vmax=10., dynamic=(.1, 1.))
vb.screenshot('count.png', autocrop=True)

# ============= Projection =============
vb.connect_control(show=False)
vb.sources_display('all')
vb.cortical_repartition(cmap='viridis', clim=(1., 6.), vmin=2., under='gray',
                        vmax=4., over='#ab4642', radius=16.)
vb.brain_control(transparent=False)
vb.sources_opacity(show=False)
vb.rotate(custom=(-125., 0.))
vb.screenshot('repartition.jpg', autocrop=True)

vb.sources_display('all')
vb.roi_control(selection=[4, 6], roi_type='Brodmann', smooth=5)
vb.cortical_projection(project_on='roi', radius=12., cmap='inferno',
                       clim=(.1, .5), vmin=0., vmax=6.)
vb.sources_display('none')
vb.brain_control(template='B3')
vb.brain_control(transparent=True)
vb.rotate('coronal')
vb.screenshot('roi.jpg', autocrop=True)

vb.show()
Esempio n. 5
0
vb = Brain(brain_obj=b_obj, source_obj=s_obj, roi_obj=roi_obj)
"""Render the scene and save the jpg picture with a 300dpi
"""
save_as = os.path.join(save_pic_path, '0_main_brain.jpg')
vb.screenshot(save_as, dpi=300, print_size=(10, 10), autocrop=True)
"""Project source's activity onto the surface
"""
vb.cortical_projection(clim=(0, 50),
                       cmap='Spectral_r',
                       vmin=10.1,
                       under='black',
                       vmax=41.2,
                       over='green')
vb.sources_control('Sobj', visible=False)  # Hide sources
vb.rotate(custom=(-160., 10.))  # Rotate the brain
vb.brain_control(translucent=False)  # Make the brain opaque
"""Now, we take a screenthot of the scene but this time, we used the
autocrop argument to crop the image as close as possible to the brain.

Then, we used the print_size, dpi and unit inputs to get higher resolution
image.
Taken together, this mean that the image should have a sufficient size to be
(20 centimeters x 20 centimeters) at 300 dpi.
"""
save_as = os.path.join(save_pic_path, '1_proj_brain.tiff')
vb.screenshot(save_as,
              autocrop=True,
              print_size=(20, 20),
              unit='centimeter',
              dpi=300.)
"""Colorbar screenshot