def looping((sub, hemi, sess)): print 'running', sub, hemi, sess label_file = '/scr/ilz3/myelinconnect/all_data_on_simple_surf/labels/%s_%s_highres2lowres_labels.npy'%(sub, hemi) rest_file = '/scr/ilz3/myelinconnect/resting/final/%s_rest%s_denoised.nii.gz'%(sub, sess) highres_file = '/scr/ilz3/myelinconnect/struct/surf_%s/orig2func/rest%s/%s_%s_mid_groupavgsurf.vtk'%(hemi, sess, sub, hemi) data_file = '/scr/ilz3/myelinconnect/all_data_on_simple_surf/rest/%s_%s_rest%s_smooth_3.npy'%(sub, hemi, sess) # load data labels = np.load(label_file)[:,1] highres_v, highres_f, highres_d = read_vtk(highres_file) # sample resting state time series on highres mesh rest_highres = sample_volume(rest_file, highres_v) # average across highres vertices that map to the same lowres vertex rest_lowres = sample_simple(rest_highres, labels) # save data np.save(data_file, rest_lowres) if os.path.isfile(data_file): print sub+' '+hemi+' ' +sess+' finished' return data_file
def looping((sub, hemi)): highres_file = '/scr/ilz3/myelinconnect/struct/surf_%s/prep_t1/profiles/%s_%s_mid_proflies.vtk'%(hemi, sub, hemi) label_file = '/scr/ilz3/myelinconnect/all_data_on_simple_surf/labels/%s_%s_highres2lowres_labels.npy'%(sub, hemi) old_lowres_file = '/scr/ilz3/myelinconnect/groupavg/indv_space/%s/lowres_%s_d_def.vtk'%(sub, hemi) new_lowres_file = '/scr/ilz3/myelinconnect/all_data_on_simple_surf/t1/raw/%s_%s_profiles_raw.vtk'%(sub, hemi) data_file = '/scr/ilz3/myelinconnect/all_data_on_simple_surf/t1/raw/%s_%s_profiles_raw.npy'%(sub, hemi) cheb_file = '/scr/ilz3/myelinconnect/all_data_on_simple_surf/t1/raw/%s_%s_coeff_raw.npy'%(sub, hemi) cheb_vtk_file = '/scr/ilz3/myelinconnect/all_data_on_simple_surf/t1/raw/%s_%s_coeff_raw.vtk'%(sub, hemi) # load data labels = np.load(label_file)[:,1] highres_v, highres_f, highres_d = read_vtk(highres_file) lowres_v, lowres_f, lowres_d = read_vtk(old_lowres_file) # call to sampling function new_lowres_d = sample_simple(highres_d, labels) # save lowres vtk and txt write_vtk(new_lowres_file, lowres_v, lowres_f, data=new_lowres_d) np.save(data_file, new_lowres_d) # calculate chebychev coefficients t1_3_7 = new_lowres_d[:,3:8] coeff, poly = chebapprox(t1_3_7, degree=4) np.save(cheb_file, coeff) write_vtk(cheb_vtk_file, lowres_v, lowres_f, data=coeff) if os.path.isfile(data_file): print sub+' '+hemi+' finished' return
def looping((sub, hemi)): highres_file = '/scr/ilz3/myelinconnect/struct/surf_%s/prep_t1/profiles/%s_%s_mid_proflies.vtk'%(hemi, sub, hemi) label_file = '/scr/ilz3/myelinconnect/all_data_on_simple_surf/labels/%s_%s_highres2lowres_labels.npy'%(sub, hemi) old_lowres_file = '/scr/ilz3/myelinconnect/groupavg/indv_space/%s/lowres_%s_d_def.vtk'%(sub, hemi) new_lowres_file = '/scr/ilz3/myelinconnect/all_data_on_simple_surf/t1/%s_%s_profiles.vtk'%(sub, hemi) data_file = '/scr/ilz3/myelinconnect/all_data_on_simple_surf/t1/%s_%s_profiles.npy'%(sub, hemi) # load data labels = np.load(label_file)[:,1] highres_v, highres_f, highres_d = read_vtk(highres_file) lowres_v, lowres_f, lowres_d = read_vtk(old_lowres_file) # call to sampling function new_lowres_d = sample_simple(highres_d, labels) # save lowres vtk and txt #write_vtk(new_lowres_file, lowres_v, lowres_f, data=new_lowres_d) np.save(data_file, new_lowres_d) if os.path.isfile(data_file): print sub+' '+hemi+' finished' return
for hemi in hemis: n_vertices = np.load(label_file%(subjects[0], hemi))[:,1].max()+1 tsnr = np.zeros((n_vertices, len(subjects)*len(sessions))) inv2prob = np.zeros((n_vertices, len(subjects))) inv2prob_count = 0 tsnr_count = 0 for sub in subjects: labels = np.load(label_file%(sub, hemi))[:,1] inv2prob_highres_v, inv2prob_highres_f, inv2prob_highres_d = read_vtk(inv2prob_highres_file%(sub, hemi)) # average across highres vertices that map to the same lowres vertex inv2prob[:,inv2prob_count] = np.squeeze(sample_simple(inv2prob_highres_d, labels)) inv2prob_count += 1 for sess in sessions: print sub, sess highres_func_v, highres_func_f, highres_func_d = read_vtk(highres_func_file%(hemi, sess, sub, hemi)) # sample resting state time series on highres mesh tsnr_highres = sample_volume(tsnr_file%(sub, sess, sub, sess), highres_func_v) # average across highres vertices that map to the same lowres vertex tsnr[:,tsnr_count] = np.squeeze(sample_simple(tsnr_highres[:,np.newaxis], labels))