bwlabel(EBImage)
bwlabel()所属R语言包:EBImage
Binary segmentation
二元分割
译者:生物统计家园网 机器人LoveR
描述----------Description----------
Labels connected (connected sets) objects in a binary image.
标签连接(连接套),在一个二进制图像对象。
用法----------Usage----------
bwlabel(x)
参数----------Arguments----------
参数:x
An Image object or an array. x is considered as a binary image, whose pixels of value 0 are considered as background ones and other pixels as foreground ones.
Image对象或数组。 x被视为一个二进制图像,其像素值0作为背景的其他像素和前景的考虑。
Details
详情----------Details----------
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.
每个连接的前景(非零)x设置为一个独特的递增的整数,从1开始的像素所有像素。因此,max(x)给x连接对象。
值----------Value----------
An Grayscale Image object or an array, containing the labelled version of x.
GrayscaleImage对象或数组,包含x的标记版本。
作者(S)----------Author(s)----------
Gregoire Pau, 2009
举例----------Examples----------
## simple example[#简单的例子]
x = readImage(system.file('images', 'shapes.png', package='EBImage'))
x = x[110:512,1:130]
if (interactive()) display(x, title='Binary')
y = bwlabel(x)
if (interactive()) display(normalize(y), title='Segmented')
## read nuclei images[#读核图像]
x = readImage(system.file('images', 'nuclei.tif', package='EBImage'))
if (interactive()) display(x)
## computes binary mask[#计算二进制掩码]
y = thresh(x, 10, 10, 0.05)
y = opening(y, makeBrush(5, shape='disc'))
if (interactive()) display(y, title='Cell nuclei binary mask')
## bwlabel[#bwlabel]
z = bwlabel(y)
if (interactive()) display(normalize(z), title='Cell nuclei')
nbnuclei = apply(z, 3, max)
cat('Number of nuclei=', paste(nbnuclei, collapse=','),'\n')
## recolor nuclei in colors[#重新着色单元核在颜色]
cols = c('black', sample(rainbow(max(z))))
zrainbow = Image(cols[1+z], dim=dim(z))
if (interactive()) display(zrainbow, title='Cell nuclei (recolored)')
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|