def render_tracks(self): """ Renders the tracks in a separate window using DiPy Fos """ from cviewer.libs.dipy.viz import fos if not self.data_loaded: self.load_trackfile() # copy tracks for visualization T = [i[0] for i in self.streams] r=fos.ren() fos.add(r,fos.line(T,fos.white,opacity=0.1)) fos.show(r)
def render_tracks(self): """ Renders the tracks in a separate window using DiPy Fos """ from cviewer.libs.dipy.viz import fos if not self.loaded: self.load() # copy tracks for visualization T = [i[0] for i in self.obj.data[0]] r = fos.ren() fos.add(r, fos.line(T, fos.white, opacity=0.8)) fos.show(r)
tracks=[tm.downsample(t,3) for t in T] print 'Deleting unnecessary data...' del streams,hdr print 'Hidden Structure Clustering...' now=time.clock() C=pf.local_skeleton_clustering(tracks,d_thr=20) print 'Done in', time.clock()-now,'s.' print 'Reducing the number of points...' T=[pf.approximate_ei_trajectory(t) for t in T] print 'Showing initial dataset.' r=fos.ren() fos.add(r,fos.line(T,fos.white,opacity=0.1)) fos.show(r) print 'Showing dataset after clustering.' fos.clear(r) colors=np.zeros((len(T),3)) for c in C: color=np.random.rand(1,3) for i in C[c]['indices']: colors[i]=color fos.add(r,fos.line(T,colors,opacity=1)) fos.show(r) print 'Some statistics about the clusters' lens=[len(C[c]['indices']) for c in C] print 'max ',max(lens), 'min ',min(lens)
t3=time.clock() print ('Generate QA in %d secs' %(t3-t2)) T=tp.FACT_Delta(gqs.QA,gqs.IN,seeds_no=10000).tracks t4=time.clock() print ('Create %d QA tracks in %d secs' %(len(T),t4-t3)) #calculate single tensor ten=dt.Tensor(data,bvals,gradients,thresh=50) t5=time.clock() print('Create FA in %d secs' %(t5-t4)) T2=tp.FACT_Delta(ten.FA,ten.IN,seeds_no=10000,qa_thr=0.2).tracks t6=time.clock() print ('Create %d FA tracks in %d secs' %(len(T2),t6-t5)) T2=[t+np.array([100,0,0]) for t in T2] print('Red tracks propagated based on QA') print('Green tracks propagated based on FA') r=fos.ren() fos.add(r,fos.line(T,fos.red)) fos.add(r,fos.line(T2,fos.green)) fos.show(r)