Learn R Programming

detrendr (version 0.1.0)

read_tif: Read tiff image as array object.

Description

Read in a tiff image file from the disk as an array of pixel intensities.

Usage

read_tif(path, n_ch = 1)

Arguments

path

The path to the image file on disk.

n_ch

The number of channels in the image.

Value

An array of integers representing the image.

Details

This function wraps tiff::readTIFF().

Thinking of the read image as a matrix mat, the pixel at \(x = \)i, \(y = \)j has colour based on the value of mat[j, i] where the \(x\) axis points right and the \(y\) axis points down. However, when one prints a matrix in a console (or views it in a program such as excel), the value in position \(x = \)i, \(y = \)j is from mat[j, i], so if you're confused about a phantom transposition, this is why.

If the result has

Examples

Run this code
# NOT RUN {
img <- read_tif(system.file('extdata', 'bleached.tif', package = 'detrendr'),
                n_ch = 1)
display(img[, , 1])

# }

Run the code above in your browser using DataLab