as.raster.ijtiff_img | R Documentation |
This function converts an ijtiff_img object to a raster
object that can
be used with base R graphics functions. The function extracts the first frame
of the image and converts it to an RGB raster representation.
## S3 method for class 'ijtiff_img'
as.raster(x, ...)
x |
An ijtiff_img object. This should be a 4D array with dimensions representing (y, x, channel, frame). |
... |
Passed to |
The function performs the following operations:
Extracts the first frame of the image
Checks for invalid values (all NA or negative values)
Determines the appropriate color scaling based on the image bit depth
Creates an RGB representation using the available channels
For single-channel images, a grayscale representation is created. For RGB images (3 channels), a full-color representation is created.
A raster
object compatible with graphics::plot.raster()
. The
raster will represent the first frame of the input image.
# Read a TIFF image
img <- read_tif(system.file("img", "Rlogo.tif", package = "ijtiff"))
# Convert to raster and plot
raster_img <- as.raster(img)
plot(raster_img)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.