task_list = [ 'archi_standard', 'archi_spatial', 'archi_social', 'archi_emotional', 'hcp_language', 'hcp_social', 'hcp_gambling', 'hcp_motor', 'hcp_emotion', 'hcp_relational', 'hcp_wm', 'rsvp_language' ] # BIDS conversion of task names # Load dictionary file with open(os.path.join('bids_postprocessed.json'), 'r') as f: task_dic = json.load(f) TASKS = [task_dic[tkey] for tkey in task_list] TASKS = flatten(TASKS) df = data_parser(derivatives=SMOOTH_DERIVATIVES, subject_list=SUBJECTS, conditions=CONTRASTS, task_list=TASKS) # Mask of the grey matter across subjects _package_directory = os.path.dirname( os.path.abspath(ibc_public.utils_data.__file__)) mask_gm = os.path.join(_package_directory, '../ibc_data', 'gm_mask_1_5mm.nii.gz') data_dir = SMOOTH_DERIVATIVES masker = NiftiMasker(mask_img=mask_gm, memory=write_dir).fit() def append_correlation(imgs, masker, correlations=[]): X = masker.transform(imgs) corr_matrix = np.triu(np.corrcoef(X), 1)
display_mode=display_mode, cut_coords=[cut], black_bg=True, annotate=False, dim=0, # title=subject, colorbar=False, view_type='filled_contours', linewidths=2.) axes.axis('off') fig.savefig(os.path.join(write_dir, 'snapshot_%s.pdf' % name), facecolor='k', dpi=300) # plt.close(fig) db = data_parser(derivatives=SMOOTH_DERIVATIVES, conditions=CONTRASTS) # db = db[db.task.isin(task_list)] mask_gm = nib.load(os.path.join(DERIVATIVES, 'group', 'anat', 'gm_mask.nii.gz')) masker = NiftiMasker(mask_img=mask_gm, memory=mem).fit() write_dir = 'output' if not os.path.exists(write_dir): os.mkdir(write_dir) """ task_contrast = [('archi_social', 'false_belief-mechanistic_video'), ('archi_social', 'false_belief-mechanistic_audio'), ('archi_social', 'triangle_mental-random'), ('hcp_social', 'mental-random')] plot_contrasts(db, task_contrast, masker, write_dir, cut=-50, display_mode='x', name='social')