def load_trackfile(self): """ Loads the trackfile data and header using DiPy IO Returns ------- Boolean: Successfull or not """ from cviewer.libs.dipy.io import trackvis as tv fname = self.load_trackfile_to_file() try: self.streams, self.hdr = tv.read(fname) except HeaderError: return False self.data_loaded = True return True
from cviewer.libs.dipy.io import trackvis as tv from cviewer.libs.dipy.io import pickles as pkl from cviewer.libs.dipy.core import track_performance as pf from cviewer.libs.dipy.core import track_metrics as tm from cviewer.libs.dipy.viz import fos import time import numpy as np # choose your file fname='your_file_here.trk' print 'Loading file...' streams,hdr=tv.read(fname) print 'Copying tracks...' T=[i[0] for i in streams] # not take all of them for speed 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 'Hidden Structure Clustering...' now=time.clock() C=pf.local_skeleton_clustering(tracks,d_thr=20) print 'Done in', time.clock()-now,'s.'