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
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)) tsnr_count += 1 print 'saving' #save the minimum snr across all subjects and sessions np.save(tsnr_full_file%(hemi), tsnr) np.save(tsnr_min_file%(hemi), np.min(tsnr, axis=1)) np.save(inv2prob_full_file%(hemi), inv2prob) np.save(inv2prob_min_file%(hemi), np.min(inv2prob, axis=1))