neurocollage.planes

Functions for slicing circuit files to place specific cells only.

Functions

create_planes(layer_annotation[, ...])

Create planes in an atlas.

get_atlas(atlas_path)

Get atlas helper.

get_cells_between_planes(cells, plane_left, ...)

Gets cells gids between two planes in equation representation.

get_centerline_bounds(layer)

Find centerline bounds using PCA of the voxell position of a given layer in the region.

get_layer_annotation(atlas_path, region[, ...])

Create a VoxelData with layer annotation.

get_local_bbox(annotation)

Compute bbox where annotation file is strictly positive.

halve_atlas(annotated_volume[, axis, side])

Return the half of the annotated volume along the x-axis.

slice_n_cells(cells, n_cells[, random_state])

Selects n_cells random cells per mtypes.

slice_per_mtype(cells, mtypes)

Selects cells of given mtype.

neurocollage.planes.create_planes(layer_annotation, plane_type='aligned', plane_count=10, slice_thickness=100, centerline_first_bound=None, centerline_last_bound=None, centerline_axis=0, seed=42)

Create planes in an atlas.

We create 3 * plane_count such each triplet of planes define the left, center and right plane of each slice.

Parameters:
  • layer_annotation (VoxelData) – annotations with layers

  • plane_type (str) –

    type of planes creation algorithm, two choices:

    • centerline_straight: centerline is straight between _first_bound and _last_bound

    • centerline_curved: centerline is curved with algorithm from atlas-analysis package

    • aligned: centerline is a straight line, along the centerline_axis

  • plane_count (int) – number of planes to create slices of atlas,

  • slice_thickness (float) – thickness of slices (in micrometer)

  • centerline_first_bound (list) – (for plane_type == centerline) location of first bound for centerline (in voxcell index)

  • centerline_last_bound (list) – (for plane_type == centerline) location of last bound for centerline (in voxcell index)

  • centerline_axis (str) – (for plane_type = aligned) axis along which to create planes

  • seed (int) – fix seed for centerline creation

neurocollage.planes.get_atlas(atlas_path)

Get atlas helper.

neurocollage.planes.get_cells_between_planes(cells, plane_left, plane_right)

Gets cells gids between two planes in equation representation.

neurocollage.planes.get_centerline_bounds(layer)

Find centerline bounds using PCA of the voxell position of a given layer in the region.

neurocollage.planes.get_layer_annotation(atlas_path, region, hemisphere=None)

Create a VoxelData with layer annotation.

neurocollage.planes.get_local_bbox(annotation)

Compute bbox where annotation file is strictly positive.

neurocollage.planes.halve_atlas(annotated_volume, axis=2, side='left')

Return the half of the annotated volume along the x-axis.

The identifiers of the voxels located on the left half or the right half of the annotated volume are zeroed depending on which side is chosen.

Parameters:
  • annotated_volume – integer array of shape (W, L, D) holding the annotation of a brain region.

  • axis – (Optional) axis along which to halve. Either 0, 1 or 2. Defaults to 2.

  • side – (Optional) Either ‘left’ or ‘right’, depending on which half is requested. Defaults to LEFT.

Returns:

Halves annotated_volume where where voxels on the opposite side have been zeroed (black).

neurocollage.planes.slice_n_cells(cells, n_cells, random_state=0)

Selects n_cells random cells per mtypes.

neurocollage.planes.slice_per_mtype(cells, mtypes)

Selects cells of given mtype.