Learn R Programming

detrendr (version 0.1.0)

best_l: Find the best length parameter for boxcar detrending.

Description

Use Nolan's algorithm to find the ideal length parameter for boxcar detrending. Boxcar detrending is also referred to as 'running average'.

Usage

best_l(img, seed = NULL, parallel = FALSE)

Arguments

img

A 3-dimensional array of integers representing the image series. img[i, j, k] is the pixel at x = i, y = j in frame k of the image series.

seed

A seed for the random number generation needed in this function. If you do not set a seed, one will be chosen randomly.

parallel

Do you want this function to run on multiple cores? If not, use parallel = FALSE (the default). To use n cores, use parallel = n or to use all available cores use parallel = TRUE.

Value

If no detrend is necessary, this function returns NA. If a detrend is required, this function returns a natural number which is the ideal length parameter for boxcar detrending.

References

Rory Nolan, Luis A. J. Alvarez, Jonathan Elegheert, Maro Iliopoulou, G. Maria Jakobsdottir, Marina Rodriguez-Mu<U+00F1>oz, A. Radu Aricescu, Sergi Padilla-Parra; nandb<U+2014>number and brightness in R with a novel automatic detrending algorithm, Bioinformatics, https://doi.org/10.1093/bioinformatics/btx434.

Examples

Run this code
# NOT RUN {
## These examples are not run on CRAN because they take too long.
## You should still try them for yourself.
img <- read_tif(system.file('extdata', 'bleached.tif', package = 'detrendr'),
                n_ch = 1)
best_l(img, seed = 0, parallel = 2)
# }

Run the code above in your browser using DataLab