Image {EBImage} | R Documentation

## Image creation, copying and assertion

### Description

Functions to create, copy and assert images.

### Usage

      Image(data=array(0,c(0,0,1)), dim=base::dim(data), colormode, ...)

      is.Image(x)
      stopIfNotImage(x)

      ## S4 methods for signature 'x=Image'
      copy(x, ...)
      header(x, ...)

      ## S4 methods for signatures 'x=Image,y=Image'
      ## and 'x=list,y=missing'
      combine(x, y, ...)

      ## S4 methods for signatures 'x=Image,y=Image'
      ## and 'x=Image,y=missing'
      assert(x, y, strict=FALSE, ...)

### Arguments

`x, y` | Objects of class `Image`. There is also a `combine` method for lists of equally sized `Image` objects, in that case `y` should be missing.
`data` | Data to fill the image, typically an array, but can be any object for which `as.numeric` or `as.integer` is defined.
`dim` | A numeric vector of image dimensions with length of 2 or 3. If its length is 2, the third dimension is set to 1.
`colormode` | An integer value for the image data color mode. It is recommended to use the predefined symbols `TrueColor` or `Grayscale`.
`strict` | A logical scalar. If `TRUE`, the size of all three dimensions of two images will be compared, if `FALSE`, the function will compare only the first two dimensions (i.e. stacks can have different size in z-direction, but x- and y-size should be the same).
`...` | With `Image`, further arguments to `new`; with `combine`, further images to be combined.

### Details

`Image`
  This is a wrapper around `new`, for convenience.
`copy`
  Makes an identical copy of an object of `Image` enforcing allocation of new memory for the image data. Note that in R, a simple assignment like `a<-b` does lead to copying of the data until either `a` or `b` are further modified.
`combine`
  Acts similarly to `rbind` and `cbind`. It allows to combine images to stacks adding further images at the back of the first one. Properties of the first image in the argument `x` are transferred to the result. All images must be of the same size (in first two dimensions) and color mode. If applied to a list of images, it calls `do.call("combine", x)`
`header`
  Acts similarly to copy, but does not copy the actual image data, only all the other slots. This function can be useful for creating new images from existing large ones preserving attributes.
`is.Image`
  Returns `TRUE` if argument is a valid `Image` and `FALSE` otherwise.
`assert`
  Compares dimensions and color modes of two images. If argument `strict` is `FALSE` images are allowed to have different number of frames.

### Value

The constructors `Image`, `copy`, `combine` and `header` return a new object of `Image`.
`assert` and `is.Image` return a `logical`.
`stopIfNotImage` will return invisible `NULL` if its argument is of `Image` and an error message otherwise.

### Author(s)

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

### See Also

`Image, IndexedImage, readImage`

### Examples

      i1 = Image()
      sx = exp(24i*pi*seq(-1, 1, length=300)^2)
      i2 = Image(outer(Im(sx), Re(sx)))
      if (interactive()) display(normalize(i2))
      i3 <- copy(i2)
      is.Image(i2)

      ## see 'stackObjects' for example on combine

[Package EBImage version 2.4.0 Index]