In [76]:
from pathlib import Path
import copy
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
from neuromaps.datasets import available_annotations, fetch_annotation, fetch_fslr, fetch_fsaverage, fetch_civet
from neuromaps.images import load_gifti, load_nifti
In [46]:
figs_dir = Path("./figures/")
In [8]:
available_annotations()
Out[8]:
[('abagen', 'genepc1', 'fsaverage', '10k'),
('aghourian2017', 'feobv', 'MNI152', '1mm'),
('alarkurtti2015', 'raclopride', 'MNI152', '3mm'),
('bedard2019', 'feobv', 'MNI152', '1mm'),
('beliveau2017', 'az10419369', 'MNI152', '1mm'),
('beliveau2017', 'az10419369', 'fsaverage', '164k'),
('beliveau2017', 'cimbi36', 'MNI152', '1mm'),
('beliveau2017', 'cimbi36', 'fsaverage', '164k'),
('beliveau2017', 'cumi101', 'MNI152', '1mm'),
('beliveau2017', 'cumi101', 'fsaverage', '164k'),
('beliveau2017', 'dasb', 'MNI152', '1mm'),
('beliveau2017', 'dasb', 'fsaverage', '164k'),
('beliveau2017', 'sb207145', 'MNI152', '1mm'),
('beliveau2017', 'sb207145', 'fsaverage', '164k'),
('castrillon2023', 'cmrglc', 'MNI152', '3mm'),
('ding2010', 'mrb', 'MNI152', '1mm'),
('dubois2015', 'abp688', 'MNI152', '1mm'),
('dukart2018', 'flumazenil', 'MNI152', '3mm'),
('dukart2018', 'fpcit', 'MNI152', '3mm'),
('fazio2016', 'madam', 'MNI152', '3mm'),
('finnema2016', 'ucbj', 'MNI152', '1mm'),
('gallezot2010', 'p943', 'MNI152', '1mm'),
('gallezot2017', 'gsk189254', 'MNI152', '1mm'),
('hcps1200', 'megalpha', 'fsLR', '4k'),
('hcps1200', 'megbeta', 'fsLR', '4k'),
('hcps1200', 'megdelta', 'fsLR', '4k'),
('hcps1200', 'meggamma1', 'fsLR', '4k'),
('hcps1200', 'meggamma2', 'fsLR', '4k'),
('hcps1200', 'megtheta', 'fsLR', '4k'),
('hcps1200', 'megtimescale', 'fsLR', '4k'),
('hcps1200', 'myelinmap', 'fsLR', '32k'),
('hcps1200', 'thickness', 'fsLR', '32k'),
('hesse2017', 'methylreboxetine', 'MNI152', '3mm'),
('hill2010', 'devexp', 'fsLR', '164k'),
('hill2010', 'evoexp', 'fsLR', '164k'),
('hillmer2016', 'flubatine', 'MNI152', '1mm'),
('jaworska2020', 'fallypride', 'MNI152', '1mm'),
('kaller2017', 'sch23390', 'MNI152', '3mm'),
('kantonen2020', 'carfentanil', 'MNI152', '3mm'),
('laurikainen2018', 'fmpepd2', 'MNI152', '1mm'),
('margulies2016', 'fcgradient01', 'fsLR', '32k'),
('margulies2016', 'fcgradient02', 'fsLR', '32k'),
('margulies2016', 'fcgradient03', 'fsLR', '32k'),
('margulies2016', 'fcgradient04', 'fsLR', '32k'),
('margulies2016', 'fcgradient05', 'fsLR', '32k'),
('margulies2016', 'fcgradient06', 'fsLR', '32k'),
('margulies2016', 'fcgradient07', 'fsLR', '32k'),
('margulies2016', 'fcgradient08', 'fsLR', '32k'),
('margulies2016', 'fcgradient09', 'fsLR', '32k'),
('margulies2016', 'fcgradient10', 'fsLR', '32k'),
('mueller2013', 'intersubjvar', 'fsLR', '164k'),
('naganawa2020', 'lsn3172176', 'MNI152', '1mm'),
('neurosynth', 'cogpc1', 'MNI152', '2mm'),
('norgaard2021', 'flumazenil', 'MNI152', '1mm'),
('norgaard2021', 'flumazenil', 'fsaverage', '164k'),
('normandin2015', 'omar', 'MNI152', '1mm'),
('radnakrishnan2018', 'gsk215083', 'MNI152', '1mm'),
('raichle', 'cbf', 'fsLR', '164k'),
('raichle', 'cbv', 'fsLR', '164k'),
('raichle', 'cmr02', 'fsLR', '164k'),
('raichle', 'cmrglc', 'fsLR', '164k'),
('reardon2018', 'scalinghcp', 'civet', '41k'),
('reardon2018', 'scalingnih', 'civet', '41k'),
('reardon2018', 'scalingpnc', 'civet', '41k'),
('rosaneto', 'abp688', 'MNI152', '1mm'),
('sandiego2015', 'flb457', 'MNI152', '1mm'),
('sasaki2012', 'fepe2i', 'MNI152', '1mm'),
('satterthwaite2014', 'meancbf', 'MNI152', '1mm'),
('savli2012', 'altanserin', 'MNI152', '3mm'),
('savli2012', 'dasb', 'MNI152', '3mm'),
('savli2012', 'p943', 'MNI152', '3mm'),
('savli2012', 'way100635', 'MNI152', '3mm'),
('smart2019', 'abp688', 'MNI152', '1mm'),
('smith2017', 'flb457', 'MNI152', '1mm'),
('sydnor2021', 'SAaxis', 'fsLR', '32k'),
('tuominen', 'feobv', 'MNI152', '2mm'),
('turtonen2020', 'carfentanil', 'MNI152', '1mm'),
('vijay2018', 'ly2795050', 'MNI152', '2mm'),
('xu2020', 'FChomology', 'fsLR', '32k'),
('xu2020', 'evoexp', 'fsLR', '32k')]
In [60]:
available_annotations(space="MNI152")
Out[60]:
[('aghourian2017', 'feobv', 'MNI152', '1mm'),
('alarkurtti2015', 'raclopride', 'MNI152', '3mm'),
('bedard2019', 'feobv', 'MNI152', '1mm'),
('beliveau2017', 'az10419369', 'MNI152', '1mm'),
('beliveau2017', 'cimbi36', 'MNI152', '1mm'),
('beliveau2017', 'cumi101', 'MNI152', '1mm'),
('beliveau2017', 'dasb', 'MNI152', '1mm'),
('beliveau2017', 'sb207145', 'MNI152', '1mm'),
('castrillon2023', 'cmrglc', 'MNI152', '3mm'),
('ding2010', 'mrb', 'MNI152', '1mm'),
('dubois2015', 'abp688', 'MNI152', '1mm'),
('dukart2018', 'flumazenil', 'MNI152', '3mm'),
('dukart2018', 'fpcit', 'MNI152', '3mm'),
('fazio2016', 'madam', 'MNI152', '3mm'),
('finnema2016', 'ucbj', 'MNI152', '1mm'),
('gallezot2010', 'p943', 'MNI152', '1mm'),
('gallezot2017', 'gsk189254', 'MNI152', '1mm'),
('hesse2017', 'methylreboxetine', 'MNI152', '3mm'),
('hillmer2016', 'flubatine', 'MNI152', '1mm'),
('jaworska2020', 'fallypride', 'MNI152', '1mm'),
('kaller2017', 'sch23390', 'MNI152', '3mm'),
('kantonen2020', 'carfentanil', 'MNI152', '3mm'),
('laurikainen2018', 'fmpepd2', 'MNI152', '1mm'),
('naganawa2020', 'lsn3172176', 'MNI152', '1mm'),
('neurosynth', 'cogpc1', 'MNI152', '2mm'),
('norgaard2021', 'flumazenil', 'MNI152', '1mm'),
('normandin2015', 'omar', 'MNI152', '1mm'),
('radnakrishnan2018', 'gsk215083', 'MNI152', '1mm'),
('rosaneto', 'abp688', 'MNI152', '1mm'),
('sandiego2015', 'flb457', 'MNI152', '1mm'),
('sasaki2012', 'fepe2i', 'MNI152', '1mm'),
('satterthwaite2014', 'meancbf', 'MNI152', '1mm'),
('savli2012', 'altanserin', 'MNI152', '3mm'),
('savli2012', 'dasb', 'MNI152', '3mm'),
('savli2012', 'p943', 'MNI152', '3mm'),
('savli2012', 'way100635', 'MNI152', '3mm'),
('smart2019', 'abp688', 'MNI152', '1mm'),
('smith2017', 'flb457', 'MNI152', '1mm'),
('tuominen', 'feobv', 'MNI152', '2mm'),
('turtonen2020', 'carfentanil', 'MNI152', '1mm'),
('vijay2018', 'ly2795050', 'MNI152', '2mm')]
In [47]:
import pyvista as pv
import nibabel as nib
def make_pv_surf(surf_hemi):
vertices, faces = nib.load(surf_hemi).agg_data()
surf = pv.PolyData(vertices, np.c_[np.ones((faces.shape[0],), dtype=int)*3, faces])
return surf
def make_pv_plotter(surf_lh, surf_rh, plotter_settings, mesh_settings):
pl = pv.Plotter(shape=(2, 2), border=False, **plotter_settings)
zoom_ratio = 1.5
pl.subplot(0, 0)
pl.add_mesh(surf_lh.rotate_z(180), **mesh_settings)
pl.camera_position="yz"
pl.zoom_camera(zoom_ratio)
pl.subplot(1, 0)
pl.add_mesh(surf_lh, **mesh_settings)
pl.camera_position="yz"
pl.zoom_camera(zoom_ratio)
pl.subplot(0, 1)
pl.add_mesh(surf_rh, **mesh_settings)
pl.camera_position="yz"
pl.zoom_camera(zoom_ratio)
pl.subplot(1, 1)
pl.add_mesh(surf_rh.rotate_z(180), **mesh_settings)
pl.camera_position="yz"
pl.zoom_camera(zoom_ratio)
# by default applied to all scenes
light = pv.Light(light_type='headlight', intensity=0.2)
pl.add_light(light)
return pl
In [55]:
from neuromaps.datasets import fetch_civet
In [98]:
curr_medial = load_gifti(fetch_fslr(density="4k")["medial"].L).agg_data()
In [111]:
np.where(1-curr_medial)[0].shape
Out[111]:
(366,)
In [108]:
curr_medial[curr_medial!=1].shape
Out[108]:
(366,)
In [116]:
datafile = fetch_annotation(source="sydnor2021")
data = load_gifti(datafile[0]).agg_data()
In [77]:
# functions for surface plotting
def get_pv_surf(annot):
if annot[2] == "fsLR":
if annot[3] == "4k":
curr_tpl = fetch_fslr(density=annot[3])["inflated"]
else:
curr_tpl = fetch_fslr(density=annot[3])["veryinflated"]
elif annot[2] == "fsaverage":
curr_tpl = fetch_fsaverage(density=annot[3])["inflated"]
elif annot[2] == "civet":
curr_tpl = fetch_civet(density=annot[3])["veryinflated"]
else:
pass
surf_lh = make_pv_surf(curr_tpl.L)
surf_rh = make_pv_surf(curr_tpl.R)
return surf_lh, surf_rh
plotter_settings = dict(
# notebook=True,
off_screen=True,
window_size=(400, 300)
)
mesh_settings = dict(
smooth_shading=True,
cmap="RdBu_r",
show_scalar_bar=False
)
In [82]:
# plot the outliers (manually defined) to see where they are
# turns out they are all medial walls
def highlight_outlier(annot, data):
annot_str = "_".join(list(annot))
background_val = None
if annot[0] == "beliveau2017":
background_val = 0
elif annot[0] == "hcps1200" and annot[1] in ["myelinmap", "thickness"]:
background_val = 0
elif annot_str == "norgaard2021_flumazenil_fsaverage_164k":
background_val = -62.063393
elif annot[0] == "raichle":
background_val = 0
elif annot_str == "reardon2018_scalinghcp_civet_41k":
background_val = 0
elif annot[0] == "margulies2016":
background_val = 0
else:
pass
if background_val is not None:
new_data = np.ones_like(data)
new_data[data!=background_val] = np.nan
else:
new_data = None
return new_data
for annot in available_annotations():
annot_str = "_".join(list(annot))
print(annot_str)
if annot[2] == "MNI152":
continue
surf_lh, surf_rh = get_pv_surf(annot)
# assign data
curr_datafile = fetch_annotation(source=annot[0], desc=annot[1], space=annot[2], den=annot[3])
if isinstance(curr_datafile, list):
data_lh = highlight_outlier(annot, load_gifti(curr_datafile[0]).agg_data())
data_rh = highlight_outlier(annot, load_gifti(curr_datafile[1]).agg_data())
if data_lh is not None and data_rh is not None:
surf_lh.point_data[annot_str] = data_lh
surf_rh.point_data[annot_str] = data_rh
else:
continue
else:
data_lh = highlight_outlier(annot, load_gifti(curr_datafile).agg_data())
if data_lh is not None:
surf_lh.point_data[annot_str] = data_lh
surf_rh.point_data[annot_str] = [np.nan] * len(data_lh)
else:
continue
mesh_settings = copy.deepcopy(mesh_settings)
mesh_settings["scalars"] = annot_str
pl = make_pv_plotter(surf_lh, surf_rh, plotter_settings, mesh_settings)
pl.add_text(annot_str, position="lower_edge", font_size=4)
pl.screenshot(figs_dir / "annotations-brains-outliers" / f"{annot_str}.png")
abagen_genepc1_fsaverage_10k aghourian2017_feobv_MNI152_1mm alarkurtti2015_raclopride_MNI152_3mm bedard2019_feobv_MNI152_1mm beliveau2017_az10419369_MNI152_1mm beliveau2017_az10419369_fsaverage_164k beliveau2017_cimbi36_MNI152_1mm beliveau2017_cimbi36_fsaverage_164k beliveau2017_cumi101_MNI152_1mm beliveau2017_cumi101_fsaverage_164k beliveau2017_dasb_MNI152_1mm beliveau2017_dasb_fsaverage_164k beliveau2017_sb207145_MNI152_1mm beliveau2017_sb207145_fsaverage_164k castrillon2023_cmrglc_MNI152_3mm ding2010_mrb_MNI152_1mm dubois2015_abp688_MNI152_1mm dukart2018_flumazenil_MNI152_3mm dukart2018_fpcit_MNI152_3mm fazio2016_madam_MNI152_3mm finnema2016_ucbj_MNI152_1mm gallezot2010_p943_MNI152_1mm gallezot2017_gsk189254_MNI152_1mm hcps1200_megalpha_fsLR_4k hcps1200_megbeta_fsLR_4k hcps1200_megdelta_fsLR_4k hcps1200_meggamma1_fsLR_4k hcps1200_meggamma2_fsLR_4k hcps1200_megtheta_fsLR_4k hcps1200_megtimescale_fsLR_4k hcps1200_myelinmap_fsLR_32k hcps1200_thickness_fsLR_32k hesse2017_methylreboxetine_MNI152_3mm hill2010_devexp_fsLR_164k hill2010_evoexp_fsLR_164k hillmer2016_flubatine_MNI152_1mm jaworska2020_fallypride_MNI152_1mm kaller2017_sch23390_MNI152_3mm kantonen2020_carfentanil_MNI152_3mm laurikainen2018_fmpepd2_MNI152_1mm margulies2016_fcgradient01_fsLR_32k margulies2016_fcgradient02_fsLR_32k margulies2016_fcgradient03_fsLR_32k margulies2016_fcgradient04_fsLR_32k margulies2016_fcgradient05_fsLR_32k margulies2016_fcgradient06_fsLR_32k margulies2016_fcgradient07_fsLR_32k margulies2016_fcgradient08_fsLR_32k margulies2016_fcgradient09_fsLR_32k margulies2016_fcgradient10_fsLR_32k mueller2013_intersubjvar_fsLR_164k naganawa2020_lsn3172176_MNI152_1mm neurosynth_cogpc1_MNI152_2mm norgaard2021_flumazenil_MNI152_1mm norgaard2021_flumazenil_fsaverage_164k normandin2015_omar_MNI152_1mm radnakrishnan2018_gsk215083_MNI152_1mm raichle_cbf_fsLR_164k raichle_cbv_fsLR_164k raichle_cmr02_fsLR_164k raichle_cmrglc_fsLR_164k reardon2018_scalinghcp_civet_41k reardon2018_scalingnih_civet_41k reardon2018_scalingpnc_civet_41k rosaneto_abp688_MNI152_1mm sandiego2015_flb457_MNI152_1mm sasaki2012_fepe2i_MNI152_1mm satterthwaite2014_meancbf_MNI152_1mm savli2012_altanserin_MNI152_3mm savli2012_dasb_MNI152_3mm savli2012_p943_MNI152_3mm savli2012_way100635_MNI152_3mm smart2019_abp688_MNI152_1mm smith2017_flb457_MNI152_1mm sydnor2021_SAaxis_fsLR_32k tuominen_feobv_MNI152_2mm turtonen2020_carfentanil_MNI152_1mm vijay2018_ly2795050_MNI152_2mm xu2020_FChomology_fsLR_32k xu2020_evoexp_fsLR_32k
In [112]:
def remove_medial_wall(annot, hemi, data):
if annot[2] == "fsLR":
curr_medial = fetch_fslr(density=annot[3])["medial"]
elif annot[2] == "fsaverage":
curr_medial = fetch_fsaverage(density=annot[3])["medial"]
elif annot[2] == "civet":
curr_medial = fetch_civet(density=annot[3])["medial"]
else:
pass
if hemi == "lh":
curr_medial = curr_medial.L
elif hemi == "rh":
curr_medial = curr_medial.R
else:
pass
curr_medial = load_gifti(curr_medial).agg_data()
data[np.where(1-curr_medial)] = np.nan
return data
In [122]:
for annot in available_annotations():
annot_str = "_".join(list(annot))
if annot[2] == "MNI152":
continue
print(annot_str)
abagen_genepc1_fsaverage_10k beliveau2017_az10419369_fsaverage_164k beliveau2017_cimbi36_fsaverage_164k beliveau2017_cumi101_fsaverage_164k beliveau2017_dasb_fsaverage_164k beliveau2017_sb207145_fsaverage_164k hcps1200_megalpha_fsLR_4k hcps1200_megbeta_fsLR_4k hcps1200_megdelta_fsLR_4k hcps1200_meggamma1_fsLR_4k hcps1200_meggamma2_fsLR_4k hcps1200_megtheta_fsLR_4k hcps1200_megtimescale_fsLR_4k hcps1200_myelinmap_fsLR_32k hcps1200_thickness_fsLR_32k hill2010_devexp_fsLR_164k hill2010_evoexp_fsLR_164k margulies2016_fcgradient01_fsLR_32k margulies2016_fcgradient02_fsLR_32k margulies2016_fcgradient03_fsLR_32k margulies2016_fcgradient04_fsLR_32k margulies2016_fcgradient05_fsLR_32k margulies2016_fcgradient06_fsLR_32k margulies2016_fcgradient07_fsLR_32k margulies2016_fcgradient08_fsLR_32k margulies2016_fcgradient09_fsLR_32k margulies2016_fcgradient10_fsLR_32k mueller2013_intersubjvar_fsLR_164k norgaard2021_flumazenil_fsaverage_164k raichle_cbf_fsLR_164k raichle_cbv_fsLR_164k raichle_cmr02_fsLR_164k raichle_cmrglc_fsLR_164k reardon2018_scalinghcp_civet_41k reardon2018_scalingnih_civet_41k reardon2018_scalingpnc_civet_41k sydnor2021_SAaxis_fsLR_32k xu2020_FChomology_fsLR_32k xu2020_evoexp_fsLR_32k
In [113]:
for annot in available_annotations():
annot_str = "_".join(list(annot))
print(annot_str)
if annot[2] == "MNI152":
continue
surf_lh, surf_rh = get_pv_surf(annot)
# assign data
curr_datafile = fetch_annotation(source=annot[0], desc=annot[1], space=annot[2], den=annot[3])
if isinstance(curr_datafile, list):
data_lh = load_gifti(curr_datafile[0]).agg_data()
data_rh = load_gifti(curr_datafile[1]).agg_data()
data_lh = remove_medial_wall(annot, "lh", data_lh)
data_rh = remove_medial_wall(annot, "rh", data_rh)
#
surf_lh.point_data[annot_str] = data_lh
surf_rh.point_data[annot_str] = data_rh
else:
data_lh = load_gifti(curr_datafile).agg_data()
data_lh = remove_medial_wall(annot, "lh", data_lh)
#
surf_lh.point_data[annot_str] = data_lh
surf_rh.point_data[annot_str] = [np.nan] * len(data_lh)
mesh_settings = copy.deepcopy(mesh_settings)
mesh_settings["scalars"] = annot_str
pl = make_pv_plotter(surf_lh, surf_rh, plotter_settings, mesh_settings)
pl.add_text(annot_str, position="lower_edge", font_size=4)
pl.screenshot(figs_dir / "annotations-brains" / f"{annot_str}.png")
abagen_genepc1_fsaverage_10k aghourian2017_feobv_MNI152_1mm alarkurtti2015_raclopride_MNI152_3mm bedard2019_feobv_MNI152_1mm beliveau2017_az10419369_MNI152_1mm beliveau2017_az10419369_fsaverage_164k beliveau2017_cimbi36_MNI152_1mm beliveau2017_cimbi36_fsaverage_164k beliveau2017_cumi101_MNI152_1mm beliveau2017_cumi101_fsaverage_164k beliveau2017_dasb_MNI152_1mm beliveau2017_dasb_fsaverage_164k beliveau2017_sb207145_MNI152_1mm beliveau2017_sb207145_fsaverage_164k castrillon2023_cmrglc_MNI152_3mm ding2010_mrb_MNI152_1mm dubois2015_abp688_MNI152_1mm dukart2018_flumazenil_MNI152_3mm dukart2018_fpcit_MNI152_3mm fazio2016_madam_MNI152_3mm finnema2016_ucbj_MNI152_1mm gallezot2010_p943_MNI152_1mm gallezot2017_gsk189254_MNI152_1mm hcps1200_megalpha_fsLR_4k hcps1200_megbeta_fsLR_4k hcps1200_megdelta_fsLR_4k hcps1200_meggamma1_fsLR_4k hcps1200_meggamma2_fsLR_4k hcps1200_megtheta_fsLR_4k hcps1200_megtimescale_fsLR_4k hcps1200_myelinmap_fsLR_32k hcps1200_thickness_fsLR_32k hesse2017_methylreboxetine_MNI152_3mm hill2010_devexp_fsLR_164k hill2010_evoexp_fsLR_164k hillmer2016_flubatine_MNI152_1mm jaworska2020_fallypride_MNI152_1mm kaller2017_sch23390_MNI152_3mm kantonen2020_carfentanil_MNI152_3mm laurikainen2018_fmpepd2_MNI152_1mm margulies2016_fcgradient01_fsLR_32k margulies2016_fcgradient02_fsLR_32k margulies2016_fcgradient03_fsLR_32k margulies2016_fcgradient04_fsLR_32k margulies2016_fcgradient05_fsLR_32k margulies2016_fcgradient06_fsLR_32k margulies2016_fcgradient07_fsLR_32k margulies2016_fcgradient08_fsLR_32k margulies2016_fcgradient09_fsLR_32k margulies2016_fcgradient10_fsLR_32k mueller2013_intersubjvar_fsLR_164k naganawa2020_lsn3172176_MNI152_1mm neurosynth_cogpc1_MNI152_2mm norgaard2021_flumazenil_MNI152_1mm norgaard2021_flumazenil_fsaverage_164k normandin2015_omar_MNI152_1mm radnakrishnan2018_gsk215083_MNI152_1mm raichle_cbf_fsLR_164k raichle_cbv_fsLR_164k raichle_cmr02_fsLR_164k raichle_cmrglc_fsLR_164k reardon2018_scalinghcp_civet_41k reardon2018_scalingnih_civet_41k reardon2018_scalingpnc_civet_41k rosaneto_abp688_MNI152_1mm sandiego2015_flb457_MNI152_1mm sasaki2012_fepe2i_MNI152_1mm satterthwaite2014_meancbf_MNI152_1mm savli2012_altanserin_MNI152_3mm savli2012_dasb_MNI152_3mm savli2012_p943_MNI152_3mm savli2012_way100635_MNI152_3mm smart2019_abp688_MNI152_1mm smith2017_flb457_MNI152_1mm sydnor2021_SAaxis_fsLR_32k tuominen_feobv_MNI152_2mm turtonen2020_carfentanil_MNI152_1mm vijay2018_ly2795050_MNI152_2mm xu2020_FChomology_fsLR_32k xu2020_evoexp_fsLR_32k
In [115]:
# plot the distribution
for annot in available_annotations():
# "_".join(list(annot))
# print(annot)
annot_str = "_".join(list(annot))
print(annot_str)
if annot[2] == "MNI152":
continue
# surforvol = "vol"
# curr_datafile = fetch_annotation(source=annot[0], desc=annot[1], space=annot[2], res=annot[3])
# curr_data = load_nifti(curr_datafile).get_fdata().flatten()
else:
surforvol = "surf"
curr_datafile = fetch_annotation(source=annot[0], desc=annot[1], space=annot[2], den=annot[3])
if isinstance(curr_datafile, list):
data_lh = load_gifti(curr_datafile[0]).agg_data()
data_rh = load_gifti(curr_datafile[1]).agg_data()
data_lh = remove_medial_wall(annot, "lh", data_lh)
data_rh = remove_medial_wall(annot, "rh", data_rh)
curr_data = np.concatenate([data_lh, data_rh])
else:
data_lh = load_gifti(curr_datafile).agg_data()
data_lh = remove_medial_wall(annot, "lh", data_lh)
curr_data = data_lh
# plot
fig, ax = plt.subplots(figsize=(7, 1), constrained_layout=True)
ax.hist(curr_data, bins="auto")
# sns.histplot(data=curr_data, ax=ax)
ax.set(title=annot_str)
fig.savefig(figs_dir / "annotations-histograms" / f"{annot_str}.png")
abagen_genepc1_fsaverage_10k aghourian2017_feobv_MNI152_1mm alarkurtti2015_raclopride_MNI152_3mm bedard2019_feobv_MNI152_1mm beliveau2017_az10419369_MNI152_1mm beliveau2017_az10419369_fsaverage_164k beliveau2017_cimbi36_MNI152_1mm beliveau2017_cimbi36_fsaverage_164k beliveau2017_cumi101_MNI152_1mm beliveau2017_cumi101_fsaverage_164k beliveau2017_dasb_MNI152_1mm beliveau2017_dasb_fsaverage_164k beliveau2017_sb207145_MNI152_1mm beliveau2017_sb207145_fsaverage_164k castrillon2023_cmrglc_MNI152_3mm ding2010_mrb_MNI152_1mm dubois2015_abp688_MNI152_1mm dukart2018_flumazenil_MNI152_3mm dukart2018_fpcit_MNI152_3mm fazio2016_madam_MNI152_3mm finnema2016_ucbj_MNI152_1mm gallezot2010_p943_MNI152_1mm gallezot2017_gsk189254_MNI152_1mm hcps1200_megalpha_fsLR_4k hcps1200_megbeta_fsLR_4k hcps1200_megdelta_fsLR_4k hcps1200_meggamma1_fsLR_4k hcps1200_meggamma2_fsLR_4k hcps1200_megtheta_fsLR_4k hcps1200_megtimescale_fsLR_4k hcps1200_myelinmap_fsLR_32k hcps1200_thickness_fsLR_32k hesse2017_methylreboxetine_MNI152_3mm hill2010_devexp_fsLR_164k hill2010_evoexp_fsLR_164k hillmer2016_flubatine_MNI152_1mm jaworska2020_fallypride_MNI152_1mm kaller2017_sch23390_MNI152_3mm kantonen2020_carfentanil_MNI152_3mm laurikainen2018_fmpepd2_MNI152_1mm margulies2016_fcgradient01_fsLR_32k margulies2016_fcgradient02_fsLR_32k margulies2016_fcgradient03_fsLR_32k margulies2016_fcgradient04_fsLR_32k
/tmp/ipykernel_3238331/2479547756.py:28: RuntimeWarning: More than 20 figures have been opened. Figures created through the pyplot interface (`matplotlib.pyplot.figure`) are retained until explicitly closed and may consume too much memory. (To control this warning, see the rcParam `figure.max_open_warning`). Consider using `matplotlib.pyplot.close()`. fig, ax = plt.subplots(figsize=(7, 1), constrained_layout=True)
margulies2016_fcgradient05_fsLR_32k margulies2016_fcgradient06_fsLR_32k margulies2016_fcgradient07_fsLR_32k margulies2016_fcgradient08_fsLR_32k margulies2016_fcgradient09_fsLR_32k margulies2016_fcgradient10_fsLR_32k mueller2013_intersubjvar_fsLR_164k naganawa2020_lsn3172176_MNI152_1mm neurosynth_cogpc1_MNI152_2mm norgaard2021_flumazenil_MNI152_1mm norgaard2021_flumazenil_fsaverage_164k normandin2015_omar_MNI152_1mm radnakrishnan2018_gsk215083_MNI152_1mm raichle_cbf_fsLR_164k raichle_cbv_fsLR_164k raichle_cmr02_fsLR_164k raichle_cmrglc_fsLR_164k reardon2018_scalinghcp_civet_41k reardon2018_scalingnih_civet_41k reardon2018_scalingpnc_civet_41k rosaneto_abp688_MNI152_1mm sandiego2015_flb457_MNI152_1mm sasaki2012_fepe2i_MNI152_1mm satterthwaite2014_meancbf_MNI152_1mm savli2012_altanserin_MNI152_3mm savli2012_dasb_MNI152_3mm savli2012_p943_MNI152_3mm savli2012_way100635_MNI152_3mm smart2019_abp688_MNI152_1mm smith2017_flb457_MNI152_1mm sydnor2021_SAaxis_fsLR_32k tuominen_feobv_MNI152_2mm turtonen2020_carfentanil_MNI152_1mm vijay2018_ly2795050_MNI152_2mm xu2020_FChomology_fsLR_32k xu2020_evoexp_fsLR_32k
In [ ]: