EBImage is an image processing and analysis package for R. Its primary
goal is to enable automated analysis of large sets of images such as those
obtained in high throughput automated microscopy.
EBImage relies on the Image object to store and process images
but also works on multi-dimensional arrays.
European Bioinformatics Institute
European Molecular Biology Laboratory
Wellcome Trust Genome Campus
Hinxton
Cambridge CB10 1SD
UK
The code of propagate is based on the CellProfiler
with permission granted to distribute this particular part under LGPL, the
corresponding copyright (Jones, Carpenter) applies.
The source code is released under LGPL (see the LICENSE
file in the package root for the complete license wording).
This library is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version. This library is distributed
in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
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/EBImage.Rd_%03d_medium.png", width=480, height=480)
> ### Name: EBImage
> ### Title: Package overview
> ### Aliases: EBImage
> ### Keywords: package
>
> ### ** Examples
>
> example(readImage)
redImg> ## Read and display an image
redImg> f = system.file("images", "sample-color.png", package="EBImage")
redImg> x = readImage(f)
redImg> display(x)
redImg> ## Read and display a multi-frame TIFF
redImg> y = readImage(system.file("images", "nuclei.tif", package="EBImage"))
redImg> display(y)
Only the first frame of the image stack is displayed.
To display all frames use 'all = TRUE'.
redImg> ## Read an image directly from a remote location by specifying its URL
redImg> try({
redImg+ im = readImage("http://www-huber.embl.de/EBImage/ExampleImages/berlin.tif")
redImg+ display(im, title = "Berlin Impressions")
redImg+ })
Only the first frame of the image stack is displayed.
To display all frames use 'all = TRUE'.
redImg> ## Convert a PNG file into JPEG
redImg> tempfile = tempfile("", , ".jpeg")
redImg> writeImage(x, tempfile, quality = 85)
redImg> cat("Converted '", f, "' into '", tempfile, "'.\n", sep="")
Converted '/home/ddbj/local/lib64/R/library/EBImage/images/sample-color.png' into '/tmp/RtmpMVC29i/5f583d24bb22.jpeg'.
redImg> ## Save a frame sequence
redImg> files = writeImage(y, tempfile("", , ".jpeg"), quality = 85)
redImg> cat("Files created: ", files, sep="\n")
Files created:
/tmp/RtmpMVC29i/5f58382da758-0.jpeg
/tmp/RtmpMVC29i/5f58382da758-1.jpeg
/tmp/RtmpMVC29i/5f58382da758-2.jpeg
/tmp/RtmpMVC29i/5f58382da758-3.jpeg
> example(display)
disply> ## Display a single image
disply> x = readImage(system.file("images", "sample-color.png", package="EBImage"))[257:768,,]
disply> display(x, "Sample")
disply> ## Display a thresholded sequence ...
disply> y = readImage(system.file("images", "sample.png", package="EBImage"))
disply> yt = list()
disply> for (t in seq(0.1, 5, len=9)) yt=c(yt, list(gblur(y, s=t)))
disply> yt = combine(yt)
disply> ## ... using the browser viewer ...
disply> display(yt, "Blurred images")
Only the first frame of the image stack is displayed.
To display all frames use 'all = TRUE'.
disply> ## ... or using R's build-in raster functions
disply> display(resize(yt, 256, 256), method = "raster", all = TRUE)
disply> ## Display the last frame
disply> display(yt, method = "raster", frame = numberOfFrames(yt, type = "render"))
> example(rotate)
rotate> x <- readImage(system.file("images", "sample.png", package="EBImage"))
rotate> display(x)
rotate> display( flip(x) )
rotate> display( flop(x) )
rotate> display( resize(x, 128) )
rotate> display( rotate(x, 30) )
rotate> display( translate(x, c(120, -20)) )
rotate> m <- matrix(c(0.6, 0.2, 0, -0.2, 0.3, 300), nrow=3)
rotate> display( affine(x, m) )
> example(propagate)
propgt> ## a paraboloid mountain in a plane
propgt> n = 400
propgt> x = (n/4)^2 - matrix(
propgt+ (rep(1:n, times=n) - n/2)^2 + (rep(1:n, each=n) - n/2)^2,
propgt+ nrow=n, ncol=n)
propgt> x = normalize(x)
propgt> ## 4 seeds
propgt> seeds = array(0, dim=c(n,n))
propgt> seeds[51:55, 301:305] = 1
propgt> seeds[301:305, 101:105] = 2
propgt> seeds[201:205, 141:145] = 3
propgt> seeds[331:335, 351:355] = 4
propgt> lambda = 10^seq(-8, -1, by=1)
propgt> segmented = Image(dim=c(dim(x), length(lambda)))
propgt> for(i in seq_along(lambda)) {
propgt+ prop = propagate(x, seeds, lambda=lambda[i])
propgt+ prop = prop/max(prop)
propgt+ segmented[,,i] = prop
propgt+ }
propgt> display(x, title='Image')
propgt> display(seeds/max(seeds), title='Seeds')
propgt> display(segmented, title="Voronoi regions", all=TRUE)
>
>
>
>
>
> dev.off()
null device
1
>