Learn R Programming

EBImage (version 4.14.2)

display: Image Display

Description

Display images using an interactive JavaScript viewer or R's built-in graphics capabilities.

Usage

display(x, title = deparse(substitute(x), width.cutoff = 500L, nlines = 1), method, frame, all = FALSE, ...)

Arguments

x
an Image object or an array.
title
a character string used as a window title.
method
the method used to display images, can be browser or raster. Defaults to browser when R is used interactively and raster otherwise. The default behavior can be overridden by setting options("EBImage.display"). See Details.
frame
a numeric indicating the frame number; only works in conjunction with method = "raster" and all = FALSE.
all
should all frames of a stacked image be displayed, or just a single frame?
...
arguments passed to internal methods

Value

Invisible NULL.

Details

The default method used for displaying images depends on whether called from and interactive R session. If interactive() returns TRUE images are displayed using the "browser" method, otherwise the "raster" method is used. This behavior can be overridden and the default display method fixed regardless the interactivity by setting options("EBImage.display") to either "browser" or "raster".

The "browser" method runs an interactive JavaScript image viewer using the default web browser. Multiple windows or tabs can be opened in this way. Pressing 'h' displays a list of available features along with corresponding mouse and keyboard actions.

The "raster" method displays images as raster graphics using R's build-in functions. By default only the first frame of a stacked image is shown; a different frame can be specified using the frame argument. When all=TRUE all frames are rendered and automatically positioned next to each other in a grid. The user coordinates of the plotting region are set to the image pixel coordinates with the origin (0, 0) in the upper left corner.

References

Mozilla Firefox

Examples

Run this code
  ## Display a single image
  x = readImage(system.file("images", "sample-color.png", package="EBImage"))[257:768,,]
  display(x, "Sample")

  ## Display a thresholded sequence ...
  y = readImage(system.file("images", "sample.png", package="EBImage"))
  yt = list()
  for (t in seq(0.1, 5, len=9)) yt=c(yt, list(gblur(y, s=t)))
  yt = combine(yt)

  ## ... using the browser viewer ...
  display(yt, "Blurred images")

  ## ... or using R's build-in raster functions
  display(resize(yt, 256, 256), method = "raster", all = TRUE)

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

Run the code above in your browser using DataLab