region_grower.context¶
Use spatial properties to grow a cell.
The objective of this module is to provide an interface between synthesis tools (here NeutoTS) and the circuit building pipeline.
TLDR: SpaceContext.synthesized() is being called by the placement_algorithm package to synthesize circuit morphologies.
Classes
|
Loads spatial information and provides basic functionality to query spatial properties. |
|
The container class for the current cell state. |
|
The container class for the current computation parameters. |
|
The container class for the current space context state. |
|
Synthesize cells in a given spatial context. |
|
The container class for the current synthesis parameters. |
|
The object returned by SpaceWorker.synthesize(). |
- class region_grower.context.CellHelper(cells_file)¶
Bases:
objectLoads spatial information and provides basic functionality to query spatial properties.
- positions(mtype)¶
Return a generator of mtype cell positions.
- class region_grower.context.CellState(position: List[float] | array, orientation: List[List[float]] | array, mtype: str, depth: float, other_parameters: Dict = {})¶
Bases:
objectThe container class for the current cell state.
- class region_grower.context.ComputationParameters(morph_writer: MorphWriter | None = None, morph_loader: MorphLoader | None = None, with_NRN_sections: bool = False, retries: int = 1, debug_data: bool = False)¶
Bases:
objectThe container class for the current computation parameters.
- class region_grower.context.SpaceContext(layer_depths: List, cortical_depths: List, y_direction: List = None, soma_position: float = None, soma_depth: float = None, boundaries: List = None, directions: List = None, atlas_info: Dict = {})¶
Bases:
objectThe container class for the current space context state.
- distance_to_constraint(depth: float, constraint: Dict) float | None¶
Returns the distance from a given depth to a given constraint.
- Parameters:
depth – the given depth.
constraint – a dict containing a ‘layer’ key and a ‘fraction’ keys.
- get_boundaries(cell)¶
Returns a dict with boundaries data for NeuroTS.
- get_direction(cell)¶
Get direction data for the given mtype.
- indices_to_positions(indices)¶
Local version of voxcel’s function to prevent atlas loading.
- layer_fraction_to_position(layer: int, layer_fraction: float) float¶
Returns an absolute position from a layer and a fraction of the layer.
- Parameters:
layer – a layer
layer_fraction – relative position within the layer (from 0 at the bottom of the layer to 1 at the top)
Returns: target depth
- lookup_target_reference_depths(depth: float) array¶
Returns the target and the reference depth for a given neuron position.
First item is the depth of the lower (the further away from the pia) boundary of the layer in which is located ‘position’.
Second one is the equivalent value for the same layer but in the cortical column.
- positions_to_indices(positions)¶
Local and reduced version of voxcel’s function to prevent atlas loading.
- class region_grower.context.SpaceWorker(cell_state: CellState, space_context: SpaceContext, synthesis_parameters: SynthesisParameters, computation_parameters: ComputationParameters)¶
Bases:
objectSynthesize cells in a given spatial context.
- completion(synthesized)¶
Write the given morphology and compute section IDs for Neuron.
- synthesize() SynthesisResult¶
Synthesize a cell based on the position and mtype.
The steps are the following: 1) Modify the input params so that the cell growth is compatible with the layer thickness at the given position 2) Perform the growth and the diametrization 3) Rescale the neurites so that they are compatible with the hard limits (if the neurite goes after the max hard limit, it is downscaled. And vice-versa if it is smaller than the min hard limit)
- transform_morphology(morph, orientation, scale=None, rng=<module 'numpy.random' from '/home/docs/checkouts/readthedocs.org/user_builds/region-grower/envs/stable/lib/python3.11/site-packages/numpy/random/__init__.py'>) None¶
Transform the morphology.
The morphology is scaled, rotated around Y and aligned according to the orientation field. If jitter parameters are provided, jitter process is also applied to the morphology.
- class region_grower.context.SynthesisParameters(tmd_distributions: dict, tmd_parameters: dict, axon_morph_name: str = None, axon_morph_scale: float | None = None, rotational_jitter_std: float = None, scaling_jitter_std: float = None, seed: int = 0, min_hard_scale: float = 0)¶
Bases:
objectThe container class for the current synthesis parameters.