Compute cell density from a table of cell counts and tissue areas read from a summary cell seg data file.

compute_density_from_cell_summary(
  counts,
  summary_path,
  tissue_categories,
  pixels_per_micron = getOption("phenoptr.pixels.per.micron"),
  .by = "Slide ID"
)

Arguments

counts

A data frame with columns for .by, Tissue Category, and counts, such as the output of count_phenotypes.

summary_path

Path(s) to cell seg data summary table(s) containing sample names and tissue categories matching counts.

tissue_categories

A character vector of tissue category names of interest.

pixels_per_micron

Conversion factor to microns.

.by

Column to aggregate by

Value

A data table with counts converted to density in \(cells / mm^2\).