Merging labels
In principle, all segmentation algorithms are limited. In case results are sub-optimal and no better segmentation algorithm is available, post-processing labels may be an option. There are some functions available for merging labels according to their properties such as intensity along the edge where labels touch the pixel count of pair-wise combined labels.
<NVIDIA GeForce RTX 3050 Ti Laptop GPU on Platform: NVIDIA CUDA (1 refs)>
Merging touching labels
The most trivial use-case might be merging labeled objects that touch.
|
cle._ image
shape | (254, 256) |
dtype | uint32 |
size | 254.0 kB |
min | 0.0 | max | 72.0 |
|
|
cle._ image
shape | (254, 256) |
dtype | uint32 |
size | 254.0 kB |
min | 0.0 | max | 61.0 |
|
Merging labels according to border intensity
As an example we use a cropped slice of the cells3d
example dataset in scikit-image.
|
cle._ image
shape | (100, 100) |
dtype | float32 |
size | 39.1 kB |
min | 1062.0 | max | 20614.0 |
|
In the following example, our cell in the center of the image was wrongly segmented as two cells:
|
nsbatwm made image
shape | (100, 100) |
dtype | int32 |
size | 39.1 kB |
min | 1 | max | 12 |
|
This can be corrected by merging cells with border intensity below a given threshold.
c:\structure\code\pyclesperanto_prototype\pyclesperanto_prototype\_tier3\_generate_touch_mean_intensity_matrix.py:30: UserWarning: generate_touch_mean_intensity_matrix is supposed to work with images of integer type only.
Loss of information is possible when passing non-integer images.
warnings.warn("generate_touch_mean_intensity_matrix is supposed to work with images of integer type only.\n" +
|
cle._ image
shape | (100, 100) |
dtype | uint32 |
size | 39.1 kB |
min | 1.0 | max | 8.0 |
|