This is for interoperability with the the EBImage
package.
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.
Value
An EBImage::Image.
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".
Examples
if (rlang::is_installed("EBImage")) {
img <- read_tif(system.file("img", "Rlogo.tif", package = "ijtiff"))
str(img)
str(as_EBImage(img))
}
#> Reading Rlogo.tif: an 8-bit, 76x100 pixel image of unsigned
#> integer type. Reading 4 channels and 1 frame . . .
#> Done.
#> '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
#> ..$ dim: int [1:4] 100 76 4 1