Given a stack of images img
, 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.
Usage
brightness_timeseries(
img,
def,
frames_per_set,
overlap = FALSE,
thresh = NULL,
detrend = FALSE,
quick = FALSE,
filt = NULL,
s = 1,
offset = 0,
readout_noise = 0,
parallel = FALSE
)
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 byimg[y, x, frame]
).- def
A character. Which definition of brightness do you want to use,
"B"
or"epsilon"
?- frames_per_set
The number of frames with which to calculate the successive brightnesses.
- overlap
A boolean. If
TRUE
, the windows used to calculate number are overlapped, ifFALSE
, they are not. For example, for a 20-frame image series with 5 frames per set, if the windows are not overlapped, then the frame sets used are 1-5, 6-10, 11-15 and 16-20; whereas if they are overlapped, the frame sets are 1-5, 2-6, 3-7, 4-8 and so on up to 16-20.- thresh
The threshold or thresholding method (see
autothresholdr::mean_stack_thresh()
) to use on the image prior to detrending and brightness calculations.- detrend
Detrend your data with
detrendr::img_detrend_rh()
. This is the best known detrending method for brightness analysis. For more fine-grained control over your detrending, use thedetrendr
package. If there are many channels, this may be specified as a vector, one element for each channel.- quick
If
FALSE
(the default), the swap finding routine is run several times to get a consensus for the best parameter. IfTRUE
, the swap finding routine is run only once.- filt
Do you want to smooth (
filt = 'mean'
) or median (filt = 'median'
) filter the number image usingsmooth_filter()
ormedian_filter()
respectively? If selected, these are invoked here with a filter radius of 1 (with corners included, so each median is the median of 9 elements) and with the optionna_count = TRUE
. If you want to smooth/median filter the number image in a different way, first calculate the numbers without filtering (filt = NULL
) using this function and then perform your desired filtering routine on the result. If there are many channels, this may be specified as a vector, one element for each channel.- s
A positive number. The \(S\)-factor of microscope acquisition.
- offset
Microscope acquisition parameters. See reference Dalal et al.
- readout_noise
Microscope acquisition parameters. See reference Dalal et al.
- 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
.
Value
An object of class brightness_ts_img.
If
img
is 4-dimensional (i.e. 2-channel), a 4-dimensional arrayarr
is returned witharr[y, x, c, t]
being pixel \((x, y)\) of the \(c\)th channel of the \(t\)th brightness image in the brightness time series.
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 detrending is
selected, it is performed on the whole image stack before the sectioning is
done for calculation of numbers.
Examples
# \donttest{
img <- ijtiff::read_tif(system.file("extdata", "50.tif", package = "nandb"))
#> Reading 50.tif: an 8-bit, 50x50 pixel image of unsigned
#> integer type. Reading 1 channel and 50 frames . . .
#> Done.
bts <- brightness_timeseries(img, "e", frames_per_set = 20, thresh = "Huang")
# }