Remove labels on image edges
When analysing image scientifically, it is often relevant that only object in the image are analyzed that are fully captured.
Our starting point shall be a label image; for example derived from blobs.tif through thresholding and connected component labeling:
c:\structure\code\pyclesperanto_prototype\pyclesperanto_prototype\_tier9\_imshow.py:34: UserWarning: cle.imshow is deprecated, use stackview.imshow instead.
warnings.warn("cle.imshow is deprecated, use stackview.imshow instead.")
|
cle._ image
shape | (254, 256) |
dtype | uint32 |
size | 254.0 kB |
min | 0.0 | max | 62.0 |
|
Number of objects in the image: 62
In case the size of the objects is relevant, one should exclude the object which were not fully imaged and thus, touch the image border.
|
shape | (254, 256) |
dtype | uint32 |
size | 254.0 kB |
min | 0 | max | 55 |
|
Note that the maximum intensity in the label image above is 55 and the number of objects is 44 (see below). Thus, this is a label image where not all labels between 1 and 44 are present.
Number of objects in the image: 44
Subsequently labeling
Many algorithms for further processing of label images required that labels are subsequently labeled. Thus, we need to fix this with the image above.
|
shape | (254, 256) |
dtype | uint32 |
size | 254.0 kB |
min | 0 | max | 44 |
|
Other implementations for removing objects on image edges do not require this step:
|
cle._ image
shape | (254, 256) |
dtype | uint32 |
size | 254.0 kB |
min | 0.0 | max | 44.0 |
|
Number of objects in the image: 44