cellMask: Voronoi Cell Segmentation from Nuclei

View source: R/cellMask.R

cellMaskR Documentation

Voronoi Cell Segmentation from Nuclei

Description

Define boundaries between adjacent cells (regions) from a nuclear mask and optional cellular mask with the propagate function.

Usage

cellMask(seeds, mask = NULL, brush = NULL, lambda = 1e-04)

Arguments

seeds

An Image object, array, or list of these objects containing the seeds of identified regions. This would typically be a segmented nuclear mask or list of masks such as those generated by nucMask.

mask

An optional Image object, array, or a list of these objects containing a binary mask defining regions of the image to be segmented. If this value is NULL, the nuclear mask (seeds) will be expanded for Voronoi segmentation. If the first argument seeds is a list, mask must be a list of identical size with Image binary objects or arrays.

brush

Size of the brush to expand the nuclear mask as an odd number of pixels. If this value is NULL, the mean value of the semi-major axis of the nuclei will be used.

lambda

A numeric value used by propagate determining the trade-off between the Euclidean distance in the image plane and the contribution of the gradient to define the boundary during Voronoi segmentation. See propagate for details.

Details

A mask to define approximate cellular boundaries will be created from a nuclear mask in seeds and an optional cytoplasmic mask mask. If the second argument (mask) is NULL, the nuclear mask will be dilated with a disc-shaped brush of size equal to brush or, if brush is NULL, the average semi-major axis of all nuclei. If mask is not NULL, mask must be a binary (or integer) mask defining the limits for the Voronoi segmentation based on the seeds provided in seeds. Such a binary mask can be created by thresholding a non-specific widespread cytoplasmic signal such antibody labeling for actin or a diffuse membrane stain.

To create a smaller nuclear mask, use trimMask on a nuclear mask with a negative brush value.

To create a cytoplasmic mask that excludes the nucleus, generate a cell mask and combine this with the nuclear mask nmask as shown below.

# When both are single objects:
  cytoplasm <- cellMask(nmask) * (nmask == 0)

# When both are list objects:
  cytoplasm <- Map(function(a, b) a * (b == 0), cellMask(nmask), nmask)

Value

An Image object produced by propagate containing the labeled objects (cells) or a list of such objects.

Examples

  x <- readImage(system.file("extdata", "by_folder/a4/file001.tif", package = "virustiter"))
  y <- readImage(system.file("extdata", "by_folder/a4/file002.tif", package = "virustiter"))
  nm <- nucMask(x)
  cm <- cellMask(nm)
  img <- rgbImage(red = normalize(y) * 0.2, green = normalize(y) * 0.8)
  img <- paintObjects(nm, img, col = "cyan")
  img <- paintObjects(cm, img, col = "red")
  plot(img)


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