def show(): #brains=[(1,1),(1,2),(2,1),(3,1),(3,2)] brains=[(1,1),(2,1),(3,1)] ids=tl.emi_atlas() #print ids.keys() for (b,s) in brains: ids2 = pbc.load_pickle(path+'/Relabelling_8_sc1_'+str(b)+'_'+str(s)+'.pkl') #'/Relabelling_8_sc1_'+str(b)+'_'+str(s)+'.pkl' print b,s, ids2.keys() tracks = pbc.load_approximate_tracks(path,b,s) for i in ids: if i >0: r=fos.ren() color=np.array(ids[i]['color']) indices=ids2[i]['indices'] bundle=[tracks[ind] for ind in indices] fos.add(r,fos.line(bundle,color,opacity=0.9)) print 'Bundle_name',i,ids[i]['bundle_name'] fos.show(r,title=ids[i]['bundle_name'][0])
import pbc import numpy as np import pbc1109 from pbc1109 import track_volumes as tv from dipy.viz import fos from dipy.core import track_metrics as tm from dipy.core import track_learning as tl from dipy.core import performance as pf from itertools import combinations #--------------------------------------------------------------------------------------------------------------------------------------------- path='/home/eg01/Data/PBC/pbc2009icdm' #--------------------------------------------------------------------------------------------------------------------------------------------- ids=tl.emi_atlas() #--------------------------------------------------------------------------------------------------------------------------------------------- def load_template_tes_and_tracks(path,brain,scan): volpath=path+'/ICBM_WMPM_tweaked_'+str(brain) +'_'+str(scan)+'.nii' print volpath template,voxsz,aff=pbc.loadvol(volpath) tracks=pbc.load_approximate_tracks(path,brain,scan) print 'template shape', template.shape tcs,tes = tv.track_counts(tracks, template.shape, vox_sizes=(1,1,1), return_elements=True) print 'tcs shape', tcs.shape return template,tcs,tes,tracks #--------------------------------------------------------------------------------------------------------------------------------------------- def for_a_value_in_template(template,value,tes,tracks):