Exemplo n.º 1
0
def see_spherical_intersections(fdpy,fsr):
    
    dpr=Dpy(fdpy,'r')
    T=dpr.read_tracks()
    dpr.close()
    
    SR=load_pickle(fsr)
    
    r=fvtk.ren()
    
    for key in SR:
        ind=SR[key]['indices']
        intersT=[T[i] for i in ind]
        fvtk.add(r,fvtk.line(intersT,np.random.rand(3)))    
        centerw=SR[key]['centerw']
        radius=SR[key]['radiusw']
        fvtk.add(r,fvtk.sphere(position=centerw,radius=radius))
        
    fvtk.show(r)
Exemplo n.º 2
0
mapping12_best = load_pickle(map_best_fn)
mapping12_coregistration_1nn = load_pickle(map_1nn_fn)


mapped_tract = extract_mapped_tract(s_idx, tractography2, mapping12_best)#[:-num_pro])



ROIs = ROIs_subject[t_sub]
#only for converting from LPS to LAS
#ROIs = [[r[0],128.-r[1],r[2]] for r in ROIs]

common = intersec_ROIs(mapped_tract, ROIs, Rs, vis=True)

print "\t The number of fibers through the ROIs ", len(common)
#print "Done evaluate using ROIs"

#visualize target cst and mapped source cst - yellow and blue
if (args.inputVisualize==1):
    ren1 = fvtk.ren()
    #target_cst_only = load_tract_trk(t_file,t_cst)
    target_cst_only = load_tract(t_file,t_cst)
    ren1 = visualize_tract(ren1, target_cst_only, fvtk.yellow)
    #ren1 = visualize_mapped(ren1, tractography2, mapping12_best[:- num_pro], fvtk.blue)
    ren1 = visualize_mapped(ren1, tractography2, mapping12_best[:-50], fvtk.blue)
    fvtk.add(ren1, fvtk.sphere(ROIs[0],Rs[0],color = fvtk.red, opacity=1.0)) 
    fvtk.add(ren1, fvtk.sphere(ROIs[1],Rs[1],color = fvtk.blue, opacity=1.0)) 
    fvtk.show(ren1)
    
Exemplo n.º 3
0
             
             #s_tracts = '/home/bao/tiensy/Tractography_Mapping/data/' + source + '_tracks_dti_3M_linear.dpy'
             s_tracts = '/home/bao/tiensy/Tractography_Mapping/data/' + source + '_tracks_dti_3M.dpy'
             s_idx = '/home/bao/tiensy/Tractography_Mapping/data/' + source + '_corticospinal_L_3M.pkl'    
             #s_cst = load_tract_trk(s_tracts,s_idx)      
             s_cst = load_tract(s_tracts,s_idx)  
             
             #t_tracts = '/home/bao/tiensy/Tractography_Mapping/data/' + target + '_tracks_dti_3M_linear.dpy'
             t_tracts = '/home/bao/tiensy/Tractography_Mapping/data/' + target + '_tracks_dti_3M.dpy'
             t_idx = '/home/bao/tiensy/Tractography_Mapping/data/' + target + '_corticospinal_L_3M.pkl'            
             #t_cst = load_tract_trk(t_tracts,t_idx)      
             t_cst = load_tract(t_tracts,t_idx) 
             print d1, sphere_inter_1, d2, sphere_inter_2
             ren = fvtk.ren()       
             ren = visualize_tract(ren,s_cst,fvtk.red)
             fvtk.add(ren, fvtk.sphere(s_ROIs[0],Rs[0],color = fvtk.yellow, opacity=1.0))
             fvtk.add(ren, fvtk.sphere(s_ROIs[1],Rs[1],color = fvtk.white, opacity=1.0))
             ren = visualize_tract(ren, t_cst, fvtk.blue)
             fvtk.add(ren, fvtk.sphere(t_ROIs[0],Rs[0],color = fvtk.blue, opacity=1.0)) 
             fvtk.add(ren, fvtk.sphere(t_ROIs[1],Rs[1],color = fvtk.blue, opacity=1.0)) 
             fvtk.show(ren)
     else:
         print '  '
 #print np.array(dis_1,dtype=np.float)
 #print np.array(intersec_1,dtype=np.float)
 #print np.array(dis_2,dtype=np.float)
 #print np.array(intersec_2,dtype=np.float)
 #print dis_1
 #print intersec_1
 #print dis_2
 #print intersec_2