neurorosettes.grid#
Module Contents#
Classes#
Class to store the objects inside a simulation container and their coordinates. |
|
Class to evaluate the density of a tissue around a neuron object. |
|
Class for a cell density check based on the neighboring grid cells. |
|
Class for a cell density check based on a radius of interest. |
- class neurorosettes.grid.UniformGrid[source]#
Class to store the objects inside a simulation container and their coordinates.
Grids are defined as uniform objects with the same size and spacing for all dimensions (2D or 3D).
- property representation_grid_values: numpy.ndarray#
Returns the grid cell coordinates, inluding the top limit.
- Return type:
numpy.ndarray
- min: float#
The bottom limit of the grid domain size.
- max: float#
The top limit of the grid domain size.
- step: float#
The size of the grid cells.
- use_2d: bool = True#
If a grid has a third dimension or is 2D.
- grid_values: numpy.ndarray#
The coordinates of the grid cells.
- idx_values: numpy.ndarray#
The indices of the grid cells.
- grid: numpy.ndarray#
The grid, with the objects stored inside each cell.
- __post_init__()[source]#
Creates the empty grid object based on the initial size and spacing.
- Return type:
None
- interpolate_idx(position)[source]#
Returns the indices of the cell where a given position should be stored.
- Parameters:
position (numpy.ndarray) – The position to be located inside the grid.
- Return type:
Tuple[int, int, int]
- register_cell(cell)[source]#
Stores a cell object inside the grid and evaluates where to register it.
- Parameters:
cell (neurorosettes.subcellular.CellBody) – The cell object to be stored inside the grid.
- Return type:
None
- register_neurite(neurite)[source]#
Stores a neurite object inside the grid and evaluates where to register it.
- Parameters:
neurite (neurorosettes.subcellular.Neurite) – The neurite object to be stored inside the grid.
- Return type:
None
- remove_cell(cell)[source]#
Removes a cell object from the grid.
- Parameters:
cell (neurorosettes.subcellular.CellBody) – The cell object to be removed from the grid.
- Return type:
None
- remove_neurite(neurite)[source]#
Removes a neurite object from the grid.
- Parameters:
neurite (neurorosettes.subcellular.Neurite) – The neurite object to be removed from the grid.
- Return type:
None
- get_objects_in_voxel(idxx, idxy, idxz=0)[source]#
Returns the objects inside a cell of the grid.
- Parameters:
idxx (int) – The index of the cell in the x component.
idxy (int) – The index of the cell in the y component.
idxz (int) – The index of the cell in the z component.
- Return type:
A list of the cell bodies and neurites registered in the given cell of the grid.
- get_close_objects(position)[source]#
Returns the objects inside a cell and its neighbors.
- Parameters:
position (numpy.ndarray) – The position to be evaluated.
- Returns:
A list of the cell bodies and objects inside a cell, and the
cells that surround it in 2 or 3 dimensions.
- Return type:
List[Union[neurorosettes.subcellular.CellBody, neurorosettes.subcellular.Neurite]]
- get_close_cells(position)[source]#
Returns only the cell bodies inside a cell and its neighbors.
- Parameters:
position (numpy.ndarray) – The position to be evaluated.
- Return type:
A list of the cell bodies inside a cell and its neighbors.
- get_cells_in_radius(position, radius)[source]#
Returns the objects inside a radius of interest.
- Parameters:
position (numpy.ndarray) – The position to be evaluated.
radius (float) – The radius of interest.
- Returns:
A list of the cell bodies and neurites that are inside
a radius of interest with the given position as the centre.
- Return type:
- class neurorosettes.grid.CellDensityCheck[source]#
Bases:
abc.ABCClass to evaluate the density of a tissue around a neuron object.
Multiple types of checks may be defined, such as grid-based or radius-based evaluations.
- abstract check_max_density(cell, grid)[source]#
Returns a true boolean value if the density around a neuron surpasses the limit.
- Parameters:
cell (neurorosettes.subcellular.CellBody) – The cell to be evaluated.
grid (UniformGrid) – The Grid object where the cells and its neighbors are registered.
- Return type:
bool
- class neurorosettes.grid.OneLevelDensityCheck(max_neighbors=15)[source]#
Bases:
CellDensityCheckClass for a cell density check based on the neighboring grid cells.
- Parameters:
max_neighbors (int) – The maximum numbers of neighbors inside the cell grid and its neighbors.
- check_max_density(cell, grid)[source]#
Checks if the number of neighbors is higher than the maximum limit.
- Parameters:
cell (neurorosettes.subcellular.CellBody) – The cell to be evaluated.
grid (UniformGrid) – The Grid object where the cells and its neighbors are registered.
- Return type:
bool
- class neurorosettes.grid.TwoLevelsDensityCheck(max_outer_neighbors=15, max_inner_neighbors=6, radius=18.0)[source]#
Bases:
CellDensityCheckClass for a cell density check based on a radius of interest.
Starts by checking if the number of neighbors is larger than the maximum, as done in the OneLevelDensityCheck. If this value is surpassed, the neighbors inside a radius of interest are selected and quantified. It then checks if there are more neighbors inside this radius than the expected value.
- Parameters:
max_outer_neighbors (int) – The maximum numbers of neighbors inside the cell grid and its neighbors.
max_inner_neighbors (int) – The maximum number of neighbors inside of the radius of interest.
radius (float) – The radius of interest.
- check_max_density(cell, grid)[source]#
Checks if the number of neighbors is higher than the maximum limit.
- Parameters:
cell (neurorosettes.subcellular.CellBody) – The cell to be evaluated.
grid (UniformGrid) – The Grid object where the cells and its neighbors are registered.
- Return type:
bool