Atlas#
- class brainglobe_atlasapi.core.Atlas(path)[source]#
Bases:
object
Base class to handle atlases in BrainGlobe.
- Parameters:
path (str or Path object) – Path to folder containing data info.
Methods
get_structure_ancestors
(structure)Return a list of acronyms for all ancestors of a given structure.
get_structure_descendants
(structure)Return a list of acronyms for all descendants of a given structure.
get_structure_mask
(structure)Return a stack with the mask for a specific structure (including all sub-structures).
hemisphere_from_coords
(coords[, microns, ...])Get the hemisphere from a coordinate triplet.
mesh_from_structure
(structure)Retrieve the mesh associated with a given structure.
meshfile_from_structure
(structure)Retrieve the path to the mesh file associated with a given structure.
Retrieve the mesh for the root structure.
Retrieve the path to the mesh file for the root structure.
structure_from_coords
(coords[, microns, ...])Get the structure from a coordinate triplet.
Attributes
Return the annotation image data.
Returns a stack with the hemisphere information.
Returns a Treelib.tree object with structures hierarchy.
left_hemisphere_value
Returns a dataframe with id, acronym and name for each structure.
Make orientation more accessible from class.
Return the reference image data.
Make resolution more accessible from class.
right_hemisphere_value
Make shape more accessible from class.
Make shape more accessible from class.
- property annotation#
Return the annotation image data. Loads it if not already loaded.
- get_structure_ancestors(structure)[source]#
Return a list of acronyms for all ancestors of a given structure.
- Parameters:
structure (str or int) – Structure id or acronym
- Returns:
List of descendants acronyms
- Return type:
list
- get_structure_descendants(structure)[source]#
Return a list of acronyms for all descendants of a given structure.
- Parameters:
structure (str or int) – Structure id or acronym
- Returns:
List of descendants acronyms
- Return type:
list
- get_structure_mask(structure)[source]#
Return a stack with the mask for a specific structure (including all sub-structures).
This function might take a few seconds for structures with many children.
- Parameters:
structure (str or int) – Structure id or acronym
- Returns:
stack containing the mask array.
- Return type:
np.array
- hemisphere_from_coords(coords, microns=False, as_string=False)[source]#
Get the hemisphere from a coordinate triplet.
- Parameters:
coords (tuple or list or numpy array) – Triplet of coordinates. Default in voxels, can be microns if microns=True
microns (bool) – If true, coordinates are interpreted in microns.
as_string (bool) – If true, returns “left” or “right”.
- Returns:
Hemisphere label.
- Return type:
int or string
- property hemispheres#
Returns a stack with the hemisphere information. 1 - left, 2 - right.
If a symmetric reference is used, the hemisphere information is generated by splitting the reference in half along the frontal axis. If the reference has an odd number of voxels along the frontal axis, the middle plane is assigned to the left hemisphere.
- property hierarchy#
Returns a Treelib.tree object with structures hierarchy.
- property lookup_df#
Returns a dataframe with id, acronym and name for each structure.
- mesh_from_structure(structure)[source]#
Retrieve the mesh associated with a given structure.
- Parameters:
structure (int or str or list of int/str) – The ID or acronym of the structure for which to retrieve the mesh. If a list of IDs/acronyms is passed, a list of meshes will be returned.
- Returns:
The mesh data (e.g., a Mesh object) associated with the structure(s).
- Return type:
meshio.Mesh or list of meshio.Mesh
- meshfile_from_structure(structure)[source]#
Retrieve the path to the mesh file associated with a given structure.
- Parameters:
structure (int or str) – The ID or acronym of the structure for which to retrieve the mesh file path. If a list of IDs/acronyms is passed, a list of paths will be returned.
- Returns:
The path(s) to the mesh file(s) for the structure(s).
- Return type:
Path or list of Path
- property orientation#
Make orientation more accessible from class.
- property reference#
Return the reference image data. Loads it if not already loaded.
- property resolution#
Make resolution more accessible from class.
- root_mesh()[source]#
Retrieve the mesh for the root structure.
- Return type:
The mesh data for the root structure.
- root_meshfile()[source]#
Retrieve the path to the mesh file for the root structure.
- Returns:
str
- Return type:
The path to the mesh file for the root structure.
- property shape#
Make shape more accessible from class.
- property shape_um#
Make shape more accessible from class.
- structure_from_coords(coords, microns=False, as_acronym=False, hierarchy_lev=None, key_error_string='Outside atlas')[source]#
Get the structure from a coordinate triplet.
- Parameters:
coords (tuple or list or numpy array) – Triplet of coordinates.
microns (bool) – If true, coordinates are interpreted in microns.
as_acronym (bool) – If true, the region acronym is returned. If outside atlas (structure gives key error), return “Outside atlas”
hierarchy_lev (int or None) – If specified, return parent node at thi hierarchy level.
- Returns:
Structure containing the coordinates.
- Return type:
int or string