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)
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) print 'singletons ',lens.count(1)