iblatlas.regions

Brain region mappings.

Four mappings are currently available within the IBL, these are:

  • Allen Atlas - total of 1328 annotation regions provided by Allen Atlas.

  • Beryl Atlas - total of 308 annotation regions determined by Nick Steinmetz for the brain wide map, mainly at the level of major cortical areas, nuclei/ganglia. Thus annotations relating to layers and nuclear subregions are absent.

  • Cosmos Atlas - total of 10 annotation regions determined by Nick Steinmetz for coarse analysis. Annotations include the major divisions of the brain only.

  • Swanson Atlas - total of 319 annotation regions provided by the Swanson atlas (FIXME which one?).

Terminology

  • Name - The full anatomical name of a brain region.

  • Acronymn - A shortened version of a brain region name.

  • Index - The index of the of the brain region within the ordered list of brain regions.

  • ID - A unique numerical identifier of a brain region. These are typically integers that therefore take up less space than storing the region names or acronyms.

  • Mapping - A function that maps one ordered list of brain region IDs to another, allowing one to control annotation granularity and brain region hierarchy, or to translate brain region names from one atlas to another. The default mapping is identity. See [atlas package documentation](./ibllib.atlas.html#mappings) for other mappings.

  • Order - Each structure is assigned a consistent position within the flattened graph. This value is known as the annotation index, i.e. the annotation volume contains the brain region order at each point in the image.

FIXME Document the two structure trees. Which Website did they come from, and which publication/edition?

Functions

regions_from_allen_csv

(DEPRECATED) Reads csv file containing the ALlen Ontology and instantiates a BrainRegions object.

Classes

BrainRegions

A struct of Allen brain regions, their names, IDs, relationships and associated plot colours.

FranklinPaxinosRegions

Mouse Brain in Stereotaxic Coordinates (MBSC).

class FranklinPaxinosRegions[source]

Bases: _BrainRegions

Mouse Brain in Stereotaxic Coordinates (MBSC).

Paxinos G, and Franklin KBJ (2012). The Mouse Brain in Stereotaxic Coordinates, 4th edition (Elsevier Academic Press).

class BrainRegions[source]

Bases: _BrainRegions

A struct of Allen brain regions, their names, IDs, relationships and associated plot colours.

iblatlas.regions.BrainRegions(brainmap=’Allen’)

Notes

The Allen atlas IDs are kept intact but lateralized as follows: labels are duplicated and IDs multiplied by -1, with the understanding that left hemisphere regions have negative IDs.

compute_hierarchy()[source]

Creates a self.hierarchy attribute that is an n_levels by n_region array of indices. This is useful to perform fast vectorized computations of ancestors and descendants. :return:

propagate_down(acronyms, values)[source]

This function remaps a set of user specified acronyms and values to the swanson map, by filling down the child nodes when higher up values are provided.

Parameters:
  • acronyms – list or array of allen ids or acronyms

  • values – list or array of associated values

Returns:

# FIXME Why only the swanson map? Also, how is this actually related to the Swanson map?

remap(region_ids, source_map='Allen', target_map='Beryl')[source]

Remap atlas regions IDs from source map to target map.

Any NaNs in region_ids remain as NaN in the output array.

Parameters:
  • region_ids (array_like of int) – The region IDs to remap.

  • source_map (str | np.array) – if string, it should be a key existing in self.mappings such as ‘Allen’, ‘Cosmos’ or ‘Beryl’ if np.array, it should be a [nregions,] array containing the mapped regions index such as mapping[original_allen_region_index] = target_mapping_region_index

  • target_map (str | np.array) – if string, it should be a key existing in self.mappings such as ‘Allen’, ‘Cosmos’ or ‘Beryl’ if np.array, it should be a [nregions,] array containing the mapped regions index such as mapping[original_allen_region_index] = target_mapping_region_index

Returns:

The input IDs mapped to target_map.

Return type:

numpy.array of int

regions_from_allen_csv()[source]

(DEPRECATED) Reads csv file containing the ALlen Ontology and instantiates a BrainRegions object.

NB: Instantiate BrainRegions directly instead.

Returns:

BrainRegions object