Package 'simpleSeg'

Title: A package to perform simple cell segmentation
Description: Image segmentation is the process of identifying the borders of individual objects (in this case cells) within an image. This allows for the features of cells such as marker expression and morphology to be extracted, stored and analysed. simpleSeg provides functionality for user friendly, watershed based segmentation on multiplexed cellular images in R based on the intensity of user specified protein marker channels. simpleSeg can also be used for the normalization of single cell data obtained from multiple images.
Authors: Nicolas Canete [aut], Alexander Nicholls [aut], Ellis Patrick [aut, cre]
Maintainer: Ellis Patrick <[email protected]>
License: GPL-3
Version: 1.9.0
Built: 2024-11-30 04:52:13 UTC
Source: https://github.com/bioc/simpleSeg

Help Index


Utility function to generate BPPARM object.

Description

Utility function to generate BPPARM object.

Usage

generateBPParam(cores = 1)

Arguments

cores

Desired number of cores for BPPARAM object.

Value

A BPPPARAM object.


Normalizes and transforms cell data in preparation for clustering (accepts dataframe, SingleCellExperiment and SpatialExperiment).

Description

Normalizes and transforms cell data in preparation for clustering (accepts dataframe, SingleCellExperiment and SpatialExperiment).

Usage

normalizeCells(
  cells,
  markers = NULL,
  assayIn = NULL,
  assayOut = "norm",
  imageID = "imageID",
  transformation = NULL,
  method = NULL,
  cores = 1
)

Arguments

cells

A Dataframe of SingleCellExperiment or SpatialExperiment containing cells and features to be normalized/transformed

markers

A list containing the names of cell markers which will be normalized and/or transformed.

assayIn

If input is a SingleCellExperiment or SpatialExperiment with multiple assays, specify the assay to be normalized and/or transformed.

assayOut

If input is a SingleCellExperiment or SpatialExperiment, the new of the normalized data.

imageID

If input is a SingleCellExperiment or SpatialExperiment, this is the name of the image ID variable in order to stratify. cells correctly

transformation

The transformation/s to be performed, default is NULL, accepted values: 'asinh' and 'sqrt'.

method

The normalization method/s to be performed, default is NULL, accepted values: 'mean', 'minMax', 'trim99', 'PC1'.

cores

The number or cores for parallel processing.

Value

returns a dataframe with individual cells as rows and features as columns.

Examples

library(cytomapper)
data("pancreasSCE")
cells.normalized <- normalizeCells(
  cells = pancreasSCE,
  markers = c("CD99", "PIN", "CD8a", "CDH"),
  assayIn = "counts",
  assayOut = "normCounts",
  imageID = "ImageNb",
  transformation = "asinh",
  method = "trim99"
)

Perform simple segmentation of multiplexed cellular images

Description

Perform simple segmentation of multiplexed cellular images

Usage

simpleSeg(
  image,
  nucleus,
  cellBody = "dilate",
  sizeSelection = 10,
  smooth = 1,
  transform = NULL,
  watershed = "intensity",
  tolerance = NULL,
  ext = 1,
  discSize = 3,
  tissue = NULL,
  pca = FALSE,
  cores = 1
)

Arguments

image

An image or list of images or CytoImageList to be read into the function.

nucleus

The marker or list of markers corresponding to the nuclei.

cellBody

Method of cytoplasm identification. Can be 'none', dilate', 'discModel' or the name of a dedicated cytoplasm marker

sizeSelection

Minimum pixels for an object to be recognized as a cell and not noise.

smooth

The amount of Gaussian smoothing to be applied to the image/s

transform

A transformation or list of transformations and normalizations to be performed prior to nuclei or cytoplasm identification. Accepted vales: "sqrt", "asinh", "norm99", "maxThresh" and "tissueMask". Tissue mask may be used when the sample does not take up the entirety of the image (typically a circular sample inside the image. When tissue mask is specified the background noise present outside the sample area is removed).

watershed

Method used to perform watersheding. Accepted values: "intensity", "distance" or "combine".

tolerance

The minimum height of the object in the units of image intensity between its highest point (seed) and the point where it contacts another object (checked for every contact pixel). If the height is smaller than the tolerance, the object will be combined with one of its neighbors, which is the highest. Tolerance should be chosen according to the range of x. Default value is 1, which is a reasonable value if x comes from distmap.

ext

Radius of the neighborhood in pixels for the detection of neighboring objects. Higher value smooths out small objects.

discSize

The size of dilation around nuclei to create cell disc or capture cytoplasm

tissue

Channels to be used to create the tissue mask if specified in transforms.

pca

Whether to run PCA on aggregated nucleus markers in order to detect the cellular nucclei.

cores

The number or cores for parallel processing or a BPPARAM object

Value

A list of image masks

Examples

library(cytomapper)
data("pancreasImages")
masks <- simpleSeg(pancreasImages,
  nucleus = "H3",
  cellBody = "discModel",
  sizeSelection = 8,
  smooth = 1.2,
  transform = "sqrt",
  watershed = "combine",
  tolerance = 1, ext = 1,
  discSize = 3,
  cores = 5
)