utils#

create_label_table(fpath, save=False, from_cached=False)[source]#
Parameters:

fpath (str) – Path to a JSON file similar to the one downloaded from ‘http://api.brain-map.org/api/v2/structure_graph_download/1.json

Returns

df: pd.DataFrame

dataframe holding informations on the labels ()

get_all_children_structures_ids(children)[source]#

children: list of structures returns a list of the ids of all children, (direct children, their children and so on)

get_all_structs(dfs)[source]#

Get all the structures that are in any of the dataframes

Parameters:

list(pd.DataFrame) (dfs)

Returns

get_direct_children_structures_ids(children)[source]#

children: list of structures returns a list of the ids of direct children only

get_flattened_structure(structure)[source]#

flattens the initial nested dict into a list of dicts (one dict per structure), retaining all the information

get_structure_path(structure_id, df)[source]#
Parameters:

structure_id (int) – id of the structure of interest

Returns

structure_path: list of int

path from root structure to structure of interest example: [997, 8, 343, 313, 348, 165, 100]