Description Usage Arguments Details "browser" method "raster" method Author(s) See Also Examples
Display images in an interactive JavaScript viewer or using R's built-in graphics capabilities.
1 2 3 4 |
x |
an |
method |
the way of displaying images. Defaults to |
... |
arguments to be passed to the specialized display functions; for details see the sections on individual display methods. |
The default method
used for displaying images depends on whether called from and interactive R session. If interactive()
is TRUE
images are displayed with the "browser"
method, otherwise the "raster"
method is used. This dynamic behavior can be overridden by setting options("EBImage.display")
to either "browser"
or "raster"
.
plot.Image
S3 method is a wrapper for display(..., method="raster")
The "browser"
method runs an interactive JavaScript image viewer. A list of available features along with corresponding mouse and keyboard actions is shown by pressing 'h'. This method takes the following additional arguments.
embed
logical(1), include images in the document as data URIs. Defaults to TRUE
in non-interactive context (e.g. static R Markdown documents), otherwise to FALSE
.
tempDir
character(1), file path for storing any temporary image files. Defaults to tempfile("")
...
arguments passed to createWidget
, such as fixed width
and height
(in CSS units), elementId
, or preRenderHook
.
The "raster"
method displays images as R raster graphics. The user coordinates of the plotting region are set to the image pixel coordinates with the origin (0, 0)
in the upper left corner.
By default only the first frame of an image stack is shown; a different frame
can also be specified. When all=TRUE
the whole image stack is rendered and the frames are automatically positioned next to each other in a grid. The grid layout can be modified through nx
and spacing
and margin
.
This method provides to following additional arguments to display
.
interpolate
a logical vector (or scalar) indicating whether to apply linear interpolation to the image when drawing.
frame
a numeric indicating the frame number to display; only effective when all = FALSE
.
all
logical, defaulting to FALSE
. If set to TRUE
, all frames of a stacked image are displayed arranged in a grid, otherwise (default) just a single frame specified in frame
is displayed. The grid layout can be controlled by nx
, spacing
and margin
.
drawGrid
a logical indicating whether to draw grid lines between individual frames. Defaults to TRUE
unless spacing
is non-zero. Line color, type and width can be specified through graphical parameters col
, lty
and lwd
, respectively; see par
for details.
nx
integer. Specifies the number images in a row. Negative numbers are interpreted as the number of images in a column, e.g. use -1
to display a single row containing all the frames.
spacing
numeric. Specifies the separation between frames as a fraction of frame dimensions (positive numbers <1) or in pixels (numbers >=1). It can be either a single number or a vector of length 2, in which case its elements correspond to the horizontal and vertical spacing, respectively.
margin
numeric. Specifies the outer margins around the image, or a grid of images. Similarly as for spacing
, different horizontal and vertical margins can be defined by providing a vector.
...
graphical parameters passed to par
Andrzej Oles, andrzej.oles@embl.de, 2012-2017
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | ## Display a single image
x = readImage(system.file("images", "sample-color.png", package="EBImage"))[257:768,,]
display(x)
## Display a thresholded sequence ...
y = readImage(system.file("images", "sample.png", package="EBImage"))[366:749, 58:441]
z = lapply(seq(from=0.5, to=5, length=6),
function(s) gblur(y, s, boundary="replicate")
)
z = combine(z)
## ... using the interactive viewer ...
display(z)
## ... or using R's build-in raster device
display(z, method = "raster", all = TRUE)
## Display the last frame
display(z, method = "raster", frame = numberOfFrames(z, type = "render"))
## Customize grid appearance
display(z, method = "raster", all = TRUE,
nx = 2, spacing = 0.05, margin = 20, bg = "black")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.