Learn R Programming

nandb (version 0.2.1)

BrightnessTimeSeries: Create a Brightness time-series.

Description

Given a stack of images arr, use the first frames.per.set of them to create one brightness image, the next frames.per.set of them to create the next brightness image and so on to get a time-series of brightness images. If tau is specified, bleaching correction is performed via CorrectForBleaching().

Usage

BrightnessTimeSeries(arr, frames.per.set, tau = NA, mst = NULL,
  filt = NULL, n.ch = 1, verbose = FALSE, mcc = parallel::detectCores(),
  seed = NULL)

BrightnessTimeSeriesTxtFolder(folder.path = ".", frames.per.set, ext = "tif", tau = NA, mst = NULL, filt = NULL, n.ch = 1, verbose = FALSE, mcc = parallel::detectCores(), seed = NULL)

Arguments

arr

An array, can be 3- or 4-dimensional. The first two slots give the x- and y-cordinates of pixels respectively. If the array is 3-dimensional, the third slot gives the index of the frame. If it is 4-dimensional, the third slot indexes the channel and the fourth indexes the frame in the stack. To perform this on a file that has not yet been read in, set this argument to the path to that file (a string).

frames.per.set

The number of frames with which to calculate the successive brightnesses.

tau

If this is specified, bleaching correction is performed with CorrectForBleaching() which uses exponential filtering with time constant tau (where the unit of time is the time between frames). If this is set to 'auto', then the value of tau is calculated automatically via BestTau().

mst

Do you want to apply an intensity threshold prior to calculating brightness (via autothresholdr::mean_stack_thresh())? If so, set your thresholding method here.

filt

Do you want to smooth (filt = 'smooth') or median (filt = 'median') filter the brightness image using SmoothFilterB() or MedianFilterB() respectively? If selected, these are invoked here with a filter radius of 1 and with the option na_count = TRUE. If you want to smooth/median filter the brightness image in a different way, first calculate the brightnesses without filtering (filt = NULL) using this function and then perform your desired filtering routine on the result.

n.ch

The number of channels in the image (default 1).

verbose

If arr3d is specified as a file name, print a message to tell the user that that file is now being processed (useful for BrightnessTxtFolder, does not work with multiple cores).

mcc

The number of cores to use for the parallel processing.

seed

If using parallel processing (mcc > 1), a seed for the random number generation for BestTau. Don't use set.seed, it won't work.

folder.path

The path to the folder to process (defaults to current location).

ext

The file extension of the images in the folder that you wish to process. You must wish to process all files with this extension; if there are files that you don't want to process, take them out of the folder. The default is for tiff files. Do not use regular expression in this argument.

Value

An array where the \(i\)th slice is the \(i\)th brightness image.

Details

This may discard some images, for example if 175 frames are in the input and frames.per.set = 50, then the last 25 are discarded. If bleaching or/and thresholding are selected, they are performed on the whole image stack before the sectioning is done for calculation of brightnesses.

See Also

Brightness().

Examples

Run this code
# NOT RUN {
library(magrittr)
img <- ReadImageData(system.file('extdata', '50.tif', package = 'nandb'))
EBImage::display(EBImage::normalize(img[, , 1]), method = 'raster')
bts <- BrightnessTimeSeries(img, 20, tau = NA, mst = "Huang", mcc = 2)
setwd(tempdir())
WriteIntImage(img, '50.tif')
WriteIntImage(img, '50again.tif')
BrightnessTimeSeriesTxtFolder(tau = NA, mcc = 2, frames.per.set = 20)
list.files()
file.remove(list.files())  # cleanup
# }

Run the code above in your browser using DataLab