as_EBImage: Convert an ijtiff_img to an EBImage::Image.

View source: R/class_constructors.R

as_EBImageR Documentation

Convert an ijtiff_img to an EBImage::Image.

Description

This is for interoperability with the the EBImage package.

Usage

as_EBImage(img, colormode = NULL, scale = TRUE, force = TRUE)

Arguments

img

An ijtiff_img object (or something coercible to one).

colormode

A numeric or a character string containing the color mode which can be either "Grayscale" or "Color". If not specified, a guess is made. See 'Details'.

scale

Scale values in an integer image to the range ⁠[0, 1]⁠? Has no effect on floating-point images.

force

This function is designed to take ijtiff_imgs as input. To force any old array through this function, use force = TRUE, but take care to check that the result is what you'd like it to be.

Details

The guess for the colormode is made as follows: * If img has an attribute color_space with value "RGB", then colormode is set to "Color". * Else if img has 3 or 4 channels, then colormode is set to "Color". * Else colormode is set to "Grayscale".

Value

An EBImage::Image.

Examples

if (rlang::is_installed("EBImage")) {
  img <- read_tif(system.file("img", "Rlogo.tif", package = "ijtiff"))
  str(img)
  str(as_EBImage(img))
}

ijtiff documentation built on Oct. 9, 2023, 1:07 a.m.