bnormalize: Normalize Image Background

View source: R/bnormalize.R

bnormalizeR Documentation

Normalize Image Background

Description

Adjust values of an image to a common background.

Usage

bnormalize(img, inputRange, quant = 0.005, nonzero = FALSE, ...)

Arguments

img

Grayscale Image object.

inputRange

A numeric vector of 2 values specifying the expected range of intensity values.

quant

Quantile to serve as the common baseline, default of 0.005.

nonzero

Should zero values be ignored in quantile calculation?

...

Additional arguments are accepted but ignored in order to remain compatible with previous versions of this function.

Details

Each frame of an Image will be linearly scaled to have an identical value at the specified quantile. If inputRange is missing, it will be taken as the actual range of values in img. Each frame of the image will be adjusted by subtracting the median value at the specified quantile and adding quant * inputRange[2]. Negative values will be clipped to 0. Note that if inputRange is not specified, the different image objects will not necessarily share the same background value.

Value

Image object linearly scaled to have a common background.

Examples

  cell <- readImage(system.file("extdata", "by_folder/b2/file002.tif", 
   package = "virustiter"))
  N <- prod(dim(cell)[1:2])
  cells <- Image(rep(imageData(cell), 4), dim = c(dim(cell), 4))
  cells[,,2] <- cell + 0.005
  cells[,,3] <- cell + 0.01
  cells[,,4] <- cell + 0.02
  cells <- normalize(cells, separate = FALSE)
  plot(cells, all = TRUE)
  plot(bnormalize(cells), all = TRUE)


ornelles/virustiter documentation built on March 29, 2024, 8:30 p.m.