This is for interoperability with the the EBImage
package.
as_EBImage(img, colormode = NULL, scale = TRUE, force = TRUE)
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 |
scale | Scale values in an integer image to the range |
force | This function is designed to take ijtiff_imgs as input. To
force any old array through this function, use |
An EBImage::Image.
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".
if (rlang::is_installed("EBImage")) { img <- read_tif(system.file("img", "Rlogo.tif", package = "ijtiff")) str(img) str(as_EBImage(img)) }#>#>#>#> 'ijtiff_img' num [1:76, 1:100, 1:4, 1] 0 0 0 0 0 0 0 0 0 0 ... #> - attr(*, "width")= int 100 #> - attr(*, "length")= int 76 #> - attr(*, "bits_per_sample")= int 8 #> - attr(*, "samples_per_pixel")= int 4 #> - attr(*, "sample_format")= chr "uint" #> - attr(*, "planar_config")= chr "contiguous" #> - attr(*, "rows_per_strip")= int 76 #> - attr(*, "compression")= chr "LZW" #> - attr(*, "x_resolution")= num 300 #> - attr(*, "y_resolution")= num 300 #> - attr(*, "resolution_unit")= chr "inch" #> - attr(*, "orientation")= chr "top_left" #> - attr(*, "color_space")= chr "RGB" #> Formal class 'Image' [package "EBImage"] with 2 slots #> ..@ .Data : num [1:100, 1:76, 1:4, 1] 0 0 0 0 0 0 0 0 0 0 ... #> ..@ colormode: int 2