| Type: | Package |
| Title: | Number and Brightness Image Analysis |
| Version: | 2.1.1 |
| Maintainer: | Rory Nolan <rorynoolan@gmail.com> |
| 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>. |
| License: | BSD_3_clause + file LICENSE |
| URL: | https://rorynolan.github.io/nandb/,https://github.com/rorynolan/nandb |
| BugReports: | https://github.com/rorynolan/nandb/issues |
| Depends: | R (≥ 3.1) |
| Imports: | assertthat, autothresholdr (≥ 1.3.11), BBmisc, checkmate (≥1.9.3), detrendr (≥ 0.6.12), dplyr, filesstrings (≥ 3.2),ggplot2, glue (≥ 1.3), ijtiff (≥ 2.2), magrittr (≥ 1.5),purrr, Rcpp (≥ 1.0.1), reshape2, rlang (≥ 0.3.3), stringr (≥1.4), utils, viridis, withr (≥ 2.1.0) |
| Suggests: | abind, covr, gridExtra, knitr, magick, matrixStats (≥ 0.50),pacman, rmarkdown, spelling, testthat (≥ 2.1), tidyr |
| LinkingTo: | Rcpp (≥ 1.0.1) |
| VignetteBuilder: | knitr |
| Config/testthat/edition: | 3 |
| Config/testthat/parallel: | true |
| Encoding: | UTF-8 |
| Language: | en-US |
| RoxygenNote: | 7.1.1 |
| NeedsCompilation: | yes |
| Packaged: | 2025-05-06 16:12:45 UTC; rnolan |
| Author: | Rory Nolan |
| Repository: | CRAN |
| Date/Publication: | 2025-05-06 22:30:02 UTC |
nandb: Number and brightness in R.
Description
Thenandb package gives functions for calculation of molecular number andbrightness from images, as detailed in Digman et al. 2008. It comes with animplementation of the novel 'automatic detrending' technique.
References
Digman MA, Dalal R, Horwitz AF, Gratton E. Mapping the Number ofMolecules and Brightness in the Laser Scanning Microscope. BiophysicalJournal. 2008;94(6):2320-2332.doi:10.1529/biophysj.107.114645.
Calculate brightness from image series.
Description
Given a time stack of images,brightness() performs a calculation of thebrightness for each pixel.
Usage
brightness( img, def, 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 anijtiff_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 referenceDalal et al. |
readout_noise | Microscope acquisition parameters. See referenceDalal et al. |
parallel | Would you like to use multiple cores to speed up thisfunction? If so, set the number of cores here, or to use all availablecores, use |
Value
A matrix, the brightness image.
References
Digman MA, Dalal R, Horwitz AF, Gratton E. Mapping the Number ofMolecules and Brightness in the Laser Scanning Microscope. BiophysicalJournal. 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 scanningconfocal microscope operating in the analog mode. Microsc. Res. Tech., 71,1:69-81.doi:10.1002/jemt.20526.
Examples
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")Brightness calculations for every image in a folder.
Description
Performbrightness() calculations on all tif images in a folder and save theresulting brightness images to disk.
Usage
brightness_folder( folder_path = ".", def, thresh = NULL, detrend = FALSE, quick = FALSE, filt = NULL, s = 1, offset = 0, readout_noise = 0, parallel = FALSE)Arguments
folder_path | The path (relative or absolute) to the folder you wish toprocess. |
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 referenceDalal et al. |
readout_noise | Microscope acquisition parameters. See referenceDalal et al. |
parallel | Would you like to use multiple cores to speed up thisfunction? If so, set the number of cores here, or to use all availablecores, use |
See Also
Examples
## 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)Create a brightness time-series.
Description
Given a stack of imagesimg, use the firstframes_per_set of them tocreate one brightness image, the nextframes_per_set of them to create thenext 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 anijtiff_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 thesuccessive 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 referenceDalal et al. |
readout_noise | Microscope acquisition parameters. See referenceDalal et al. |
parallel | Would you like to use multiple cores to speed up thisfunction? If so, set the number of cores here, or to use all availablecores, use |
Details
This may discard some images, for example if 175 frames are in the input andframes_per_set = 50, then the last 25 are discarded. If detrending isselected, it is performed on the whole image stack before the sectioning isdone for calculation of numbers.
Value
An object of classbrightness_ts_img.
If
imgis 3-dimensional (i.e. 1-channel), a 3-dimensionalarrayarris returned witharr[y, x, t]being pixel(x, y)of thetth brightness image in the brightness time series.If
imgis 4-dimensional (i.e. 2-channel), a 4-dimensional arrayarris returnedwitharr[y, x, c, t]being pixel(x, y)of thecth channel ofthetth brightness image in the brightness time series.
See Also
Examples
img <- ijtiff::read_tif(system.file("extdata", "50.tif", package = "nandb"))bts <- brightness_timeseries(img, "e", frames_per_set = 20, thresh = "Huang")Brightness time-series calculations for every image in a folder.
Description
Performbrightness_timeseries() calculations on all tif images in a folderand save the resulting number images to disk.
Usage
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)Arguments
folder_path | The path (relative or absolute) to the folder you wish toprocess. |
def | A character. Which definition of brightness do you want to use, |
frames_per_set | The number of frames with which to calculate thesuccessive 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 referenceDalal et al. |
readout_noise | Microscope acquisition parameters. See referenceDalal et al. |
parallel | Would you like to use multiple cores to speed up thisfunction? If so, set the number of cores here, or to use all availablecores, use |
See Also
Examples
## 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)Cross-correlated number and brightness image classes.
Description
Thecc_number_img andcc_brightness_img classes are designed to holdobjects which are images calculated from thecross-correlated number andbrightness technique.
Usage
cc_number_img(img, thresh, swaps, filt)cc_brightness_img(img, thresh, swaps, filt)Arguments
img | The calculated cross-correlated number or brightness image. |
thresh | A positive integer, possibly an object of classautothresholdr::th. If the different channels of the image had differentthresholds, this argument may be specified as a vector or list (of positiveintegers, possibly objects of classautothresholdr::th), one element foreach channel. |
swaps | A non-negative integer with an attribute |
filt | A string, the filtering method used. Must be either |
Details
An object of classcc_number_img orcc_brightness_img is a 4-dimensionalarray of real numbers in the mould of anijtiff_img(indexed asimg[y, x, channel, frame]) with 3 attributes:
threshA positive integer, possibly an object of classautothresholdr::th detailing which threshold and thresholding method wasused in preprocessing (in the multi-channel case, one threshold per channelis given).
swapsA non-negative integer indicating the number ofswaps used for Robin Hood detrending, with an attribute
autowhich is alogical indicating whether or not the parameter was chosen automatically (inthe multi-channel case, oneswapsper channel is given).filtWasmean or median filtering used in postprocessing?
Value
An object of classcc_number_img orcc_brightness_img.
Cross-correlated number and brightness time series image classes.
Description
Thecc_number_ts_img andcc_brightness_ts_img classes are designed tohold objects which are images calculated from thecross-correlated numberand brightness technique.
Usage
cc_number_ts_img(img, frames_per_set, overlapped, thresh, swaps, filt)cc_brightness_ts_img(img, frames_per_set, overlapped, thresh, swaps, filt)Arguments
img | The calculated cross-correlated number or brightness time seriesimage series. |
frames_per_set | The number of frames used in the calculation of eachpoint in the cross-correlated number or brightness time series. |
overlapped | A boolean. |
thresh | A positive integer, possibly an object of classautothresholdr::th. If the different channels of the image had differentthresholds, this argument may be specified as a vector or list (of positiveintegers, possibly objects of classautothresholdr::th), one element foreach channel. |
swaps | A non-negative integer with an attribute |
filt | A string, the filtering method used. Must be either |
Details
An object of classcc_number_ts_img orcc_brightness_ts_img is a4-dimensional array of real numbers in the mould of anijtiff_img with 3 attributes:
threshA positive integer, possibly an object of classautothresholdr::th detailing which threshold and thresholding method wasused in preprocessing (in the multi-channel case, one threshold per channelis given).
swapsA non-negative integer indicating the parameterused for Robin Hood detrending with an attribute
autowhich is a logicalindicating whether or not the parameter was chosen automatically (in themulti-channel case, oneswapsper channel is given).frames_per_setA positive integer detailing how many frames wereused in the calculation of each point in the number or brightness timeseries.
overlappedA boolean.
TRUEindicates that the windowsused to calculate consecutive brightnesses over time were overlapped,FALSEindicates that they were not.
Value
An object of classcc_number_ts_img orcc_brightness_ts_img.
See Also
cc_number_timeseries(),cc_brightness_timeseries().
Cross-correlated brightness.
Description
Given a time stack of images and two channels, calculate thecross-correlated brightness of those two channels for each pixel.
Usage
cc_brightness( img, ch1 = 1, ch2 = 2, thresh = NULL, detrend = FALSE, quick = FALSE, filt = NULL, parallel = FALSE)Arguments
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 tocalculating 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 thisfunction? If so, set the number of cores here, or to use all availablecores, use |
Value
A numeric matrix, the cross-correlated brightness image.
Examples
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])Cross-correlated brightness calculations for every image in a folder.
Description
Performcc_brightness() calculations on all TIFF images in a folder andsave the resulting images to disk.
Usage
cc_brightness_folder( folder_path = ".", ch1 = 1, ch2 = 2, thresh = NULL, detrend = detrend, quick = quick, filt = NULL, parallel = FALSE)Arguments
folder_path | The path (relative or absolute) to the folder you wish toprocess. |
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 tocalculating 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 thisfunction? If so, set the number of cores here, or to use all availablecores, use |
Examples
## Not run: setwd(tempdir())ijtiff::write_tif(img, "a.tif")ijtiff::write_tif(img, "ab.tif")cc_brightness_folder()list.files()## End(Not run)Create a cross-correlated brightness time-series.
Description
Given a stack of imagesimg, use the firstframes_per_set of them tocreate one cross-correlated brightness image, the nextframes_per_set ofthem to create the next and so on to get a time-series of cross-correlatedbrightness images.
Usage
cc_brightness_timeseries( img, frames_per_set, overlap = FALSE, ch1 = 1, ch2 = 2, thresh = NULL, detrend = FALSE, quick = FALSE, filt = NULL, parallel = FALSE)Arguments
img | A 4-dimensional array of images indexed by |
frames_per_set | The number of frames with which to calculate thesuccessive 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 tocalculating 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 thisfunction? If so, set the number of cores here, or to use all availablecores, use |
Value
An array where theith slice is theith cross-correlatedbrightness image.
See Also
Examples
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])Cross-correlated brightness time-series calculations for every image in afolder.
Description
Performcc_brightness_timeseries() calculations on all tif images in afolder and save the resulting images to disk.
Usage
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)Arguments
folder_path | The path (relative or absolute) to the folder you wish toprocess. |
frames_per_set | The number of frames with which to calculate thesuccessive 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 tocalculating 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 thisfunction? If so, set the number of cores here, or to use all availablecores, use |
See Also
Examples
## 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)Cross-correlated number.
Description
Given a time stack of images and two channels, calculate thecross-correlated number of those two channels for each pixel.
Usage
cc_number( img, ch1 = 1, ch2 = 2, thresh = NULL, detrend = FALSE, quick = FALSE, filt = NULL, parallel = FALSE)Arguments
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 tocalculating 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 thisfunction? If so, set the number of cores here, or to use all availablecores, use |
Value
A numeric matrix, the cross-correlated number image.
Examples
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])Cross-correlated number calculations for every image in a folder.
Description
Performcc_number() calculations on all TIFF images in a folder andsave the resulting images to disk.
Usage
cc_number_folder( folder_path = ".", ch1 = 1, ch2 = 2, thresh = NULL, detrend = FALSE, quick = FALSE, filt = NULL, parallel = FALSE)Arguments
folder_path | The path (relative or absolute) to the folder you wish toprocess. |
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 tocalculating 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 thisfunction? If so, set the number of cores here, or to use all availablecores, use |
Examples
## Not run: setwd(tempdir())ijtiff::write_tif(img, "a.tif")ijtiff::write_tif(img, "ab.tif")cc_number_folder()list.files()## End(Not run)Create a cross-correlated number time-series.
Description
Given a stack of imagesimg, use the firstframes_per_set of them tocreate one cross-correlated number image, the nextframes_per_set ofthem to create the next and so on to get a time-series of cross-correlatednumber images.
Usage
cc_number_timeseries( img, frames_per_set, overlap = FALSE, ch1 = 1, ch2 = 2, thresh = NULL, detrend = FALSE, quick = FALSE, filt = NULL, parallel = FALSE)Arguments
img | A 4-dimensional array of images indexed by |
frames_per_set | The number of frames with which to calculate thesuccessive 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 tocalculating 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 thisfunction? If so, set the number of cores here, or to use all availablecores, use |
Value
An array where theith slice is theith cross-correlatednumber image.
See Also
Examples
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])Cross-correlated number time-series calculations for every image in afolder.
Description
Performcc_number_timeseries() calculations on all tif images in afolder and save the resulting images to disk.
Usage
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)Arguments
folder_path | The path (relative or absolute) to the folder you wish toprocess. |
frames_per_set | The number of frames with which to calculate thesuccessive 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 tocalculating 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 thisfunction? If so, set the number of cores here, or to use all availablecores, use |
See Also
Examples
## 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)Calculate thecross-variance of two vectors.
Description
The cross-variance function is defined in the reference.
Usage
cross_var(x, y)Arguments
x | A numeric vector. |
y | A numeric vector with the same length as |
Value
A number
References
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.
Examples
cross_var(0:3, 2:5)Calculate thecross-variance of corresponding pillars of 3d arrays.
Description
The cross-variance function is defined in the reference.
Usage
cross_var_pillars(x, y)Arguments
x | A 3-dimensional array. |
y | A 3-dimensional array with the same dimensions as |
Details
Pillari, j of the 3-dimensional arrayarr isarr[i, j, ].
Value
A matrix.
Examples
x <- array(1:27, dim = rep(3, 3))y <- array(0:26, dim = rep(3, 3))cross_var_pillars(x, y)Make a raster plot of a matrix.
Description
Given a matrixmat, make a raster plot of the matrix whereby in theplot, the pixel atx =i,y =j has colour based onthe value ofmat[i, j] and thex axis points right and they axis points down (see 'Details').
Usage
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)Arguments
mat | The matrix you wish to plot. |
scale_name | A string. The title of the color scale on the right of theplot. |
limits | This gives the user the option to set all values outside acertain range to their nearest value within that range (if |
ranges | A numeric vector. If you want specific ranges of values to havethe same color, specify these ranges via an increasing numeric vector. Forexample, 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, hereyou 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 colourscale? |
include_breaks | If you don't want to specify all the breaks, but youwant some specific ones to be included on the legend colour scale, specifythose specific ones here. |
Value
In the graphics console, a raster plot (viaggplot2::geom_raster()) will appear with the matrix valuesrepresented as pixel colours, with a named scale bar.
Examples
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)Smooth and median filters with options for handling NAs.
Description
These are alternatives toEBImage::filter2() andEBImage::medianFilter() forsmooth and median filtering respectively. These functions have many optionsfor dealing withNA values whichEBImage's functions lack.
Usage
median_filter(mat, size = 1L, na_rm = FALSE, na_count = FALSE)smooth_filter(mat, size = 1L, na_rm = FALSE, na_count = FALSE)Arguments
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 majorityof arguments are |
Details
The behavior at image boundaries is such as the source image has been paddedwith pixels whose values equal the nearest border pixel value.
Value
A matrix (the median filtered image).
Examples
m <- matrix(1:9, nrow = 3)m[2:3, 2:3] <- NAprint(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)Number and brightness image classes.
Description
Thenumber_img andbrightness_img classes are designed to hold objectswhich are images calculated from thenumber and brightness technique.
Usage
number_img(img, def, thresh, swaps, filt)brightness_img(img, def, thresh, swaps, filt)Arguments
img | The calculated number or brightness image. |
def | The number or brightness definition used. |
thresh | A positive integer, possibly an object of classautothresholdr::th. If the different channels of the image had differentthresholds, this argument may be specified as a vector or list (of positiveintegers, possibly objects of classautothresholdr::th), one element foreach channel. |
swaps | A non-negative integer with an attribute |
filt | A string, the filtering method used. Must be either |
Details
An object of classnumber_img orbrightness_img is a 4-dimensional arrayof real numbers in the mould of anijtiff_img (indexedasimg[y, x, channel, frame]) with 4 attributes:
defArewe using the
"N"or"n"definition of number, or the"B"or"epsilon"definition of brightness?threshA positive integer, possibly anobject of classautothresholdr::th detailing which threshold andthresholding method was used in preprocessing (in the multi-channel case, onethreshold per channel is given).
swapsA non-negative integerindicating the number of swaps Robin Hood detrending, with an attribute
autowhich is a logical indicating whether or not the parameter was chosenautomatically (in the multi-channel case, one threshold per channel isgiven).filtWas mean or median filtering used in postprocessing?
Value
An object of classnumber_img orbrightness_img.
Number and brightness time series image classes.
Description
Thenumber_ts_img andbrightness_ts_img classes are designed to holdobjects which are images calculated from thenumber and brightnesstechnique.
Usage
number_ts_img(img, def, frames_per_set, overlapped, thresh, swaps, filt)brightness_ts_img(img, def, frames_per_set, overlapped, thresh, swaps, filt)Arguments
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 eachpoint in the number or brightness time series. |
overlapped | A boolean. |
thresh | A positive integer, possibly an object of classautothresholdr::th. If the different channels of the image had differentthresholds, this argument may be specified as a vector or list (of positiveintegers, possibly objects of classautothresholdr::th), one element foreach channel. |
swaps | A non-negative integer with an attribute |
filt | A string, the filtering method used. Must be either |
Details
An object of classnumber_ts_img orbrightness_ts_img is a 3- or4-dimensional array of real numbers with 4 attributes:
defAre we using the
"N"or"n"definition of number,or the"B"or"epsilon"definition of brightness?threshApositive integer, possibly an object of classautothresholdr::th detailingwhich threshold and thresholding method was used in preprocessing (in themulti-channel case, one threshold per channel is given).
swapsAnon-negative integer indicating the number of swaps used for Robin Hooddetrending, with an attribute
autowhich is a logical indicating whether ornot the parameter was chosen automatically (in the multi-channel case, oneswapsper channel is given).frames_per_setA positive integerdetailing how many frames were used in the calculation of each point in thenumber or brightness time series.
overlappedA boolean.
TRUEindicates that the windows used to calculate consecutive brightnesses overtime were overlapped,FALSEindicates that they were not.
Value
An object of classnumber_ts_img orbrightness_ts_img.
See Also
number_timeseries(),brightness_timeseries().
Calculate number from image series.
Description
Given a time stack of images,number() performs a calculation of the numberfor each pixel.
Usage
number( img, def, thresh = NULL, detrend = FALSE, quick = FALSE, filt = NULL, s = 1, offset = 0, readout_noise = 0, gamma = 1, parallel = FALSE)Arguments
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 referenceDalal et al. |
gamma | Factor for correction of number |
parallel | Would you like to use multiple cores to speed up thisfunction? If so, set the number of cores here, or to use all availablecores, use |
Value
A matrix, the number image.
References
Digman MA, Dalal R, Horwitz AF, Gratton E. Mapping the Number ofMolecules and Brightness in the Laser Scanning Microscope. BiophysicalJournal. 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 scanningconfocal 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 ofPhotodepletion. PLoS ONE 9(5): e97440.doi:10.1371/journal.pone.0097440.
Examples
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")Number calculations for every image in a folder.
Description
Performnumber() calculations on all tif images in a folder and save theresulting number images to disk.
Usage
number_folder( folder_path = ".", def, thresh = NULL, detrend = FALSE, quick = FALSE, filt = NULL, s = 1, offset = 0, readout_noise = 0, gamma = 1, parallel = FALSE)Arguments
folder_path | The path (relative or absolute) to the folder you wish toprocess. |
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 referenceDalal et al. |
readout_noise | Microscope acquisition parameters. See referenceDalal et al. |
gamma | Factor for correction of number |
parallel | Would you like to use multiple cores to speed up thisfunction? If so, set the number of cores here, or to use all availablecores, use |
Note
Extreme number values (of magnitude greater than 3.40282e+38) will bewritten to the TIFF file asNA, since TIFF files cannot handle such hugenumbers.
See Also
Examples
## 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)Create a number time-series.
Description
Given a stack of imagesimg, use the firstframes_per_set of them tocreate one number image, the nextframes_per_set of them to create the nextnumber image and so on to get a time-series of number images.
Usage
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)Arguments
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 thesuccessive 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 referenceDalal et al. |
readout_noise | Microscope acquisition parameters. See referenceDalal et al. |
gamma | Factor for correction of number |
parallel | Would you like to use multiple cores to speed up thisfunction? If so, set the number of cores here, or to use all availablecores, use |
Details
This may discard some images, for example if 175 frames are in the input andframes_per_set = 50, then the last 25 are discarded. If detrending isselected, it is performed on the whole image stack before the sectioning isdone for calculation of numbers.
Value
An object of classnumber_ts_img.
See Also
Examples
img <- ijtiff::read_tif(system.file("extdata", "50.tif", package = "nandb"))nts <- number_timeseries(img, "n", frames_per_set = 20, thresh = "Huang")Number time-series calculations for every image in a folder.
Description
Performnumber_timeseries() calculations on all tif images in a folder andsave the resulting number images to disk.
Usage
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)Arguments
folder_path | The path (relative or absolute) to the folder you wish toprocess. |
def | A character. Which definition of number do you want to use, |
frames_per_set | The number of frames with which to calculate thesuccessive 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 referenceDalal et al. |
readout_noise | Microscope acquisition parameters. See referenceDalal et al. |
gamma | Factor for correction of number |
parallel | Would you like to use multiple cores to speed up thisfunction? If so, set the number of cores here, or to use all availablecores, use |
Note
Extreme number values (of magnitude greater than 3.40282e+38) will bewritten to the TIFF file asNA, since TIFF files cannot handle such hugenumbers.
See Also
Examples
## 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)