Batch processing. Apply any of the available detrending routines to detrend all of the TIFF images in a folder, saving the detrended images as TIFF files in the same folder.

dir_detrend_robinhood(
  folder_path = ".",
  swaps = "auto",
  thresh = NULL,
  quick = FALSE,
  msg = TRUE
)

dir_detrend_rh(
  folder_path = ".",
  swaps = "auto",
  thresh = NULL,
  quick = FALSE,
  msg = TRUE
)

dir_detrend_boxcar(
  folder_path = ".",
  l,
  purpose = c("FCS", "FFS"),
  thresh = NULL,
  parallel = FALSE,
  msg = TRUE
)

dir_detrend_exp(
  folder_path = ".",
  tau,
  purpose = c("FCS", "FFS"),
  thresh = NULL,
  parallel = FALSE,
  msg = TRUE
)

dir_detrend_polynom(
  folder_path = ".",
  degree,
  purpose = c("FCS", "FFS"),
  thresh = NULL,
  parallel = FALSE,
  msg = TRUE
)

Arguments

folder_path

The path (relative or absolute) to the folder you wish to process.

swaps

The number of swaps (giving of one count from rich to poor) to perform during the Robin Hood detrending. Set this to "auto" (the default) to use Nolan's algorithm to automatically find a suitable value for this parameter (recommended). For multi-channel images, it is possible to have a different swaps for each channel by specifying swaps as a vector or list.

thresh

The threshold or thresholding method (see autothresholdr::mean_stack_thresh()) to use on the image prior to detrending.

quick

If FALSE (the default), the swap finding routine is run several times to get a consensus for the best parameter. If TRUE, the swap finding routine is run only once.

msg

Receive messages to tell you how the processing of the directory is going? Default is yes.

l

The length parameter for boxcar detrending. The size of the sliding window will be 2 * l + 1. This must be a positive integer. Set this to "auto" to use Nolan's algorithm to automatically find a suitable value for this parameter (recommended). For multi-channel images, it is possible to have a different l for each channel by specifying l as a vector or list.

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.

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.

tau

The \(tau\) parameter for exponential filtering detrending. This must be a positive number. Set this to "auto" to use Nolan's algorithm to automatically find a suitable value for this parameter (recommended). For multi-channel images, it is possible to have a different tau for each channel by specifying tau as a vector or list.

degree

The degree of the polynomial to use for the polynomial detrending. This must be a positive integer. Set this to "auto" to use Nolan's algorithm to automatically find a suitable value for this parameter (recommended). For multi-channel images, it is possible to have a different degree for each channel by specifying degree as a vector or list.

Value

Silently, a character vector of the paths to the detrended images.

Details

These functions include a thresholding option, unlike their non-batch processing counterparts which they wrap (i.e. img_detrend_boxcar, img_detrend_exp and img_detrend_polynom). This is because, when working interactively, it's easy to threshold and then detrend, but for batch processing, it's not so easy to efficiently do one after the other, so it's nice to have that taken care of should you want it.

Examples

if (FALSE) { # \dontrun{
setwd(tempdir())
file.copy(
  c(
    system.file("extdata", "bleached.tif", package = "detrendr"),
    system.file("img", "2ch_ij.tif", package = "ijtiff")
  ),
  "."
)
dir_detrend_robinhood(thresh = "huang")
dir_detrend_boxcar(l = "auto", thresh = "tri", purpose = "FFS")
dir_detrend_exp(tau = "auto", thresh = "tri", purpose = "FCS")
dir_detrend_polynom(degree = "auto", thresh = "huang", purpose = "FFS")
} # }