Example #1
0
seed = 10000
map = full_dist[seed]
map[fullmask] = 0
vmin = 0
vmax = 160

cropped_img = []
sns.set_style('white')
for (elev, azim) in [(180, 0), (180, 180)]:
    plot = plot_surf_stat_map(lv,
                              lf,
                              stat_map=map[:lv.shape[0]],
                              bg_map=lh_sulc,
                              bg_on_stat=True,
                              darkness=0.4,
                              elev=elev,
                              azim=azim,
                              figsize=(10, 9),
                              threshold=1e-50,
                              cmap='Reds_r',
                              symmetric_cbar=False,
                              vmin=vmin,
                              vmax=vmax)
    cropped_img.append(crop_img(plot))

for (elev, azim) in [(180, 0), (180, 180)]:
    plot = plot_surf_stat_map(rv,
                              rf,
                              stat_map=map[lv.shape[0]:],
                              bg_map=rh_sulc,
                              bg_on_stat=True,
                              darkness=0.4,
Example #2
0
# load aligned
A_init = h5py.File('/nobackup/kocher1/bayrak/tmp/realigned_full_n10_468.h5', 'r')
A = np.array(A_init.get('aligned'))

# load sulc
D_in = h5py.File('/nobackup/kocher1/bayrak/tmp/sulc_full_468.h5', 'r')
D = np.array(D_in.get('sulc'))

# get first component
A = A[:,:,0]

# Correlate two datasets
C = []
for i in range(np.shape(A)[1]):
    # covariance of one region (over subjects) in two datasets
    C.append(np.cov(A[:,i],D[:,i])[0][1])
    print i
C = np.array(C)


# Vizualize data:
data = np.zeros(len(vertices))
data[ind] = C
plt = plotting.plot_surf_stat_map(vertices, triangles, stat_map=data, azim=0)
plt = plotting.plot_surf_stat_map(vertices, triangles, stat_map=data, azim=90)
plt = plotting.plot_surf_stat_map(vertices, triangles, stat_map=data, azim=180)
plt = plotting.plot_surf_stat_map(vertices, triangles, stat_map=data, azim=270)
plt.show()

  
     #embedding_file = '/scr/ilz3/myelinconnect/all_data_on_simple_surf/embed/profiles/%s_smooth_3_embedding_10_%s.npy' % (hemi, method)
     #fig_file = '/scr/ilz3/myelinconnect/all_data_on_simple_surf/embed/figs/profiles_%s_%s_comp%s.png'
     embedding_file = '/scr/ilz3/myelinconnect/all_data_on_simple_surf/embed/coefficients/%s_smooth_3_embedding_10_%s.npy' % (hemi, method)
     fig_file = '/scr/ilz3/myelinconnect/all_data_on_simple_surf/embed/figs/coefficients_%s_%s_comp%s.png'
         
     v, f, d = read_vtk(mesh_file)
     data = np.load(embedding_file)
     sulc = np.load(sulc_file)
 
     for e in range(10):
         
         print method, hemi, e
         
         if hemi == 'lh':
             sns.set_style('white')
             lat=plot_surf_stat_map(v, f, stat_map=data[:,e], bg_map=sulc, bg_on_stat=True,
                                 elev=180,azim=180, figsize=(14,10), darkness=0.3)
 
             sns.set_style('white')
             med=plot_surf_stat_map(v, f, stat_map=data[:,e], bg_map=sulc, bg_on_stat=True,
                     elev=180,azim=0, figsize=(14,10), darkness=0.3)
             
             
         elif hemi == 'rh':
             sns.set_style('white')
             lat=plot_surf_stat_map(v, f, stat_map=data[:,e], bg_map=sulc, bg_on_stat=True,
                                 elev=180,azim=0, figsize=(11,10), darkness=0.4)
     
             sns.set_style('white')
             med=plot_surf_stat_map(v, f, stat_map=data[:,e], bg_map=sulc, bg_on_stat=True,
                     elev=180,azim=180, figsize=(11,10), darkness=0.4)
 
Example #4
0
        print "OVERLAP"
    

    x[n_lh[index]] = L1[n_lh[index]]       
    x[n_lh[index_neg]] = -1 * L2[n_lh[index_neg]]

    print np.shape(index)[1], np.shape(index_neg)[1]

    
    if np.shape(index)[1] != 0 and np.shape(index_neg)[1] != 0:

        x[np.where(x==1)] = x[n_lh[index]].max() + 0.001

        
        plotting.plot_surf_stat_map(vertices_lh, triangles_lh, fig_number, 
                                    '221', stat_map = x, cmap='jet', azim=180, 
                                    threshold=x[n_lh[index]].max(), 
                                    figsize=(14, 10))
    
        plotting.plot_surf_stat_map(vertices_lh, triangles_lh, fig_number, 
                                    '223', stat_map = x, cmap='jet', azim=0, 
                                    threshold=x[n_lh[index]].max(), 
                                    figsize=(14, 10))
                               
    del index, index_neg

    y = np.ones(len(vertices_rh))        
    index = np.where(R1[n_rh] < 0.05)
    index_neg = np.where(R2[n_rh] < 0.05)
    if set(index[0]).intersection(index_neg[0]).__len__() != 0:
        print "OVERLAP" 
Example #5
0
#DATA = h5py.File(path + '468_embeddings.h5', 'r')
#mode = 'embedding'

# plot subjects individually
for subject_id in subject_list[args.begin : args.end]:
    ## chose subject_id randomly     
    #subject_id = choose_random_subject(subject_list)
    #subject_id = '100307'
    subject_id = ''.join(subject_id)
    print subject_id
    component = None
    subject_component = choose_component(DATA, subject_id, mode, component)
    data = np.zeros(len(vertices))
    data[n] = subject_component
    plotting.plot_surf_stat_map(vertices, triangles, stat_map=data, cmap='jet', azim=0)
    plt.title(subject_id + ' , component 1' )
    plt.savefig(path_out + subject_id + '_comp_01' + '_000.png')
    plotting.plot_surf_stat_map(vertices, triangles, stat_map=data, cmap='jet', azim=180)   
    plt.title(subject_id + ' , component 1' )
    plt.savefig(path_out + subject_id + '_comp_01' + '_180.png')
    #plt.show()
 	
# save out group level results...
#tmp_list = []

# plot a component over all subjects
#components = np.arange(0, 10, 1)
#for component in components:
    #tmp = get_mean(DATA, subject_list, mode, component)