Color codes the labels of object masks by a random permutation.
Usage
colorLabels(x, normalize = TRUE)
Arguments
x
an Image object in Grayscale color mode or an array containing object masks. Object masks are sets of pixels with the same unique integer value
normalize
if TRUE normalizes the resulting color image
Details
Performs color coding of object masks, which are typically obtained using the bwlabel function. Each label from x is assigned an unique color. The colors are distributed among the labels using a random permutation. If normalize is set to TRUE the intensity values of the resulting image are mapped to the [0,1] range.
Value
An Image object containing color coded objects of x.
Author(s)
Bernd Fischer, Andrzej Oles, 2013-2014
See Also
bwlabel, normalize
Examples
x = readImage(system.file('images', 'shapes.png', package='EBImage'))
x = x[110:512,1:130]
y = bwlabel(x)
z = colorLabels(y)
display(z, title='Colored segmentation')
Results
R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> library(EBImage)
> png(filename="/home/ddbj/snapshot/RGM3/R_BC/result/EBImage/colorLabels.Rd_%03d_medium.png", width=480, height=480)
> ### Name: colorLabels
> ### Title: Color Code Labels
> ### Aliases: colorLabels
>
> ### ** Examples
>
> x = readImage(system.file('images', 'shapes.png', package='EBImage'))
> x = x[110:512,1:130]
> y = bwlabel(x)
> z = colorLabels(y)
> display(z, title='Colored segmentation')
>
>
>
>
>
> dev.off()
null device
1
>