Entering edit mode
atbest09
•
0
@atbest09-15478
Last seen 6.3 years ago
Hi all,
Does any one know how to remove objects that have holes using EBImage? For example, I converted the nuclei.tif file into a mask file using the follow code. Now how can I get rid of the nuclei with holes? Thanks.
x = readImage(system.file(file.path("images","nuclei.tif"), package="EBImage"), all = FALSE) y=thresh(x, w = 15, h = 15, offset = 0.1) objects = bwlabel(y) display(objects)
Thank you Wolfgang for providing a solution to the problem. This is probably the way to go. Note that there is a dedicated function
rmObjects
to remove objects from images which is the preferred approach for performance reasons. It also provides an easy way to re-label objects such that the maximum index corresponds to the number of objects in the image. Consider the following modified code which additionally reuses the intermediate resultyf = fillHull(y)
when subsettingobjects
.