get_structure_children#

brainglobe_atlasapi.atlas_generation.structures.get_structure_children(structures, region, use_tree=False)[source]#

Get the direct and indirect children of a given brain region.

Given a list of dictionaries with structures data and a specific region from that list, this function returns the IDs of all structures that are children (direct or indirect) of the given region. It can optionally use a StructureTree for more efficient traversal.

Parameters:
  • structures (list of dict) – A list of dictionaries, where each dictionary represents a brain structure with its properties.

  • region (dict) – A dictionary representing the parent brain region, which must contain ‘id’ and ‘structure_id_path’ keys.

  • use_tree (bool, optional) – If True, a StructureTree will be constructed and used to find children. If False, a simpler list comprehension will be used. By default, False.

Returns:

A list of integer IDs for all child structures, or None if the region contains no other regions.

Return type:

list of int or None

Raises:

ValueError – If structures is not a list of dictionaries, or if region is not a dictionary, or if region is missing ‘id’ or ‘structure_id_path’.