plotStack: Plot Image Stack with Optional Labels

View source: R/plotStack.R

plotStackR Documentation

Plot Image Stack with Optional Labels

Description

This is a wrapper to plot all frames of an image as a raster object with the option of labeling each frame.

Usage

plotStack(x, labels = FALSE, nx, cex = 1, col = "white", ...)

Arguments

x

An Image object or array of such objects

labels

If FALSE (default value), no labels are added. If TRUE or NULL, frames will be sequentially number. Other values for labels can be provided. Labels are placed in the upper left corner of each frame

nx

The number of frames in the x-direction of the image stack. If missing, a square tile of images will be assumed

cex

Optional character expansion for labels

col

Optional color for labels, default of "white"

...

Additional parameters passed to plot.Image

Details

The image in x will be plotted by the command plot(x, all = TRUE, nx = nx). If labels is not FALSE, labels will be generated and added with labelStack with adj and offset changed from the default values to place the label in the upper left corner of each frame. labels = TRUE will simply number each frame. Other values of labels will be used as a label, replicating the values in labels as necessary.

Value

The image x is invisibly returned to permit passing the argument through a pipe. This function is primarily called to plot an entire Image object.

See Also

labelStack, to place custom labels on each frame of the image stack and locatorStack, that provides an interface for selecting frames from the stack.

Examples

# Sample color image
  img <- readImage(system.file("extdata", "lighthouse.jpg", package="EBImageExtra"))

# separate into 12 smaller images (frames)
  x <- EBImage::untile(img, c(4, 3), lwd = 0)
  plotStack(x, labels = paste("Frame", 1:12))


ornelles/EBImageExtra documentation built on Aug. 10, 2022, 11:44 p.m.