| Image {EBImage} | R Documentation |
The package EBImage uses the class Image to store and process
images. Images are stored as multi-dimensional arrays containing the pixel
intensities. The class Image extends the base class array and
uses the colormode slot to store how the color information of
the multi-dimensional data is handled.
The colormode slot could be either Grayscale or Color. In both modes, the
two first dimensions of the underlying array are understood to be the spatial
dimensions of the image. In the Grayscale mode, the remaining dimensions
contain other images. In the the Color mode, the third dimension contains
the red, green and blue channels of the image and the remaining dimensions contain
other images. The color mode TrueColor exists but is deprecated.
All methods of the package EBImage works either with Image objects or
multi-dimensional arrays but in the latter case, the color mode is assumed to be
Grayscale.
Image(data, dim, colormode)
as.Image(x)
is.Image(x)
colorMode(y)
colorMode(y) <- value
imageData(y)
imageData(y) <- value
getNumberOfFrames(y, type='total')
data |
A vector or array containing the pixel intensities of an image. If missing, a default 1x1 null array is used. |
dim |
A vector containing the final dimensions of an Image object. If missing, equals to
dim(data). |
colormode |
A numeric or a character string containing the color mode which could be
either Grayscale or Color. If missing, equals to
Grayscale. |
x |
An R object. |
y |
An Image object or an array. |
value |
For colorMode, a numeric or a character string containing the color mode which
could be either Grayscale or Color. For imageData, an Image object or an array. |
type |
A character string containing total or render. If missing, equals to
total. |
Depending of type, getNumberOfFrames returns the total number of frames contained
in the object y or the number of renderable frames. The total number of frames is independent
of the color mode and is equal to the product of all the dimensions except the two first ones. The
number of renderable frames is equal to the total number of frames in the Grayscale color mode
and is equal to the product of all the dimensions except the three first ones in the Color color mode.
Image and as.Image return a new Image object.
is.Image returns TRUE if x is an Image object and FALSE otherwise.
colorMode returns the color mode of y and colorMode<- changes the color mode
of y.
imageData returns the array contained in an Image object.
Oleg Sklyar, osklyar@ebi.ac.uk, 2005-2007
s1 = exp(12i*pi*seq(-1, 1, length=300)^2)
y = Image(outer(Im(s1), Re(s1)))
if (interactive()) display(normalize(y))
x = Image(rnorm(300*300*3),dim=c(300,300,3), colormode='Color')
if (interactive()) display(x)
w = matrix(seq(0, 1, len=300), nc=300, nr=300)
m = abind(w, t(w), along=3)
z = Image(m, colormode='Color')
if (interactive()) display(normalize(z))
y = Image(c('red', 'violet', '#ff51a5', 'yellow'), dim=c(71, 71))
if (interactive()) display(y)
## colorMode example
x = readImage(system.file('images', 'nuclei.tif', package='EBImage'))
x = x[,,1:3]
if (interactive()) display(x, title='Cell nuclei')
colorMode(x)=Color
if (interactive()) display(x, title='Cell nuclei in RGB')