Inner and outer cell borders
When studying tissues, organisms and organoids, often the position and orientation of the cell and its membranes within the tissue is relevant. For example, we differentiate apical (at an apex, at the end, outer) and basal (at the base, inner) sides of cells within tissue. Starting from a cell segmentation label image, we can identify pixels that sit outside or inside of a structure made of cells. In the following example we work with a synthetic two-dimensional image of some cells forming an organoid. The same functions will also work in 3D.
First, we build our synthetic dataset. It is made of 6 cell-centers we dilated to form an organoid.
These are our cells:
|
cle._ image
shape | (100, 100) |
dtype | uint32 |
size | 39.1 kB |
min | 0.0 | max | 6.0 |
|
And that’s the organoid:
|
cle._ image
shape | (100, 100) |
dtype | uint8 |
size | 9.8 kB |
min | 0.0 | max | 1.0 |
|
We now identify the pixels that sit on the borders of the cells.
|
cle._ image
shape | (100, 100) |
dtype | uint32 |
size | 39.1 kB |
min | 0.0 | max | 6.0 |
|
We can do exactly the same with the organoid to identify the pixels on its surface.
|
cle._ image
shape | (100, 100) |
dtype | uint32 |
size | 39.1 kB |
min | 0.0 | max | 1.0 |
|
By masking the cell borders with the organoid border - technically that’s a pixel-by-pixel multiplication - we can identify the outer borders.
|
cle._ image
shape | (100, 100) |
dtype | uint32 |
size | 39.1 kB |
min | 0.0 | max | 6.0 |
|
If we subtract the outer borders from all cell borders, we retrieve the inner borders
|
cle._ image
shape | (100, 100) |
dtype | uint32 |
size | 39.1 kB |
min | 0.0 | max | 6.0 |
|
When post-processing these label images, be a bit careful, because these images may not be sequentially labeled. There are libraries and functions which may have issues with those kind of label images (e.g. cle.statistics_of_labelled_pixels()
). You can print out which labels exist in a label image using np.unique()
and you could make the label images sequential using cle.relabel_sequential()
.
array([0, 2, 3, 4, 5, 6], dtype=uint32)
array([0, 1, 2, 3, 4, 5, 6], dtype=uint32)