simpleSeg
Workflows
Standard Workflow
Segment multiplexed images to identify cell boundaries, extract single-cell features, and normalize marker intensities.
library(simpleSeg)
library(cytomapper)
library(EBImage)
# Load example data path
pathToImages <- system.file("extdata", package = "simpleSeg")
imageDirs <- dir(pathToImages, "Point", full.names = TRUE)
names(imageDirs) <- dir(pathToImages, "Point", full.names = FALSE)
files <- lapply(imageDirs, list.files, pattern = "tif", full.names = TRUE)
images <- lapply(files, EBImage::readImage, as.is = TRUE)
images <- cytomapper::CytoImageList(images)
mcols(images)$imageID <- names(images)
# Segment images
masks <- simpleSeg::simpleSeg(images, nucleus = "HH3", transform = "sqrt")
# Summarise cell features
cellSCE <- cytomapper::measureObjects(masks, images, img_id = "imageID")
# Normalize cells
cellSCE <- normalizeCells(
cellSCE,
assayIn = "counts",
assayOut = "norm",
imageID = "imageID",
transformation = "sqrt",
method = c("trim99", "minMax")
)
Input: Multiplexed TIFF images (as CytoImageList); Output: Segmented masks (CytoImageList) and normalized single-cell feature matrices (SingleCellExperiment).
When to Use
- Segmenting multiplexed cellular images (e.g., MIBI-TOF) using a watershed-based approach with
simpleSeg::simpleSeg().
- Extracting single-cell marker intensities and morphological features into a
SingleCellExperiment using cytomapper::measureObjects().
- Normalizing and transforming extracted single-cell marker intensities using
normalizeCells().
When NOT to Use
- For segmenting non-imaging single-cell data (like standard scRNA-seq), use
scran or Seurat because simpleSeg is specifically designed for multiplexed imaging data.
- For highly complex deep-learning-based cell segmentation, use external tools like Cellpose or Mesmer because simpleSeg relies on classical watershed algorithms.
Data Requirements
- Multiplexed cellular images loaded as an
Image, list of Images, or CytoImageList (from cytomapper).
- Images should contain a nuclear marker channel (e.g., "HH3") for watershed seeding.
Key Parameters
- nucleus: The name or index of the channel to use as the nuclear marker.
- transform (NULL): Image transformation to apply before segmentation (e.g., "sqrt").
- cores (1): Number of cores to use for parallel processing.
- watershed ("combine"): Method for watershedding ("distance", "intensity", or "combine").
- cellBody ("dilation"): Method for cell body identification ("dilation", "discModel", "marker", or "None").
- assayIn ("counts"): Input assay name in
normalizeCells().
- assayOut ("norm"): Output assay name in
normalizeCells().
Best Practices
- Visualise segmentation performance using
EBImage::display(colorLabels(masks[[1]])) or cytomapper::plotPixels() to verify cell boundaries.
- Apply a transformation like
"sqrt" to the nuclear channel to improve watershed segmentation on highly skewed intensity distributions.
- Perform quality control on normalization by plotting marker density distributions (e.g., using
ggplot2 and geom_density()) before and after running normalizeCells().
Common Pitfalls
- Highly skewed marker intensities: Raw intensities can be extremely skewed, making clustering difficult; fix this by applying
normalizeCells() with method = c("trim99", "minMax").
- Incorrect nuclear channel name: Specifying a nuclear marker that does not exist in the image channels will cause
simpleSeg to fail; verify channel names in the CytoImageList first.
Alternatives
EBImage: For low-level, highly flexible image processing and manual watershedding.
cytomapper: For pixel-level visualization and measuring objects.
Seurat: For downstream clustering and classification of the extracted single-cell features.
Citations
- Nicholls et al. (2026), simpleSeg package vignette.
- Risom et al. (2022), Cell (for the example DCIS MIBI-TOF dataset).
References
1---2name: simpleseg3description: simpleSeg4---56# simpleSeg78## Workflows910### Standard Workflow1112Segment multiplexed images to identify cell boundaries, extract single-cell features, and normalize marker intensities.1314```r15library(simpleSeg)16library(cytomapper)17library(EBImage)1819# Load example data path20pathToImages <- system.file("extdata", package = "simpleSeg")21imageDirs <- dir(pathToImages, "Point", full.names = TRUE)22names(imageDirs) <- dir(pathToImages, "Point", full.names = FALSE)23files <- lapply(imageDirs, list.files, pattern = "tif", full.names = TRUE)24images <- lapply(files, EBImage::readImage, as.is = TRUE)25images <- cytomapper::CytoImageList(images)26mcols(images)$imageID <- names(images)2728# Segment images29masks <- simpleSeg::simpleSeg(images, nucleus = "HH3", transform = "sqrt")3031# Summarise cell features32cellSCE <- cytomapper::measureObjects(masks, images, img_id = "imageID")3334# Normalize cells35cellSCE <- normalizeCells(36 cellSCE,37 assayIn = "counts",38 assayOut = "norm",39 imageID = "imageID",40 transformation = "sqrt",41 method = c("trim99", "minMax")42)43```44*Input: Multiplexed TIFF images (as CytoImageList); Output: Segmented masks (CytoImageList) and normalized single-cell feature matrices (SingleCellExperiment).*4546## When to Use47- Segmenting multiplexed cellular images (e.g., MIBI-TOF) using a watershed-based approach with `simpleSeg::simpleSeg()`.48- Extracting single-cell marker intensities and morphological features into a `SingleCellExperiment` using `cytomapper::measureObjects()`.49- Normalizing and transforming extracted single-cell marker intensities using `normalizeCells()`.5051## When NOT to Use52- For segmenting non-imaging single-cell data (like standard scRNA-seq), use `scran` or `Seurat` because simpleSeg is specifically designed for multiplexed imaging data.53- For highly complex deep-learning-based cell segmentation, use external tools like Cellpose or Mesmer because simpleSeg relies on classical watershed algorithms.5455## Data Requirements56- Multiplexed cellular images loaded as an `Image`, list of `Image`s, or `CytoImageList` (from `cytomapper`).57- Images should contain a nuclear marker channel (e.g., "HH3") for watershed seeding.5859## Key Parameters60- **nucleus**: The name or index of the channel to use as the nuclear marker.61- **transform** (NULL): Image transformation to apply before segmentation (e.g., "sqrt").62- **cores** (1): Number of cores to use for parallel processing.63- **watershed** ("combine"): Method for watershedding ("distance", "intensity", or "combine").64- **cellBody** ("dilation"): Method for cell body identification ("dilation", "discModel", "marker", or "None").65- **assayIn** ("counts"): Input assay name in `normalizeCells()`.66- **assayOut** ("norm"): Output assay name in `normalizeCells()`.6768## Best Practices69- Visualise segmentation performance using `EBImage::display(colorLabels(masks[[1]]))` or `cytomapper::plotPixels()` to verify cell boundaries.70- Apply a transformation like `"sqrt"` to the nuclear channel to improve watershed segmentation on highly skewed intensity distributions.71- Perform quality control on normalization by plotting marker density distributions (e.g., using `ggplot2` and `geom_density()`) before and after running `normalizeCells()`.7273## Common Pitfalls74- Highly skewed marker intensities: Raw intensities can be extremely skewed, making clustering difficult; fix this by applying `normalizeCells()` with `method = c("trim99", "minMax")`.75- Incorrect nuclear channel name: Specifying a nuclear marker that does not exist in the image channels will cause `simpleSeg` to fail; verify channel names in the `CytoImageList` first.7677## Alternatives78- `EBImage`: For low-level, highly flexible image processing and manual watershedding.79- `cytomapper`: For pixel-level visualization and measuring objects.80- `Seurat`: For downstream clustering and classification of the extracted single-cell features.8182## Citations83- Nicholls et al. (2026), simpleSeg package vignette.84- Risom et al. (2022), Cell (for the example DCIS MIBI-TOF dataset).8586## References87- Homepage: bioconductor.org/packages/simpleSeg88- Vignette: https://bioconductor.org/packages/release/bioc/vignettes/simpleSeg/inst/doc/simpleSeg.html