best_degree: Find the best polynomial degree for polynomial detrending.

Description Usage Arguments Value References Examples

View source: R/best_degree.R

Description

Use Nolan's algorithm to find the ideal polynomial degree for polynomial detrending.

Usage

1
best_degree(img, parallel = FALSE, purpose = c("FCS", "FFS"))

Arguments

img

A 4-dimensional array in the style of an ijtiff_img (indexed by img[y, x, channel, frame]) or a 3-dimensional array which is a single channel of an ijtiff_img (indexed by img[y, x, frame]).

parallel

Would you like to use multiple cores to speed up this function? If so, set the number of cores here, or to use all available cores, use parallel = TRUE.

purpose

What type of calculation do you intend to perform on the detrended image? If it is an FFS (fluorescence fluctuation spectroscopy) calculation (like number and brightness), choose 'FFS'. If it is an FCS (fluorescence correlation spectroscopy) calculation (like cross-correlated number and brightness or autocorrelation), choose 'FCS'. The difference is that if purpose is 'FFS', the time series is corrected for non-stationary mean and variance, whereas if purpose is 'FCS', the time series is corrected for non-stationary mean only. 'purpose“ is not required for Robin Hood detrending.

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 polynomial degree for polynomial detrending. If there are multiple channels, the function returns a vector, one degree parameter for each channel.

References

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

Examples

1
2
3
4
5
6
7
8
## Not run: 
## These examples are not run on CRAN because they take too long.
## You can still try them for yourself.
img <- ijtiff::read_tif(system.file('extdata', 'bleached.tif',
                                    package = 'detrendr'))
best_degree(img, parallel = 2)

## End(Not run)

detrendr documentation built on Nov. 9, 2018, 5:06 p.m.