예제 #1
0
파일: figure_2.py 프로젝트: mhturner/SC-FC
from matplotlib.patches import Patch
import matplotlib.colors

from scipy.spatial.distance import pdist
from seriate import seriate


from scfc import bridge, anatomical_connectivity, functional_connectivity, plotting
import matplotlib
from matplotlib import rcParams
rcParams.update({'font.size': 12})
rcParams.update({'axes.spines.right': False})
rcParams.update({'axes.spines.top': False})
rcParams['svg.fonttype'] = 'none'  # let illustrator handle the font type

data_dir = bridge.getUserConfiguration()['data_dir']
analysis_dir = bridge.getUserConfiguration()['analysis_dir']

plot_colors = plt.get_cmap('tab10')(np.arange(8)/8)
save_dpi = 400

# %% Eg region traces and cross corrs
pull_regions = ['AL_R', 'CAN_R', 'LH_R', 'SPS_R']

include_inds_ito, name_list_ito = bridge.getItoNames()

display_names = [x.replace('_R', '(R)').replace('_L', '(L)').replace('_', '') for x in name_list_ito]

pull_inds = [np.where(np.array(name_list_ito) == x)[0][0] for x in pull_regions]

resp_fp = os.path.join(data_dir, 'ito_responses', 'ito_2018-11-03_5.pkl')
예제 #2
0
import os
import glob
import nibabel as nib
import numpy as np
import pandas as pd
import time
import sys

from scfc import functional_connectivity, bridge

atlas_id = sys.argv[1] # name of atlas to use: ito or branson

t_total_0 = time.time()

data_dir = bridge.getUserConfiguration()['data_dir']

brain_filepaths = glob.glob(os.path.join(data_dir, 'brain_files', 'func_volreg') + '*')

for brain_fp in brain_filepaths:
    t0 = time.time()
    suffix = brain_fp.split('func_volreg_')[-1]
    if atlas_id == 'ito':
        atlas_fp = os.path.join(data_dir, 'ito_68_atlas', 'vfb_68_' + suffix)
    elif atlas_id == 'branson':
        atlas_fp = os.path.join(data_dir, 'branson_999_atlas', 'vfb_999_' + suffix)
    else:
        print('Unrecognized atlas ID')

    mask_brain = np.asarray(np.squeeze(nib.load(atlas_fp).get_fdata()), 'uint16')
    functional_brain = np.asanyarray(nib.load(brain_fp).dataobj).astype('uint16')