Exemplo n.º 1
0
def test_text():
    """Test plotting of text
    """
    mlab.options.backend = 'test'
    brain = Brain(*std_args)
    brain.add_text(0.1, 0.1, 'Hello', 'blah')
    brain.close()
Exemplo n.º 2
0
def test_text():
    """Test plotting of text
    """
    mlab.options.backend = 'test'
    brain = Brain(*std_args)
    brain.add_text(0.1, 0.1, 'Hello', 'blah')
    brain.close()
Exemplo n.º 3
0
def test_text():
    """Test plotting of text."""
    _set_backend('test')
    brain = Brain(*std_args)
    brain.add_text(0.1, 0.1, 'Hello', 'blah')
    brain.close()
Exemplo n.º 4
0
                  views=['lat'],
                  config_opts=dict(background="white", colorbar="False"))

    for r in sorted(rois):
        #   Name of ROI
        name_roi = os.path.splitext(os.path.basename(r))[0]
        #save_png= os.path.join(datadir, "{h}_{name_roi}".format(h=hemi, name_roi=name_roi))

        #   Manage the color
        color = [val / 255. for val in color_list[cpt_color]]

        #   Add a title
        pos_y += 0.05
        text = brain.add_text(0.1,
                              pos_y,
                              color=tuple(color),
                              text=name_roi,
                              name=name_roi)
        text = brain.texts[name_roi]
        text.width = 0.2

        #   Projection part
        #   If reg_file if needed:
        #   surf_data = io.project_volume_data(r, "lh", reg_file)
        #   Projection parameters, see the docstring for more information
        projmeth = "frac"  # frac' method, projection on a fraction of thickness
        projsum = "max"  # the max value is projected
        projarg = [0, 1, 0.1]  # from 0 to 1 thickness fract every 0.1 step
        smooth_fwhm = 0  # no smoothing
        surf_data = io.project_volume_data(r,
                                           hemi,
Exemplo n.º 5
0
    #  Surface used to project 'white', 'inflated' or other
    surf = "inflated" 
    brain = Brain("fsaverage", hemi, surf, views=['lat'],
                  config_opts=dict(background="white", colorbar="False")) 
                  
    for r in sorted(rois):  
    #   Name of ROI 
        name_roi = os.path.splitext(os.path.basename(r))[0]
        #save_png= os.path.join(datadir, "{h}_{name_roi}".format(h=hemi, name_roi=name_roi))
                
    #   Manage the color
        color = [val/255. for val in color_list[cpt_color]]

    #   Add a title 
        pos_y += 0.05
        text = brain.add_text(0.1, pos_y, color=tuple(color), 
                       text=name_roi, name=name_roi)
        text = brain.texts[name_roi]
        text.width = 0.2

    #   Projection part
    #   If reg_file if needed: 
    #   surf_data = io.project_volume_data(r, "lh", reg_file)
    #   Projection parameters, see the docstring for more information
        projmeth = "frac" # frac' method, projection on a fraction of thickness
        projsum = "max"   # the max value is projected
        projarg = [0, 1, 0.1] # from 0 to 1 thickness fract every 0.1 step
        smooth_fwhm = 0       # no smoothing  
        surf_data = io.project_volume_data(r, hemi,
                                          projmeth=projmeth,
                                          projsum=projsum, 
                                          projarg=projarg,
Exemplo n.º 6
0
def test_text():
    """Test plotting of text."""
    _set_backend('test')
    brain = Brain(*std_args)
    brain.add_text(0.1, 0.1, 'Hello', 'blah')
    brain.close()
Exemplo n.º 7
0
# =======================
#set time window to find peak within certain times
tmin=.00
tmax=.1
vertno_max, time_max = stc.get_peak(hemi='lh',tmin=tmin,tmax=tmax)
#also get indices
vertno_max_i, time_max_i = stc.get_peak(hemi='lh',tmin=tmin,tmax=tmax,vert_as_index=True, time_as_index=True)

#show peak on brain
surfer_kwargs = dict(
    subjects_dir=shared_dir, views='lateral',
    initial_time=time_max, time_unit='s', size=(800, 800), smoothing_steps=5)
brain = stc.plot(**surfer_kwargs)
brain.add_foci(vertno_max, coords_as_verts=True, hemi='lh', color='black',
               scale_factor=1, alpha=0.9)
brain.add_text(0.1, 0.9, 'Peak between '+str(tmin*1000)+' and '+str(tmax*1000)+' ms: '+str(round(time_max*1000))+' ms', 'title',font_size=14)

#take activation at only max time and see which sources should be included in peak, based on a cutoff
lh_data=stc.data[:len(stc.vertices[0])]; #right: stc.data[len(stc.vertices[1]:)]
max_data=lh_data[:,time_max_i]

#max_data=abs(max_data)
#take absolute? i guess not because I would just canel stuff out?
# so we have to distinguish if the max is a peak or a trough
#if lh_data[vertno_max_i,time_max_i]<0:
#    #max is trough
#    midway_in_value=max_data.min()+abs(max_data.min()-max_data.max())/2
#    midway_in_value_from0=max_data.min()-max_data.min()/2
#    cutoff=max_data.max()#midway_in_value_from0
#    #now find all sources where its above cutoff
#    source_mask=[]
Exemplo n.º 8
0





vertno_max, time_max = stc.get_peak(hemi='rh')

surfer_kwargs = dict(
    subjects_dir=shared_dir,
    clim=dict(kind='value', lims=[8, 12, 15]), views='lateral',
    initial_time=time_max, time_unit='s', size=(800, 800), smoothing_steps=5)
brain = stc.plot(**surfer_kwargs)
brain.add_foci(vertno_max, coords_as_verts=True, hemi='rh', color='blue',
               scale_factor=0.6, alpha=0.5)
brain.add_text(0.1, 0.9, 'dSPM (plus location of maximal activation)', 'title',
               font_size=14)




stc_vec = mne.minimum_norm.apply_inverse(erp, inverse_operator, 
                        method='MNE', pick_ori='vector')
brain = stc_vec.plot(**surfer_kwargs)
brain.add_text(0.1, 0.9, 'Vector solution', 'title', font_size=20)