Title: | Number and Brightness Image Analysis |
---|---|
Description: | Calculation of molecular number and brightness from fluorescence microscopy image series. The software was published in a 2016 paper <doi:10.1093/bioinformatics/btx434>. The seminal paper for the technique is Digman et al. 2008 <doi:10.1529/biophysj.107.114645>. A review of the technique was published in 2017 <doi:10.1016/j.ymeth.2017.12.001>. |
Authors: | Rory Nolan [aut, cre, cph] , Luis Alvarez [ctb, cph] , Sergi Padilla-Parra [ctb, ths, cph] |
Maintainer: | Rory Nolan <[email protected]> |
License: | BSD_3_clause + file LICENSE |
Version: | 2.1.0 |
Built: | 2024-11-03 05:38:34 UTC |
Source: | https://github.com/rorynolan/nandb |
Given a time stack of images, brightness()
performs a calculation of the
brightness for each pixel.
brightness( img, def, thresh = NULL, detrend = FALSE, quick = FALSE, filt = NULL, s = 1, offset = 0, readout_noise = 0, parallel = FALSE )
brightness( img, def, thresh = NULL, detrend = FALSE, quick = FALSE, filt = NULL, s = 1, offset = 0, readout_noise = 0, parallel = FALSE )
img |
A 4-dimensional array in the style of an
ijtiff_img (indexed by |
def |
A character. Which definition of brightness do you want to use,
|
thresh |
The threshold or thresholding method (see
|
detrend |
Detrend your data with |
quick |
If |
filt |
Do you want to smooth ( |
s |
A positive number. The |
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 |
A matrix, the brightness image.
Digman MA, Dalal R, Horwitz AF, Gratton E. Mapping the Number of Molecules and Brightness in the Laser Scanning Microscope. Biophysical Journal. 2008;94(6):2320-2332. doi:10.1529/biophysj.107.114645.
Dalal, RB, Digman, MA, Horwitz, AF, Vetri, V, Gratton, E (2008). Determination of particle number and brightness using a laser scanning confocal microscope operating in the analog mode. Microsc. Res. Tech., 71, 1:69-81. doi:10.1002/jemt.20526.
img <- ijtiff::read_tif(system.file("extdata", "50.tif", package = "nandb")) ijtiff::display(img[, , 1, 1]) b <- brightness(img, "e", thresh = "Huang") b <- brightness(img, "B", thresh = "tri")
img <- ijtiff::read_tif(system.file("extdata", "50.tif", package = "nandb")) ijtiff::display(img[, , 1, 1]) b <- brightness(img, "e", thresh = "Huang") b <- brightness(img, "B", thresh = "tri")
Perform brightness()
calculations on all tif images in a folder and save the
resulting brightness images to disk.
brightness_folder( folder_path = ".", def, thresh = NULL, detrend = FALSE, quick = FALSE, filt = NULL, s = 1, offset = 0, readout_noise = 0, parallel = FALSE )
brightness_folder( folder_path = ".", def, thresh = NULL, detrend = FALSE, quick = FALSE, filt = NULL, s = 1, offset = 0, readout_noise = 0, parallel = FALSE )
folder_path |
The path (relative or absolute) to the folder you wish to process. |
def |
A character. Which definition of brightness do you want to use,
|
thresh |
The threshold or thresholding method (see
|
detrend |
Detrend your data with |
quick |
If |
filt |
Do you want to smooth ( |
s |
A positive number. The |
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 |
## Not run: setwd(tempdir()) img <- ijtiff::read_tif(system.file("extdata", "50.tif", package = "nandb")) ijtiff::write_tif(img, "img1.tif") ijtiff::write_tif(img, "img2.tif") brightness_folder(def = "B", thresh = "Huang") ## End(Not run)
## Not run: setwd(tempdir()) img <- ijtiff::read_tif(system.file("extdata", "50.tif", package = "nandb")) ijtiff::write_tif(img, "img1.tif") ijtiff::write_tif(img, "img2.tif") brightness_folder(def = "B", thresh = "Huang") ## End(Not run)
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.
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 )
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 )
img |
A 4-dimensional array in the style of an
ijtiff_img (indexed by |
def |
A character. Which definition of brightness do you want to use,
|
frames_per_set |
The number of frames with which to calculate the successive brightnesses. |
overlap |
A boolean. If |
thresh |
The threshold or thresholding method (see
|
detrend |
Detrend your data with |
quick |
If |
filt |
Do you want to smooth ( |
s |
A positive number. The |
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 |
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.
An object of class brightness_ts_img.
If img
is 3-dimensional (i.e. 1-channel), a 3-dimensional
array arr
is returned with arr[y, x, t]
being pixel of the
th brightness image in the brightness time series.
If img
is 4-dimensional (i.e. 2-channel), a 4-dimensional array arr
is returned
with arr[y, x, c, t]
being pixel of the
th channel of
the
th brightness image in the brightness time series.
img <- ijtiff::read_tif(system.file("extdata", "50.tif", package = "nandb")) bts <- brightness_timeseries(img, "e", frames_per_set = 20, thresh = "Huang")
img <- ijtiff::read_tif(system.file("extdata", "50.tif", package = "nandb")) bts <- brightness_timeseries(img, "e", frames_per_set = 20, thresh = "Huang")
Perform brightness_timeseries()
calculations on all tif images in a folder
and save the resulting number images to disk.
brightness_timeseries_folder( folder_path = ".", def, frames_per_set, overlap = FALSE, thresh = NULL, detrend = FALSE, quick = FALSE, filt = NULL, s = 1, offset = 0, readout_noise = 0, parallel = FALSE )
brightness_timeseries_folder( folder_path = ".", def, frames_per_set, overlap = FALSE, thresh = NULL, detrend = FALSE, quick = FALSE, filt = NULL, s = 1, offset = 0, readout_noise = 0, parallel = FALSE )
folder_path |
The path (relative or absolute) to the folder you wish to process. |
def |
A character. Which definition of brightness do you want to use,
|
frames_per_set |
The number of frames with which to calculate the successive brightnesses. |
overlap |
A boolean. If |
thresh |
The threshold or thresholding method (see
|
detrend |
Detrend your data with |
quick |
If |
filt |
Do you want to smooth ( |
s |
A positive number. The |
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 |
## Not run: setwd(tempdir()) img <- ijtiff::read_tif(system.file("extdata", "50.tif", package = "nandb")) ijtiff::write_tif(img, "img1.tif") ijtiff::write_tif(img, "img2.tif") brightness_timeseries_folder(def = "e", thresh = "tri", frames_per_set = 20) ## End(Not run)
## Not run: setwd(tempdir()) img <- ijtiff::read_tif(system.file("extdata", "50.tif", package = "nandb")) ijtiff::write_tif(img, "img1.tif") ijtiff::write_tif(img, "img2.tif") brightness_timeseries_folder(def = "e", thresh = "tri", frames_per_set = 20) ## End(Not run)
Given a time stack of images and two channels, calculate the cross-correlated brightness of those two channels for each pixel.
cc_brightness( img, ch1 = 1, ch2 = 2, thresh = NULL, detrend = FALSE, quick = FALSE, filt = NULL, parallel = FALSE )
cc_brightness( img, ch1 = 1, ch2 = 2, thresh = NULL, detrend = FALSE, quick = FALSE, filt = NULL, parallel = FALSE )
img |
A 4-dimensional array of images indexed by |
ch1 |
A natural number. The index of the first channel to use. |
ch2 |
A natural number. The index of the second channel to use. |
thresh |
Do you want to apply an intensity threshold prior to
calculating cross-correlated brightness (via
|
detrend |
Detrend your data with |
quick |
|
filt |
Do you want to smooth ( |
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 |
A numeric matrix, the cross-correlated brightness image.
img <- ijtiff::read_tif(system.file("extdata", "two_ch.tif", package = "nandb" )) ijtiff::display(detrendr::mean_pillars(img[, , 1, ])) ijtiff::display(detrendr::mean_pillars(img[, , 2, ])) b <- brightness(img, def = "e", thresh = "Huang", filt = "median") ijtiff::display(b[, , 1, 1]) ijtiff::display(b[, , 2, 1]) cc_b <- cc_brightness(img, thresh = "Huang") ijtiff::display(cc_b[, , 1, 1])
img <- ijtiff::read_tif(system.file("extdata", "two_ch.tif", package = "nandb" )) ijtiff::display(detrendr::mean_pillars(img[, , 1, ])) ijtiff::display(detrendr::mean_pillars(img[, , 2, ])) b <- brightness(img, def = "e", thresh = "Huang", filt = "median") ijtiff::display(b[, , 1, 1]) ijtiff::display(b[, , 2, 1]) cc_b <- cc_brightness(img, thresh = "Huang") ijtiff::display(cc_b[, , 1, 1])
Perform cc_brightness()
calculations on all TIFF images in a folder and
save the resulting images to disk.
cc_brightness_folder( folder_path = ".", ch1 = 1, ch2 = 2, thresh = NULL, detrend = detrend, quick = quick, filt = NULL, parallel = FALSE )
cc_brightness_folder( folder_path = ".", ch1 = 1, ch2 = 2, thresh = NULL, detrend = detrend, quick = quick, filt = NULL, parallel = FALSE )
folder_path |
The path (relative or absolute) to the folder you wish to process. |
ch1 |
A natural number. The index of the first channel to use. |
ch2 |
A natural number. The index of the second channel to use. |
thresh |
Do you want to apply an intensity threshold prior to
calculating cross-correlated brightness (via
|
detrend |
Detrend your data with |
quick |
|
filt |
Do you want to smooth ( |
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 |
## Not run: setwd(tempdir()) ijtiff::write_tif(img, "a.tif") ijtiff::write_tif(img, "ab.tif") cc_brightness_folder() list.files() ## End(Not run)
## Not run: setwd(tempdir()) ijtiff::write_tif(img, "a.tif") ijtiff::write_tif(img, "ab.tif") cc_brightness_folder() list.files() ## End(Not run)
Given a stack of images img
, use the first frames_per_set
of them to
create one cross-correlated brightness image, the next frames_per_set
of
them to create the next and so on to get a time-series of cross-correlated
brightness images.
cc_brightness_timeseries( img, frames_per_set, overlap = FALSE, ch1 = 1, ch2 = 2, thresh = NULL, detrend = FALSE, quick = FALSE, filt = NULL, parallel = FALSE )
cc_brightness_timeseries( img, frames_per_set, overlap = FALSE, ch1 = 1, ch2 = 2, thresh = NULL, detrend = FALSE, quick = FALSE, filt = NULL, parallel = FALSE )
img |
A 4-dimensional array of images indexed by |
frames_per_set |
The number of frames with which to calculate the successive cross-correlated brightnesses. This may discard some images, for example if 175 frames are in the input and
|
overlap |
A boolean. If |
ch1 |
A natural number. The index of the first channel to use. |
ch2 |
A natural number. The index of the second channel to use. |
thresh |
Do you want to apply an intensity threshold prior to
calculating cross-correlated brightness (via
|
detrend |
Detrend your data with |
quick |
|
filt |
Do you want to smooth ( |
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 |
An array where the th slice is the
th cross-correlated
brightness image.
img <- ijtiff::read_tif(system.file("extdata", "two_ch.tif", package = "nandb" )) cc_bts <- cc_brightness_timeseries(img, 10, thresh = "Huang", filt = "median", parallel = 2 ) ijtiff::display(cc_bts[, , 1, 1])
img <- ijtiff::read_tif(system.file("extdata", "two_ch.tif", package = "nandb" )) cc_bts <- cc_brightness_timeseries(img, 10, thresh = "Huang", filt = "median", parallel = 2 ) ijtiff::display(cc_bts[, , 1, 1])
Perform cc_brightness_timeseries()
calculations on all tif images in a
folder and save the resulting images to disk.
cc_brightness_timeseries_folder( folder_path = ".", frames_per_set, overlap = FALSE, ch1 = 1, ch2 = 2, thresh = NULL, detrend = detrend, quick = quick, filt = NULL, parallel = FALSE )
cc_brightness_timeseries_folder( folder_path = ".", frames_per_set, overlap = FALSE, ch1 = 1, ch2 = 2, thresh = NULL, detrend = detrend, quick = quick, filt = NULL, parallel = FALSE )
folder_path |
The path (relative or absolute) to the folder you wish to process. |
frames_per_set |
The number of frames with which to calculate the successive cross-correlated brightnesses. This may discard some images, for example if 175 frames are in the input and
|
overlap |
A boolean. If |
ch1 |
A natural number. The index of the first channel to use. |
ch2 |
A natural number. The index of the second channel to use. |
thresh |
Do you want to apply an intensity threshold prior to
calculating cross-correlated brightness (via
|
detrend |
Detrend your data with |
quick |
|
filt |
Do you want to smooth ( |
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 |
## Not run: setwd(tempdir()) ijtiff::write_tif(img, "a.tif") ijtiff::write_tif(img, "ab.tif") cc_brightness_timeseries_folder(frames_per_set = 25) list.files() ## End(Not run)
## Not run: setwd(tempdir()) ijtiff::write_tif(img, "a.tif") ijtiff::write_tif(img, "ab.tif") cc_brightness_timeseries_folder(frames_per_set = 25) list.files() ## End(Not run)
Given a time stack of images and two channels, calculate the cross-correlated number of those two channels for each pixel.
cc_number( img, ch1 = 1, ch2 = 2, thresh = NULL, detrend = FALSE, quick = FALSE, filt = NULL, parallel = FALSE )
cc_number( img, ch1 = 1, ch2 = 2, thresh = NULL, detrend = FALSE, quick = FALSE, filt = NULL, parallel = FALSE )
img |
A 4-dimensional array of images indexed by |
ch1 |
A natural number. The index of the first channel to use. |
ch2 |
A natural number. The index of the second channel to use. |
thresh |
Do you want to apply an intensity threshold prior to
calculating cross-correlated number (via
|
detrend |
Detrend your data with |
quick |
|
filt |
Do you want to smooth ( |
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 |
A numeric matrix, the cross-correlated number image.
img <- ijtiff::read_tif(system.file("extdata", "two_ch.tif", package = "nandb" )) ijtiff::display(detrendr::mean_pillars(img[, , 1, ])) ijtiff::display(detrendr::mean_pillars(img[, , 2, ])) n <- number(img, def = "n", thresh = "Huang", filt = "median") ijtiff::display(n[, , 1, 1]) ijtiff::display(n[, , 2, 1]) cc_n <- cc_number(img, thresh = "Huang") ijtiff::display(cc_n[, , 1, 1])
img <- ijtiff::read_tif(system.file("extdata", "two_ch.tif", package = "nandb" )) ijtiff::display(detrendr::mean_pillars(img[, , 1, ])) ijtiff::display(detrendr::mean_pillars(img[, , 2, ])) n <- number(img, def = "n", thresh = "Huang", filt = "median") ijtiff::display(n[, , 1, 1]) ijtiff::display(n[, , 2, 1]) cc_n <- cc_number(img, thresh = "Huang") ijtiff::display(cc_n[, , 1, 1])
Perform cc_number()
calculations on all TIFF images in a folder and
save the resulting images to disk.
cc_number_folder( folder_path = ".", ch1 = 1, ch2 = 2, thresh = NULL, detrend = FALSE, quick = FALSE, filt = NULL, parallel = FALSE )
cc_number_folder( folder_path = ".", ch1 = 1, ch2 = 2, thresh = NULL, detrend = FALSE, quick = FALSE, filt = NULL, parallel = FALSE )
folder_path |
The path (relative or absolute) to the folder you wish to process. |
ch1 |
A natural number. The index of the first channel to use. |
ch2 |
A natural number. The index of the second channel to use. |
thresh |
Do you want to apply an intensity threshold prior to
calculating cross-correlated number (via
|
detrend |
Detrend your data with |
quick |
|
filt |
Do you want to smooth ( |
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 |
## Not run: setwd(tempdir()) ijtiff::write_tif(img, "a.tif") ijtiff::write_tif(img, "ab.tif") cc_number_folder() list.files() ## End(Not run)
## Not run: setwd(tempdir()) ijtiff::write_tif(img, "a.tif") ijtiff::write_tif(img, "ab.tif") cc_number_folder() list.files() ## End(Not run)
Given a stack of images img
, use the first frames_per_set
of them to
create one cross-correlated number image, the next frames_per_set
of
them to create the next and so on to get a time-series of cross-correlated
number images.
cc_number_timeseries( img, frames_per_set, overlap = FALSE, ch1 = 1, ch2 = 2, thresh = NULL, detrend = FALSE, quick = FALSE, filt = NULL, parallel = FALSE )
cc_number_timeseries( img, frames_per_set, overlap = FALSE, ch1 = 1, ch2 = 2, thresh = NULL, detrend = FALSE, quick = FALSE, filt = NULL, parallel = FALSE )
img |
A 4-dimensional array of images indexed by |
frames_per_set |
The number of frames with which to calculate the successive cross-correlated numbers. This may discard some images, for example if 175 frames are in the input and
|
overlap |
A boolean. If |
ch1 |
A natural number. The index of the first channel to use. |
ch2 |
A natural number. The index of the second channel to use. |
thresh |
Do you want to apply an intensity threshold prior to
calculating cross-correlated number (via
|
detrend |
Detrend your data with |
quick |
|
filt |
Do you want to smooth ( |
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 |
An array where the th slice is the
th cross-correlated
number image.
img <- ijtiff::read_tif(system.file("extdata", "two_ch.tif", package = "nandb" )) cc_nts <- cc_number_timeseries(img, 10, thresh = "Huang", filt = "median", parallel = 2 ) ijtiff::display(cc_nts[, , 1, 1])
img <- ijtiff::read_tif(system.file("extdata", "two_ch.tif", package = "nandb" )) cc_nts <- cc_number_timeseries(img, 10, thresh = "Huang", filt = "median", parallel = 2 ) ijtiff::display(cc_nts[, , 1, 1])
Perform cc_number_timeseries()
calculations on all tif images in a
folder and save the resulting images to disk.
cc_number_timeseries_folder( folder_path = ".", frames_per_set, overlap = FALSE, ch1 = 1, ch2 = 2, thresh = NULL, detrend = FALSE, quick = FALSE, filt = NULL, parallel = FALSE )
cc_number_timeseries_folder( folder_path = ".", frames_per_set, overlap = FALSE, ch1 = 1, ch2 = 2, thresh = NULL, detrend = FALSE, quick = FALSE, filt = NULL, parallel = FALSE )
folder_path |
The path (relative or absolute) to the folder you wish to process. |
frames_per_set |
The number of frames with which to calculate the successive cross-correlated numbers. This may discard some images, for example if 175 frames are in the input and
|
overlap |
A boolean. If |
ch1 |
A natural number. The index of the first channel to use. |
ch2 |
A natural number. The index of the second channel to use. |
thresh |
Do you want to apply an intensity threshold prior to
calculating cross-correlated number (via
|
detrend |
Detrend your data with |
quick |
|
filt |
Do you want to smooth ( |
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 |
## Not run: setwd(tempdir()) ijtiff::write_tif(img, "a.tif") ijtiff::write_tif(img, "ab.tif") cc_number_timeseries_folder(frames_per_set = 25) list.files() ## End(Not run)
## Not run: setwd(tempdir()) ijtiff::write_tif(img, "a.tif") ijtiff::write_tif(img, "ab.tif") cc_number_timeseries_folder(frames_per_set = 25) list.files() ## End(Not run)
The cc_number_img
and cc_brightness_img
classes are designed to hold
objects which are images calculated from the cross-correlated number and
brightness technique.
cc_number_img(img, thresh, swaps, filt) cc_brightness_img(img, thresh, swaps, filt)
cc_number_img(img, thresh, swaps, filt) cc_brightness_img(img, thresh, swaps, filt)
img |
The calculated cross-correlated number or brightness image. |
thresh |
A positive integer, possibly an object of class autothresholdr::th. If the different channels of the image had different thresholds, this argument may be specified as a vector or list (of positive integers, possibly objects of class autothresholdr::th), one element for each channel. |
swaps |
A non-negative integer with an attribute |
filt |
A string, the filtering method used. Must be either |
An object of class cc_number_img
or cc_brightness_img
is a 4-dimensional
array of real numbers in the mould of an ijtiff_img
(indexed as img[y, x, channel, frame]
) with 3 attributes:
thresh
A positive integer, possibly an object of class autothresholdr::th detailing which threshold and thresholding method was used in preprocessing (in the multi-channel case, one threshold per channel is given).
swaps
A non-negative integer indicating the number of
swaps used for Robin Hood detrending, with an attribute auto
which is a
logical indicating whether or not the parameter was chosen automatically (in
the multi-channel case, one swaps
per channel is given).
filt
Was mean or median filtering used in postprocessing?
An object of class cc_number_img
or cc_brightness_img
.
The cc_number_ts_img
and cc_brightness_ts_img
classes are designed to
hold objects which are images calculated from the cross-correlated number
and brightness technique.
cc_number_ts_img(img, frames_per_set, overlapped, thresh, swaps, filt) cc_brightness_ts_img(img, frames_per_set, overlapped, thresh, swaps, filt)
cc_number_ts_img(img, frames_per_set, overlapped, thresh, swaps, filt) cc_brightness_ts_img(img, frames_per_set, overlapped, thresh, swaps, filt)
img |
The calculated cross-correlated number or brightness time series image series. |
frames_per_set |
The number of frames used in the calculation of each point in the cross-correlated number or brightness time series. |
overlapped |
A boolean. |
thresh |
A positive integer, possibly an object of class autothresholdr::th. If the different channels of the image had different thresholds, this argument may be specified as a vector or list (of positive integers, possibly objects of class autothresholdr::th), one element for each channel. |
swaps |
A non-negative integer with an attribute |
filt |
A string, the filtering method used. Must be either |
An object of class cc_number_ts_img
or cc_brightness_ts_img
is a
4-dimensional array of real numbers in the mould of an
ijtiff_img with 3 attributes:
thresh
A positive integer, possibly an object of class autothresholdr::th detailing which threshold and thresholding method was used in preprocessing (in the multi-channel case, one threshold per channel is given).
swaps
A non-negative integer indicating the parameter
used for Robin Hood detrending with an attribute auto
which is a logical
indicating whether or not the parameter was chosen automatically (in the
multi-channel case, one swaps
per channel is given).
frames_per_set
A positive integer detailing how many frames were used in the calculation of each point in the number or brightness time series.
overlapped
A boolean. TRUE
indicates that the windows
used to calculate consecutive brightnesses over time were overlapped, FALSE
indicates that they were not.
An object of class cc_number_ts_img
or cc_brightness_ts_img
.
cc_number_timeseries()
, cc_brightness_timeseries()
.
The cross-variance function is defined in the reference.
cross_var(x, y)
cross_var(x, y)
x |
A numeric vector. |
y |
A numeric vector with the same length as |
A number
Digman, MA, Wiseman, PW, Choi, C, Horwitz, AR, Gratton, E (2009). Stoichiometry of molecular complexes at adhesions in living cells. Proc. Natl. Acad. Sci. U.S.A., 106, 7:2170-5.
cross_var(0:3, 2:5)
cross_var(0:3, 2:5)
The cross-variance function is defined in the reference.
cross_var_pillars(x, y)
cross_var_pillars(x, y)
x |
A 3-dimensional array. |
y |
A 3-dimensional array with the same dimensions as |
Pillar i, j
of the 3-dimensional array arr
is arr[i, j, ]
.
A matrix.
x <- array(1:27, dim = rep(3, 3)) y <- array(0:26, dim = rep(3, 3)) cross_var_pillars(x, y)
x <- array(1:27, dim = rep(3, 3)) y <- array(0:26, dim = rep(3, 3)) cross_var_pillars(x, y)
Given a matrix mat
, make a raster plot of the matrix whereby in the
plot, the pixel at i
, j
has colour based on
the value of mat[i, j]
and the axis points right and the
axis points down (see 'Details').
matrix_raster_plot( mat, scale_name = "scale", limits = NULL, ranges = NULL, range_names = NULL, colours = NULL, na_colour = "black", clip = FALSE, clip_low = FALSE, clip_high = FALSE, log_trans = FALSE, breaks = NULL, include_breaks = NULL )
matrix_raster_plot( mat, scale_name = "scale", limits = NULL, ranges = NULL, range_names = NULL, colours = NULL, na_colour = "black", clip = FALSE, clip_low = FALSE, clip_high = FALSE, log_trans = FALSE, breaks = NULL, include_breaks = NULL )
mat |
The matrix you wish to plot. |
scale_name |
A string. The title of the color scale on the right of the plot. |
limits |
This gives the user the option to set all values outside a
certain range to their nearest value within that range (if |
ranges |
A numeric vector. If you want specific ranges of values to have
the same color, specify these ranges via an increasing numeric vector. For
example, if you want the ranges 0.5-1.2 and 1.2-3, use
|
range_names |
A character vector. If your colour scale is discrete, here you can set the names which will label each range in the legend. |
colours |
If you have set |
na_colour |
Which colour should the |
clip |
If either |
clip_low |
Setting this to |
clip_high |
Setting this to |
log_trans |
Do you want to log-transform the colour scaling? |
breaks |
Where do you want tick marks to appear on the legend colour scale? |
include_breaks |
If you don't want to specify all the breaks, but you want some specific ones to be included on the legend colour scale, specify those specific ones here. |
In the graphics console, a raster plot (via
ggplot2::geom_raster()
) will appear with the matrix values
represented as pixel colours, with a named scale bar.
img <- ijtiff::read_tif(system.file("extdata", "50.tif", package = "nandb")) ijtiff::display(img[, , 1, 1]) matrix_raster_plot(img[, , 1, 1]) b <- brightness(img, def = "B", detrend = FALSE, thresh = "Huang") matrix_raster_plot(b, scale_name = "brightness") matrix_raster_plot(b, scale_name = "brightness", log_trans = TRUE) matrix_raster_plot(b, scale_name = "brightness", log_trans = TRUE, include_breaks = 1.35 ) matrix_raster_plot(b, scale_name = "brightness", log_trans = TRUE, breaks = 1:3 ) matrix_raster_plot(b, scale_name = "brightness", ranges = seq(0.5, 3, length.out = 6), range_names = paste0(1:5, "mer") ) matrix_raster_plot(b, scale_name = "brightness", ranges = seq(0.5, 3, length.out = 6), range_names = paste0(1:5, "mer"), log_trans = TRUE ) matrix_raster_plot(b, scale_name = "brightness", include_breaks = 1.25, range_names = NULL, log_trans = FALSE ) matrix_raster_plot(b, scale_name = "brightness", include_breaks = 1.25, log_trans = TRUE ) matrix_raster_plot(b, scale_name = "brightness", limits = c(1, 1.25), clip = TRUE ) matrix_raster_plot(b, scale_name = "brightness", include_breaks = 1.25 )
img <- ijtiff::read_tif(system.file("extdata", "50.tif", package = "nandb")) ijtiff::display(img[, , 1, 1]) matrix_raster_plot(img[, , 1, 1]) b <- brightness(img, def = "B", detrend = FALSE, thresh = "Huang") matrix_raster_plot(b, scale_name = "brightness") matrix_raster_plot(b, scale_name = "brightness", log_trans = TRUE) matrix_raster_plot(b, scale_name = "brightness", log_trans = TRUE, include_breaks = 1.35 ) matrix_raster_plot(b, scale_name = "brightness", log_trans = TRUE, breaks = 1:3 ) matrix_raster_plot(b, scale_name = "brightness", ranges = seq(0.5, 3, length.out = 6), range_names = paste0(1:5, "mer") ) matrix_raster_plot(b, scale_name = "brightness", ranges = seq(0.5, 3, length.out = 6), range_names = paste0(1:5, "mer"), log_trans = TRUE ) matrix_raster_plot(b, scale_name = "brightness", include_breaks = 1.25, range_names = NULL, log_trans = FALSE ) matrix_raster_plot(b, scale_name = "brightness", include_breaks = 1.25, log_trans = TRUE ) matrix_raster_plot(b, scale_name = "brightness", limits = c(1, 1.25), clip = TRUE ) matrix_raster_plot(b, scale_name = "brightness", include_breaks = 1.25 )
These are alternatives to
EBImage::filter2()
and EBImage::medianFilter()
for
smooth and median filtering respectively. These functions have many options
for dealing with NA
values which EBImage
's functions lack.
median_filter(mat, size = 1L, na_rm = FALSE, na_count = FALSE) smooth_filter(mat, size = 1L, na_rm = FALSE, na_count = FALSE)
median_filter(mat, size = 1L, na_rm = FALSE, na_count = FALSE) smooth_filter(mat, size = 1L, na_rm = FALSE, na_count = FALSE)
mat |
A matrix (representing an image). |
size |
An integer; the median filter radius. |
na_rm |
Should |
na_count |
If this is TRUE, in each median calculation, if the majority
of arguments are |
The behavior at image boundaries is such as the source image has been padded with pixels whose values equal the nearest border pixel value.
A matrix (the median filtered image).
m <- matrix(1:9, nrow = 3) m[2:3, 2:3] <- NA print(m) median_filter(m) median_filter(m, na_rm = TRUE) median_filter(m, na_count = TRUE) smooth_filter(m) smooth_filter(m, na_rm = TRUE) smooth_filter(m, na_count = TRUE)
m <- matrix(1:9, nrow = 3) m[2:3, 2:3] <- NA print(m) median_filter(m) median_filter(m, na_rm = TRUE) median_filter(m, na_count = TRUE) smooth_filter(m) smooth_filter(m, na_rm = TRUE) smooth_filter(m, na_count = TRUE)
The nandb
package gives functions for calculation of molecular number and
brightness from images, as detailed in Digman et al. 2008. It comes with an
implementation of the novel 'automatic detrending' technique.
Digman MA, Dalal R, Horwitz AF, Gratton E. Mapping the Number of Molecules and Brightness in the Laser Scanning Microscope. Biophysical Journal. 2008;94(6):2320-2332. doi:10.1529/biophysj.107.114645.
The number_img
and brightness_img
classes are designed to hold objects
which are images calculated from the number and brightness technique.
number_img(img, def, thresh, swaps, filt) brightness_img(img, def, thresh, swaps, filt)
number_img(img, def, thresh, swaps, filt) brightness_img(img, def, thresh, swaps, filt)
img |
The calculated number or brightness image. |
def |
The number or brightness definition used. |
thresh |
A positive integer, possibly an object of class autothresholdr::th. If the different channels of the image had different thresholds, this argument may be specified as a vector or list (of positive integers, possibly objects of class autothresholdr::th), one element for each channel. |
swaps |
A non-negative integer with an attribute |
filt |
A string, the filtering method used. Must be either |
An object of class number_img
or brightness_img
is a 4-dimensional array
of real numbers in the mould of an ijtiff_img (indexed
as img[y, x, channel, frame]
) with 4 attributes:
def
Are
we using the "N"
or "n"
definition of number, or the "B"
or "epsilon"
definition of brightness?
thresh
A positive integer, possibly an object of class autothresholdr::th detailing which threshold and thresholding method was used in preprocessing (in the multi-channel case, one threshold per channel is given).
swaps
A non-negative integer
indicating the number of swaps Robin Hood detrending, with an attribute
auto
which is a logical indicating whether or not the parameter was chosen
automatically (in the multi-channel case, one threshold per channel is
given).
filt
Was mean or median filtering used in postprocessing?
An object of class number_img
or brightness_img
.
The number_ts_img
and brightness_ts_img
classes are designed to hold
objects which are images calculated from the number and brightness
technique.
number_ts_img(img, def, frames_per_set, overlapped, thresh, swaps, filt) brightness_ts_img(img, def, frames_per_set, overlapped, thresh, swaps, filt)
number_ts_img(img, def, frames_per_set, overlapped, thresh, swaps, filt) brightness_ts_img(img, def, frames_per_set, overlapped, thresh, swaps, filt)
img |
The calculated number or brightness time series image series. |
def |
The number or brightness definition used. |
frames_per_set |
The number of frames used in the calculation of each point in the number or brightness time series. |
overlapped |
A boolean. |
thresh |
A positive integer, possibly an object of class autothresholdr::th. If the different channels of the image had different thresholds, this argument may be specified as a vector or list (of positive integers, possibly objects of class autothresholdr::th), one element for each channel. |
swaps |
A non-negative integer with an attribute |
filt |
A string, the filtering method used. Must be either |
An object of class number_ts_img
or brightness_ts_img
is a 3- or
4-dimensional array of real numbers with 4 attributes:
def
Are we using the "N"
or "n"
definition of number,
or the "B"
or "epsilon"
definition of brightness?
thresh
A positive integer, possibly an object of class autothresholdr::th detailing which threshold and thresholding method was used in preprocessing (in the multi-channel case, one threshold per channel is given).
swaps
A
non-negative integer indicating the number of swaps used for Robin Hood
detrending, with an attribute auto
which is a logical indicating whether or
not the parameter was chosen automatically (in the multi-channel case, one
swaps
per channel is given).
frames_per_set
A positive integer detailing how many frames were used in the calculation of each point in the number or brightness time series.
overlapped
A boolean. TRUE
indicates that the windows used to calculate consecutive brightnesses over
time were overlapped, FALSE
indicates that they were not.
An object of class number_ts_img
or brightness_ts_img
.
number_timeseries()
, brightness_timeseries()
.
Given a time stack of images, number()
performs a calculation of the number
for each pixel.
number( img, def, thresh = NULL, detrend = FALSE, quick = FALSE, filt = NULL, s = 1, offset = 0, readout_noise = 0, gamma = 1, parallel = FALSE )
number( img, def, thresh = NULL, detrend = FALSE, quick = FALSE, filt = NULL, s = 1, offset = 0, readout_noise = 0, gamma = 1, parallel = FALSE )
img |
A 4-dimensional array of images indexed by |
def |
A character. Which definition of number do you want to use, |
thresh |
The threshold or thresholding method (see
|
detrend |
Detrend your data with |
quick |
|
filt |
Do you want to smooth ( |
s |
A positive number. The |
offset , readout_noise
|
Microscope acquisition parameters. See reference Dalal et al. |
gamma |
Factor for correction of number |
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 |
A matrix, the number image.
Digman MA, Dalal R, Horwitz AF, Gratton E. Mapping the Number of Molecules and Brightness in the Laser Scanning Microscope. Biophysical Journal. 2008;94(6):2320-2332. doi:10.1529/biophysj.107.114645.
Dalal, RB, Digman, MA, Horwitz, AF, Vetri, V, Gratton, E (2008). Determination of particle number and brightness using a laser scanning confocal microscope operating in the analog mode. Microsc. Res. Tech., 71, 1:69-81. doi:10.1002/jemt.20526.
Hur K-H, Macdonald PJ, Berk S, Angert CI, Chen Y, Mueller JD (2014) Quantitative Measurement of Brightness from Living Cells in the Presence of Photodepletion. PLoS ONE 9(5): e97440. doi:10.1371/journal.pone.0097440.
img <- ijtiff::read_tif(system.file("extdata", "50.tif", package = "nandb")) ijtiff::display(img[, , 1, 1]) num <- number(img, "N", thresh = "Huang") num <- number(img, "n", thresh = "tri")
img <- ijtiff::read_tif(system.file("extdata", "50.tif", package = "nandb")) ijtiff::display(img[, , 1, 1]) num <- number(img, "N", thresh = "Huang") num <- number(img, "n", thresh = "tri")
Perform number()
calculations on all tif images in a folder and save the
resulting number images to disk.
number_folder( folder_path = ".", def, thresh = NULL, detrend = FALSE, quick = FALSE, filt = NULL, s = 1, offset = 0, readout_noise = 0, gamma = 1, parallel = FALSE )
number_folder( folder_path = ".", def, thresh = NULL, detrend = FALSE, quick = FALSE, filt = NULL, s = 1, offset = 0, readout_noise = 0, gamma = 1, parallel = FALSE )
folder_path |
The path (relative or absolute) to the folder you wish to process. |
def |
A character. Which definition of number do you want to use, |
thresh |
The threshold or thresholding method (see
|
detrend |
Detrend your data with |
quick |
|
filt |
Do you want to smooth ( |
s |
A positive number. The |
offset |
Microscope acquisition parameters. See reference Dalal et al. |
readout_noise |
Microscope acquisition parameters. See reference Dalal et al. |
gamma |
Factor for correction of number |
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 |
Extreme number values (of magnitude greater than 3.40282e+38) will be
written to the TIFF file as NA
, since TIFF files cannot handle such huge
numbers.
## Not run: setwd(tempdir()) img <- ijtiff::read_tif(system.file("extdata", "50.tif", package = "nandb")) ijtiff::write_tif(img, "img2.tif") number_folder(def = "n", thresh = "Huang", parallel = 2) ## End(Not run)
## Not run: setwd(tempdir()) img <- ijtiff::read_tif(system.file("extdata", "50.tif", package = "nandb")) ijtiff::write_tif(img, "img2.tif") number_folder(def = "n", thresh = "Huang", parallel = 2) ## End(Not run)
Given a stack of images img
, use the first frames_per_set
of them to
create one number image, the next frames_per_set
of them to create the next
number image and so on to get a time-series of number images.
number_timeseries( img, def, frames_per_set, overlap = FALSE, thresh = NULL, detrend = FALSE, quick = FALSE, filt = NULL, s = 1, offset = 0, readout_noise = 0, gamma = 1, parallel = FALSE )
number_timeseries( img, def, frames_per_set, overlap = FALSE, thresh = NULL, detrend = FALSE, quick = FALSE, filt = NULL, s = 1, offset = 0, readout_noise = 0, gamma = 1, parallel = FALSE )
img |
A 4-dimensional array of images indexed by |
def |
A character. Which definition of number do you want to use, |
frames_per_set |
The number of frames with which to calculate the successive numbers. |
overlap |
A boolean. If |
thresh |
The threshold or thresholding method (see
|
detrend |
Detrend your data with |
quick |
|
filt |
Do you want to smooth ( |
s |
A positive number. The |
offset |
Microscope acquisition parameters. See reference Dalal et al. |
readout_noise |
Microscope acquisition parameters. See reference Dalal et al. |
gamma |
Factor for correction of number |
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 |
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.
An object of class number_ts_img.
img <- ijtiff::read_tif(system.file("extdata", "50.tif", package = "nandb")) nts <- number_timeseries(img, "n", frames_per_set = 20, thresh = "Huang")
img <- ijtiff::read_tif(system.file("extdata", "50.tif", package = "nandb")) nts <- number_timeseries(img, "n", frames_per_set = 20, thresh = "Huang")
Perform number_timeseries()
calculations on all tif images in a folder and
save the resulting number images to disk.
number_timeseries_folder( folder_path = ".", def, frames_per_set, overlap = FALSE, thresh = NULL, detrend = FALSE, quick = FALSE, filt = NULL, s = 1, offset = 0, readout_noise = 0, gamma = 1, parallel = FALSE )
number_timeseries_folder( folder_path = ".", def, frames_per_set, overlap = FALSE, thresh = NULL, detrend = FALSE, quick = FALSE, filt = NULL, s = 1, offset = 0, readout_noise = 0, gamma = 1, parallel = FALSE )
folder_path |
The path (relative or absolute) to the folder you wish to process. |
def |
A character. Which definition of number do you want to use, |
frames_per_set |
The number of frames with which to calculate the successive numbers. |
overlap |
A boolean. If |
thresh |
The threshold or thresholding method (see
|
detrend |
Detrend your data with |
quick |
|
filt |
Do you want to smooth ( |
s |
A positive number. The |
offset |
Microscope acquisition parameters. See reference Dalal et al. |
readout_noise |
Microscope acquisition parameters. See reference Dalal et al. |
gamma |
Factor for correction of number |
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 |
Extreme number values (of magnitude greater than 3.40282e+38) will be
written to the TIFF file as NA
, since TIFF files cannot handle such huge
numbers.
## Not run: setwd(tempdir()) img <- ijtiff::read_tif(system.file("extdata", "50.tif", package = "nandb")) ijtiff::write_tif(img, "img1.tif") ijtiff::write_tif(img, "img2.tif") number_timeseries_folder(def = "n", thresh = "Huang", frames_per_set = 20) ## End(Not run)
## Not run: setwd(tempdir()) img <- ijtiff::read_tif(system.file("extdata", "50.tif", package = "nandb")) ijtiff::write_tif(img, "img1.tif") ijtiff::write_tif(img, "img2.tif") number_timeseries_folder(def = "n", thresh = "Huang", frames_per_set = 20) ## End(Not run)