EBImage: Package overview

Description Package content Authors Examples

Description

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.

Package content

Image methods

Image I/O, display

Spatial transforms

Image segmentation, objects manipulation

Image enhancement, filtering

Morphological operations

Color space manipulation

Image stacking, combining, tiling

Drawing on images

Features extraction

Defunct

Authors

Oleg Sklyar, osklyar@ebi.ac.uk, Copyright 2005-2007

Gregoire Pau, gpau@ebi.ac.uk

Wolfgang Huber, huber@ebi.ac.uk

Andrzej Oles, andrzej.oles@embl.de

Mike Smith, msmith@ebi.ac.uk

1
2
3
4
5
6
7
  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.

See the GNU Lesser General Public License for more details. For LGPL license wording see http://www.gnu.org/licenses/lgpl.html

Examples

1
2
3
4

Example output

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+   })
Error in transpose(y) : object is NULL
In addition: Warning message:
In .loadFun(files, ...) :
  URL 'http://www-huber.embl.de/EBImage/ExampleImages/berlin.tif': status was 'Couldn't resolve host name'

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 '/usr/lib/R/site-library/EBImage/images/sample-color.png' into '/work/tmp/tmp/Rtmptz7NSz/6c5744bdc402.jpeg'.

redImg>   ## Save a frame sequence
redImg>   files = writeImage(y, tempfile("", , ".jpeg"), quality = 85)

redImg>   cat("Files created: ", files, sep="\n")
Files created: 
/work/tmp/tmp/Rtmptz7NSz/6c5752404435-0.jpeg
/work/tmp/tmp/Rtmptz7NSz/6c5752404435-1.jpeg
/work/tmp/tmp/Rtmptz7NSz/6c5752404435-2.jpeg
/work/tmp/tmp/Rtmptz7NSz/6c5752404435-3.jpeg

disply> ## Display a single image
disply> x = readImage(system.file("images", "sample-color.png", package="EBImage"))[257:768,,]

disply> display(x, title="Sample")

disply> ## Display a thresholded sequence ...
disply> y = readImage(system.file("images", "sample.png", package="EBImage"))[366:749, 58:441]

disply> z = lapply(seq(from=0.5, to=5, length=6),
disply+   function(s) gblur(y, s, boundary="replicate")
disply+ )

disply> z = combine(z)

disply> ## ... using the browser viewer ...
disply> display(z, title="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 device
disply> display(z, method = "raster", all = TRUE)

disply> ## Display the last frame 
disply> display(z, method = "raster", frame = numberOfFrames(z, type = "render"))

disply> ## Customizing grid appearance
disply> display(z, method = "raster", all = TRUE,
disply+         nx = 2, spacing = 0.05, margin = 20, bg = "black")

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) )

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)

EBImage documentation built on Nov. 8, 2020, 5:41 p.m.