#T=T[:1000] print 'Representing tracks using only 3 pts...' tracks=[tm.downsample(t,3) for t in T] print 'Deleting unnecessary data...' del streams,hdr print 'Local Skeleton 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.approx_polygon_track(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) data=T colors =[np.tile(np.array([1,1,1,opacity],'f'),(len(t),1)) for t in T] t=Tracks(data,colors,line_width=1.)
frame = make_window_maker(trajs, colors)() app.MainLoop() del frame del app if __name__ == "__main__": #trajs=[100*np.random.rand(10,3),100*np.random.rand(20,3)] #colors=[np.random.rand(3,),np.random.rand(3,)] from dipy.io import trackvis as tv from dipy.core import track_performance #from enthought.mayavi import mlab #from enthought.tvtk.api import tvtk import numpy as np fname='/home/eg309/Data/PBC/pbc2009icdm/brain1/brain1_scan1_fiber_track_mni.trk' lines, hdr = tv.read(fname) pts = [p[0] for p in lines] pts_reduced = [track_performance.approx_polygon_track(p) for p in pts] red = np.array([1,0,0]) trajs=pts_reduced colors=[np.array([1.,0,0]) for i in range(len(trajs))] show(trajs)
#T=T[:1000] print 'Representing tracks using only 3 pts...' tracks = [tm.downsample(t, 3) for t in T] print 'Deleting unnecessary data...' del streams, hdr print 'Local Skeleton 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.approx_polygon_track(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) data = T colors = [np.tile(np.array([1, 1, 1, opacity], 'f'), (len(t), 1)) for t in T] t = Tracks(data, colors, line_width=1.) t.position = (-100, 0, 0)
app = wx.PySimpleApp() frame = make_window_maker(trajs, colors)() app.MainLoop() del frame del app if __name__ == "__main__": #trajs=[100*np.random.rand(10,3),100*np.random.rand(20,3)] #colors=[np.random.rand(3,),np.random.rand(3,)] from dipy.io import trackvis as tv from dipy.core import track_performance #from enthought.mayavi import mlab #from enthought.tvtk.api import tvtk import numpy as np fname = '/home/eg309/Data/PBC/pbc2009icdm/brain1/brain1_scan1_fiber_track_mni.trk' lines, hdr = tv.read(fname) pts = [p[0] for p in lines] pts_reduced = [track_performance.approx_polygon_track(p) for p in pts] red = np.array([1, 0, 0]) trajs = pts_reduced colors = [np.array([1., 0, 0]) for i in range(len(trajs))] show(trajs)