Cell Types¶
A cell type is an abstract description of a cell population. Cell populations are
placed within Partitions according to placement indications.
You can also attach morphologies and orientations to them.
During placement, the cell positions are generated in the form of a PlacementSet.
These can then be connected together into ConnectivitySets. Furthermore, during simulation, cell types are
represented by cell models.
Basic configuration
The radius and density are the 2 most basic placement indications: they specify how large and dense the cells in the population generally are. The plotting block allows you to specify formatting details.
"cell_types": {
"my_cell": {
"spatial": {
"density": 3e-9,
"radius": 10
}
"plotting": {
"display_name": "My Cell Type",
"color": "pink",
"opacity": 1.0
}
}
}
config.cell_types.add(
"my_cell",
spatial=dict(radius=10, density=3e-9)
plotting=dict(display_name=" My Cell Type", color="pink",opacity="1.0")
)
Specifying spatial density
In the previous example, we were setting the number of cells to place within each partition based on a single density value. Let’s imagine now that you want to describe the spatial distribution of the cell type spatial density for each voxel within your partition. This can be achieved with the NrrdVoxels partition.
To do so, you should first attach your NRRD volumetric density file(s) to the partition with either the source or sources blocks. Then, label the file(s) with the keys list block and refer to the keys in the cell_types with density_key:
{
"partitions": {
"declive": {
"type": "nrrd",
"sources": ["first_cell_type_density.nrrd",
"second_cell_type_density.nrrd"],
"keys": ["first_cell_type_density",
"second_cell_type_density"]
"voxel_size": 25,
}
}
"cell_types": {
"first_cell_type": {
"spatial": {
"radius": 10.0,
"density_key": "first_cell_type_density"
},
"plotting": {
"display_name": "First Cell Type",
"color": "pink",
"opacity": 1.0
}
},
"second_cell_type": {
"spatial": {
"radius": 5.0,
"density_key": "second_cell_type_density"
},
"plotting": {
"display_name": "Second Cell Type",
"color": "#0000FF",
"opacity": 0.5
}
}
}
}
config.partitions.add(
"declive",
type="nrrd",
sources= ["first_cell_type_density.nrrd",
"second_cell_type_density.nrrd"],
keys= ["first_cell_type_density",
"second_cell_type_density"],
voxel_size=25,
)
config.cell_types.add(
"first_cell_type",
spatial=dict(radius=10, density_key="first_cell_type_density")
plotting=dict(display_name="First Cell Type", color="pink",opacity="1.0")
)
config.cell_types.add(
"second_cell_type",
spatial=dict(radius=10, density_key="second_cell_type_density")
plotting=dict(display_name="First Cell Type", color="#0000FF",opacity="0.5")
)
The NRRD files should contain voxel based volumetric density in unit of cells / voxel volume, where the voxel volume is in cubic unit of voxel_size. i.e., if voxel_size is in µm then the density file is in cells/µm^3. This implementation corresponds to an atlas-based reconstruction and you can find an example of a BSB configuration using the Allen Atlas in this section .
Specifying morphologies
The easiest way to associate a morphology to a cell type is by referencing the name it is stored under. There are more advanced ways as well, covered in our guide on Morphology Selectors .
{
"cell_types": {
"my_cell_type": {
"spatial": {
"radius": 10.0,
"density": 3e-9,
"morphologies": ["cells_A_*", "cell_B_2"]
},
"plotting": {
"display_name": "My Cell Type",
"color": "pink",
"opacity": 1.0
}
}
}
}
config.cell_types.add(
"my_cell_type",
spatial=dict(radius=10, density=3e-9,morphologies=["cells_A_*", "cell_B_2"])
plotting=dict(display_name=" My Cell Type", color="pink",opacity="1.0")
)
In this case we add two different morphologies labels:
cell_B_2 add the morphology with this name, cells_A_* add all the stored morphologies with name starting with cells_A_ prefix.
You can also apply transformation to your cell morphologies as discussed in this section.