Description Usage Arguments Details Value Author(s) See Also Examples
Labels connected (connected sets) objects in a binary image.
1 | bwlabel(x)
|
x |
An |
All pixels for each connected set of foreground (non-zero) pixels
in x
are set to an unique increasing integer, starting from 1.
Hence, max(x)
gives the number of connected objects in x
.
A Grayscale
Image
object or an array, containing the
labelled version of x
.
Gregoire Pau, 2009
computeFeatures
, propagate
, watershed
, paintObjects
, colorLabels
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | ## simple example
x = readImage(system.file('images', 'shapes.png', package='EBImage'))
x = x[110:512,1:130]
display(x, title='Binary')
y = bwlabel(x)
display(normalize(y), title='Segmented')
## read nuclei images
x = readImage(system.file('images', 'nuclei.tif', package='EBImage'))
display(x)
## computes binary mask
y = thresh(x, 10, 10, 0.05)
y = opening(y, makeBrush(5, shape='disc'))
display(y, title='Cell nuclei binary mask')
## bwlabel
z = bwlabel(y)
display(normalize(z), title='Cell nuclei')
nbnuclei = apply(z, 3, max)
cat('Number of nuclei=', paste(nbnuclei, collapse=','),'\n')
## paint nuclei in color
cols = c('black', sample(rainbow(max(z))))
zrainbow = Image(cols[1+z], dim=dim(z))
display(zrainbow, title='Cell nuclei (recolored)')
|
Only the first frame of the image stack is displayed.
To display all frames use 'all = TRUE'.
Only the first frame of the image stack is displayed.
To display all frames use 'all = TRUE'.
Only the first frame of the image stack is displayed.
To display all frames use 'all = TRUE'.
Number of nuclei= 77,84,94,90
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.