ibllib.atlas.regions

Functions

regions_from_allen_csv

Reads csv file containing the ALlen Ontology and instantiates a BrainRegions object :return: BrainRegions object

Classes

BrainRegions

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.

class BrainRegions(brainmap='Allen')[source]

Bases: ibllib.atlas.regions._BrainRegions

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.

property rgba
get(ids) iblutil.util.Bunch[source]

Get a bunch of the name/id

subtree(scalar_id, return_indices=False)[source]

Given a node, returns the subtree containing the node along with ancestors

Parameters

indices (return) – Bool (False), if true returns a second argument with indices mapping

to the current br object :return: Bunch

descendants(ids, **kwargs)[source]

Get descendants from one or an array of ids

Parameters
  • ids – np.array or scalar representing the region primary key

  • return_indices – Bool (False) returns the indices in the current br obj

Returns

Bunch

ancestors(ids, **kwargs)[source]

Get ancestors from one or an array of ids

Parameters
  • ids – np.array or scalar representing the region primary key

  • return_indices – Bool (False) returns the indices in the current br obj

Returns

Bunch

leaves()[source]

Get all regions that do not have children :return:

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

Remap atlas regions ids from source map to target map

Parameters
  • region_ids – atlas ids to map

  • source_map – map name which original region_ids are in

  • target_map – map name onto which to map

Returns

acronym2acronym(acronym, mapping='Allen')[source]

Remap acronyms onto mapping

Parameters
  • acronym – list or array of acronyms

  • mapping – target map to remap acronyms

Returns

array of remapped acronyms

acronym2id(acronym, mapping='Allen', hemisphere=None)[source]

Convert acronyms to atlas ids and remap

Parameters
  • acronym – list or array of acronyms

  • mapping – target map to remap atlas_ids

  • hemisphere – which hemisphere to return atlas ids for, options left or right

Returns

array of remapped atlas ids

acronym2index(acronym, mapping='Allen', hemisphere=None)[source]

Convert acronym to index and remap

Parameters
  • acronym

  • mapping

  • hemisphere

Returns

array of remapped acronyms and list of indexes for each acronnym

id2acronym(atlas_id, mapping='Allen')[source]

Convert atlas id to acronym and remap

Parameters
  • acronym – list or array of atlas ids

  • mapping – target map to remap acronyms

Returns

array of remapped acronyms

id2id(atlas_id, mapping='Allen')[source]

Remap atlas id onto mapping

Parameters
  • acronym – list or array of atlas ids

  • mapping – target map to remap acronyms

Returns

array of remapped atlas ids

id2index(atlas_id, mapping='Allen')[source]

Convert atlas id to index and remap

Parameters
  • atlas_id – list or array of atlas ids

  • mapping – mapping to use

Returns

dict of indices for each atlas_id

index2acronym(index, mapping='Allen')[source]

Convert index to acronym and remap

Parameters
  • index

  • mapping

Returns

index2id(index, mapping='Allen')[source]

Convert index to atlas id and remap

Parameters
  • index

  • mapping

Returns

id: numpy.ndarray
name: object
acronym: object
rgb: numpy.uint8
level: numpy.ndarray
parent: numpy.ndarray
order: numpy.uint16
regions_from_allen_csv()[source]

Reads csv file containing the ALlen Ontology and instantiates a BrainRegions object :return: BrainRegions object