drawImage {imageUtilities}R Documentation

plots an image on an R device using the "grid" package.

Description

plots an image on an R device using the "grid" package.

Usage

  drawImage(img, max = imageUtilities.option("max"),
    dev.new = TRUE, maxWidth = unit(7, "inches"),
    resize = FALSE,
    transpose = imageUtilities.option(".using.Voir"), ...)

Arguments

img

a heightxwidthxchannels *array* with the number of channels

max

max intensity of image

dev.new

whether to open up new device (sometimes may be nice not to in order to draw on an existing device).

transpose

boolean, whether to transpose image before drawing (should not need to be used – just for compatibility between Voir and non-Voir versions of the package)

maxWidth

the maximum width the image should be. Can be either a number (in which case it will be interpreted as *pixels*), or a unit of the form unit(width,type) where type is one of 'npc' or 'inches' (see convertScreenUnits). The *display* will be resized to approximately this size (although the image displayed will not be subsampled in any way). However, if parameter resize is TRUE, this changes the behaviour.

resize

boolean. If this is set to TRUE, then instead of resizing the *display* to maxWidth, the *image* will be subsampled to this size (although the scale will still be as for the full-size image so that grid.locator() still returns the right coordinates.

...

passed into viewport command used to draw the image.

Value

handle to the viewport.

Note

The coordinate system is set up such that the *middle* of the top-left pixel has coordinates (1,1) (ie 1-based). Y increases downwards and X increases left-to-right (ie, an i-j coordinate system).

The middles of pixels have integer coordinates.

See Also

Other draw: imdisp, imdrawabline, imdrawline, plotPoints, pointPicker


[Package imageUtilities version 1.0.3 Index]