Detrend fluorescence microscopy image series for fluorescence
fluctuation and correlation spectroscopy ('FCS' and 'FFS') analysis. This
package contains functionality published in a 2016 paper
Detrend image series.
To install the release version (recommended) from CRAN, in R, enter
To install the development version, in R, first install
install.packages("devtools"). Then enter
First let's load the library:
The package contains a sample image series which can be found at
system.file("extdata", "cells.tif", package = "detrendr"). Let's read it in and inspect the first and last frames:
path <- system.file("extdata", "bleached.tif", package = "detrendr")img <- ijtiff::read_tif(path)dim(img) # img has 500 frames
mean(img[, , 1, 1]) # first channel, first frame
#>  152.4489
mean(img[, , 1, 500]) # first channel, last frame
#>  68.51583
We see that the intensity is much lower for the last frame, this is because the image series has been bleached. We can correct for this (and check how long it takes):
system.time(corrected <- img_detrend_exp(img, "auto",seed = 0, parallel = 2))["elapsed"]
#> elapsed #> 7.589
mean(corrected[, , 1, 1]) # first channel, first frame
#>  112.9569
mean(corrected[, , 1, 500]) # first channel, last frame
#>  103.33
So we see that the corrected series does not have this drop-off in intensity.
For more detailed instruction on how to use the package, see
Contributions to this package are welcome. The preferred method of contribution is through a github pull request. Feel free to contact me by creating an issue. Please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms.
base::sample(). A more permanent fix should be provided when R 3.6 has landed.
RSAGA, making it lighter.
NAs in simulated brightnesses were needlessly causing the automatic parameter-finding routines to fail.