bsb.placement package¶
Submodules¶
bsb.placement.arrays module¶
- class bsb.placement.arrays.ParallelArrayPlacement(*args, _parent=None, _key=None, **kwargs)[source]¶
Implementation of the placement of cells in parallel arrays Cells are placed in rows on the plane defined by 2 selected axes.
- get_node_name()¶
- place(chunk, indicators)[source]¶
Cell placement: Create a lattice of parallel arrays/lines in the (x, y) surface.
bsb.placement.distributor module¶
- class bsb.placement.distributor.DistributionContext(indicator: bsb.placement.indicator.PlacementIndications, partitions: list[bsb.topology.partition.Partition])[source]¶
- Parameters:
indicator (PlacementIndications)
- indicator: PlacementIndications¶
- class bsb.placement.distributor.Distributor(*args, _parent=None, _key=None, **kwargs)[source]¶
- abstractmethod distribute(positions, context)[source]¶
Is called to distribute cell properties.
- Parameters:
partitions – The partitions the cells were placed in.
- Returns:
An array with the property data
- Return type:
- get_node_name()¶
- class bsb.placement.distributor.DistributorsNode(*args, _parent=None, _key=None, **kwargs)[source]¶
- get_node_name()¶
- morphologies: MorphologyDistributor¶
Base implementation of all the different configuration attributes.
Call the factory function
attr()instead.
- properties: dict[Distributor]¶
- rotations: RotationDistributor¶
Base implementation of all the different configuration attributes.
Call the factory function
attr()instead.
- class bsb.placement.distributor.ExplicitNoRotations(*args, _parent=None, _key=None, **kwargs)[source]¶
- distribute(positions, context)[source]¶
Is called to distribute cell properties.
- Parameters:
partitions – The partitions the cells were placed in.
- Returns:
An array with the property data
- Return type:
- get_node_name()¶
- class bsb.placement.distributor.ImplicitNoRotations(*args, _parent=None, _key=None, **kwargs)[source]¶
- distribute(positions, context)¶
Is called to distribute cell properties.
- Parameters:
partitions – The partitions the cells were placed in.
- Returns:
An array with the property data
- Return type:
- get_node_name()¶
- class bsb.placement.distributor.MorphologyDistributor(*args, _parent=None, _key=None, **kwargs)[source]¶
- abstractmethod distribute(positions, morphologies, context)[source]¶
Is called to distribute cell morphologies and optionally rotations.
- Parameters:
positions (numpy.ndarray) – Placed positions under consideration
morphologies – The template morphology loaders. You can decide to use them and/or generate new ones in the MorphologySet that you produce. If you produce any new morphologies, don’t forget to encapsulate them in a
StoredMorphologyloader, or better yet, use theMorphologyGenerator.context (DistributionContext) – The placement indicator and partitions.
- Returns:
A MorphologySet with assigned morphologies, and optionally a RotationSet
- Return type:
- get_node_name()¶
- class bsb.placement.distributor.MorphologyGenerator(*args, _parent=None, _key=None, **kwargs)[source]¶
Special case of the morphology distributor that provides extra convenience when generating new morphologies.
- distribute(positions, morphologies, context)[source]¶
Is called to distribute cell morphologies and optionally rotations.
- Parameters:
positions (numpy.ndarray) – Placed positions under consideration
morphologies – The template morphology loaders. You can decide to use them and/or generate new ones in the MorphologySet that you produce. If you produce any new morphologies, don’t forget to encapsulate them in a
StoredMorphologyloader, or better yet, use theMorphologyGenerator.context (DistributionContext) – The placement indicator and partitions.
- Returns:
A MorphologySet with assigned morphologies, and optionally a RotationSet
- Return type:
- get_node_name()¶
- class bsb.placement.distributor.RandomMorphologies(*args, _parent=None, _key=None, **kwargs)[source]¶
Distributes selected morphologies randomly without rotating them.
{ "placement": { "place_XY": { "distribute": { "morphologies": {"strategy": "random"} } }}}
- distribute(positions, morphologies, context)[source]¶
Uses the morphology selection indicators to select morphologies and returns a MorphologySet of randomly assigned morphologies.
- get_node_name()¶
- may_be_empty¶
- class bsb.placement.distributor.RandomRotations(*args, _parent=None, _key=None, **kwargs)[source]¶
- distribute(positions, context)[source]¶
Is called to distribute cell properties.
- Parameters:
partitions – The partitions the cells were placed in.
- Returns:
An array with the property data
- Return type:
- get_node_name()¶
- class bsb.placement.distributor.RotationDistributor(*args, _parent=None, _key=None, **kwargs)[source]¶
Rotates everything by nothing!
- abstractmethod distribute(positions, context)[source]¶
Is called to distribute cell properties.
- Parameters:
partitions – The partitions the cells were placed in.
- Returns:
An array with the property data
- Return type:
- get_node_name()¶
- class bsb.placement.distributor.RoundRobinMorphologies(*args, _parent=None, _key=None, **kwargs)[source]¶
Distributes selected morphologies round robin, values are looped and assigned one by one in order.
{ "placement": { "place_XY": { "distribute": { "morphologies": {"strategy": "roundrobin"} } }}}
- distribute(positions, morphologies, context)[source]¶
Is called to distribute cell morphologies and optionally rotations.
- Parameters:
positions (numpy.ndarray) – Placed positions under consideration
morphologies – The template morphology loaders. You can decide to use them and/or generate new ones in the MorphologySet that you produce. If you produce any new morphologies, don’t forget to encapsulate them in a
StoredMorphologyloader, or better yet, use theMorphologyGenerator.context (DistributionContext) – The placement indicator and partitions.
- Returns:
A MorphologySet with assigned morphologies, and optionally a RotationSet
- Return type:
- get_node_name()¶
- may_be_empty¶
- class bsb.placement.distributor.VolumetricRotations(*args, _parent=None, _key=None, **kwargs)[source]¶
- default_vector¶
Default orientation vector of each position.
- distribute(positions, context)[source]¶
Rotates according to a volumetric orientation field of specific resolution. For each position, find the equivalent voxel in the volumetric orientation field and apply the rotation from the default_vector to the corresponding orientation vector. Positions outside the orientation field will not be rotated.
- Parameters:
positions – Placed positions under consideration. Its shape is (N, 3) where N is the number of positions.
context (DistributionContext) – The placement indicator and partitions.
- Returns:
A RotationSet object containing the 3D Euler angles in degrees for the rotation of each position.
- Return type:
- get_node_name()¶
- orientation_path¶
Path to the nrrd file containing the volumetric orientation field.
It provides a rotation for each voxel considered. Its shape should be (3, L, W, D) where L, W and D are the sizes of the field.
- orientation_resolution¶
Voxel size resolution of the orientation field.
- space_origin¶
Origin point for the orientation field.
bsb.placement.indicator module¶
- class bsb.placement.indicator.PlacementIndicator(strat, cell_type)[source]¶
-
- property cell_type¶
- guess(chunk=None, voxels=None)[source]¶
Estimate the count of cell to place based on the cell_type’s PlacementIndications. Float estimates are converted to int using an acceptance- rejection method.
- Parameters:
chunk (bsb.storage._chunks.Chunk) – if provided, will estimate the number of cell within the Chunk.
voxels (bsb.voxels.VoxelSet) – if provided, will estimate the number of cell within the VoxelSet. Only for cells with the indication “density_key” set or with the indication “relative_to” set and the target cell has the indication “density_key” set.
- Returns:
Cell counts for each chunk or voxel.
- Return type:
- property partitions¶
bsb.placement.random module¶
- class bsb.placement.random.RandomPlacement(*args, _parent=None, _key=None, **kwargs)[source]¶
Place cells in random positions.
- get_node_name()¶
- place(chunk, indicators)[source]¶
Central method of each placement strategy. Given a chunk, should fill that chunk with cells by calling the scaffold’s (available as
self.scaffold)place_cells()method.- Parameters:
chunk (bsb.storage._chunks.Chunk) – Chunk to fill
indicators (Mapping[str, bsb.placement.indicator.PlacementIndicator]) – Dictionary of each cell type to its PlacementIndicator
bsb.placement.strategy module¶
- class bsb.placement.strategy.Entities(*args, _parent=None, _key=None, **kwargs)[source]¶
Implementation of the placement of entities that do not have a 3D position, but that need to be connected with other cells of the network.
- get_node_name()¶
- place(chunk, indicators)[source]¶
Central method of each placement strategy. Given a chunk, should fill that chunk with cells by calling the scaffold’s (available as
self.scaffold)place_cells()method.- Parameters:
chunk (bsb.storage._chunks.Chunk) – Chunk to fill
indicators (Mapping[str, bsb.placement.indicator.PlacementIndicator]) – Dictionary of each cell type to its PlacementIndicator
- class bsb.placement.strategy.FixedPositions(*args, _parent=None, _key=None, **kwargs)[source]¶
- get_node_name()¶
- place(chunk, indicators)[source]¶
Central method of each placement strategy. Given a chunk, should fill that chunk with cells by calling the scaffold’s (available as
self.scaffold)place_cells()method.- Parameters:
chunk (bsb.storage._chunks.Chunk) – Chunk to fill
indicators (Mapping[str, bsb.placement.indicator.PlacementIndicator]) – Dictionary of each cell type to its PlacementIndicator
- class bsb.placement.strategy.PlacementStrategy(*args, _parent=None, _key=None, **kwargs)[source]¶
Quintessential interface of the placement module.
Each placement strategy defines an approach to placing neurons into a volume.
- depends_on: list[PlacementStrategy]¶
- distribute: DistributorsNode¶
Base implementation of all the different configuration attributes.
Call the factory function
attr()instead.
- get_indicators()[source]¶
Return indicators per cell type.
Indicators collect all configuration information into objects that can produce guesses as to how many cells of a type should be placed in a volume.
- get_node_name()¶
- indicator_class¶
alias of
PlacementIndicator
- name: str¶
Base implementation of all the different configuration attributes.
Call the factory function
attr()instead.
- overrides: cfgdict[PlacementIndications]¶
- abstractmethod place(chunk, indicators)[source]¶
Central method of each placement strategy. Given a chunk, should fill that chunk with cells by calling the scaffold’s (available as
self.scaffold)place_cells()method.- Parameters:
chunk (bsb.storage._chunks.Chunk) – Chunk to fill
indicators (Mapping[str, bsb.placement.indicator.PlacementIndicator]) – Dictionary of each cell type to its PlacementIndicator