Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Plots and reports

A run that finishes is not a run that worked: nothing fails on bad QC. Look at the outputs in this order, cheapest first: the QC report, then the stitched image, then the store.

The QC report

Open qc/{sample}_{m}_qc_report.html in a browser; it opens offline. On a TMA, start with the slide report. With preprocessing_only there is no report; check stitching in preprocessing/registration/{sample}_ashlar_qc/{sample}_ashlar_report.pdf.

The report gives numbers, not a verdict: it sets no thresholds. The sections, top to bottom:

Summary tiles

The number of cells segmented, then the image size and channel count, the median cell area, the number of cells below the minimum area, and the number of patches with how many came out empty. Compare the median area with the cells you expect: at 0.65 µm per pixel, a cell 10 µm across is about 190 px².

Integrity checks

A list of yes/no observations:

CheckA “no” means
Table and image agree on channel namesthe measurements may belong to the wrong marker
Image matches the marker sheetthe sheet lists different names or a different number of channels than the image has
Every channel has a channel_rolea row of the marker sheet is incomplete
A nuclear stain is declaredno dna channel; the cross-cycle check guesses from the names
No cells below 10 px²some outlines are specks, not cells; set min_area_pixels2 to drop them
Every patch produced cellsa patch found nothing; see Cells per patch

Channels

One row per channel: a small intensity histogram, its role, the compartment it is expected in, and the mean, median and share of zero pixels. Measured on every pixel of the full-resolution image. All histograms share one scale, so a curve hugging the left is a dim channel.

“Zero pixels per channel” follows. With background subtraction it shows each channel before and after: subtraction clips at zero, so pixels driven to zero are signal it removed. A marker driven almost entirely to zero was subtracted away, often from a wrong exposure in the marker sheet.

Nuclear stain across cycles

Per cell, the last cycle’s nuclear stain divided by the first cycle’s, on a log2 scale: 0 is no change, −1 is half. Every cycle images the same nuclei, so a drop is the sample or the optics, not biology.

Stitching and registration

From Ashlar’s own records. The tile map draws each tile at its stitched position; thick lines placed tiles, thin lines agreed, dashed red lines were rejected. A cluster of red lines inside tissue is where stitching failed. “Later cycles against cycle 1” counts the tiles of each cycle that could not be aligned and were placed by the stage position instead, and shows the cycle overlays: grey where cycles align, magenta and green fringes where they do not.

What to change: Ashlar. On a TMA this section is in the slide report, not the cores’.

Cell area distribution

A histogram of cell areas in px², up to the 99th percentile, with a table of percentiles.

Nuclei per cell

With cells and nuclei: how many cells hold 0, 1 or more nuclei, how many nuclei belong to no cell, and how many cells their nuclei fill completely.

Cells per patch

The number of cells in each patch, laid out as the patch grid. An empty patch at the slide’s edge is background; an empty patch in the middle of tissue is a failure. Patches overlap, so the counts add up to more than the total.

Segmentation overlay

With use_qc_images: full-resolution windows with the outlines in red over the nuclear stain, chosen from the densest to the sparsest part of the image. Click to enlarge.

Cell clusters and representative cells

With use_qc_images: cells grouped by their marker intensities alone (Leiden clustering), shown as a tree across resolutions and a heatmap of each cluster’s markers. Below, a few typical cells of each cluster, in the cluster’s top marker (magenta) over the nuclear stain (green).

These clusters are a summary of the staining, not cell types. They were not reproducible between random seeds on our test slide, and the report says so when that happens.

Comparison report

qc/{sample}_comparison.html, when both Cellpose and InstanSeg segment cells. It shows the cell count and median area of each method, the share of each method’s cells that the other found as well (paired one-to-one when their shared area is at least half of their combined area, IoU ≥ 0.5), and both outlines on the densest, median and sparsest window: Cellpose in orange, InstanSeg in blue.

Neither method is the reference. Large differences in count or area show where to look in the overlays; the overlays decide which method suits your tissue.

Slide report

qc/{slide}_{m}_slide_report.html, on a TMA. One page for the whole slide, built from the cores’ metrics:

Then open the reports of the cores it names.

Viewers

The stitched OME-TIFF

preprocessing/registration/{sample}.ome.tif is the stitched image, and the file to open first when segmentation looks wrong. Its channels have no names: names are added only in the store.

The store

Open {sample}.zarr with napari-spatialdata (pip install "napari-spatialdata[all]") to see the cell outlines over the image:

import spatialdata as sd
from napari_spatialdata import Interactive

sdata = sd.read_zarr("results/sample.zarr")
Interactive(sdata).run()

Add the image and {m}_cells from the plugin’s element list. With keep_projection, the store also holds <image>_projected, what Cellpose segmented, to view under the outlines. More on the store: The Zarr store.

Common failures

For stitching and registration, see Ashlar.

What you seeLikely causeWhere to look
Cells tile the whole tissue, ignoring membranessopa’s Cellpose thresholds (2, -6) or CLAHE set; see Segmentation benchmark“Segmentation overlay”; qc/{sample}_projection.png
Cellpose misses whole groups of cellsOne bright marker dominates the projected cell channeldominant in qc/{sample}_projection.json
A TMA core is missing, or two cores are oneWrong Coreograph downsample factorpreprocessing/dearray/{slide}_tma_map.tif; dearray/sweep/{slide}_sweep_overlays.png
An empty patch inside tissueSegmentation failed in that patch“Cells per patch”
Many tiny cellsNo area filter: min_area_pixels2 unset is 0“Integrity checks” and “Cell area distribution”
Last cycle’s nuclear stain weaker than the firstCells lost between cycles, or photobleaching“Nuclear stain across cycles”
Marker columns named Channel:0:0, Channel:0:1, …Pre-stitched input whose OME-TIFF has no channel names“Channels”; var['marker'] of tables/{m}_table
NaN in cytoplasm_area or the cytoplasm layerNo linked nucleus, nuclei fill the cell, or the cell covers no pixel centre; see NaN and 0“Nuclei per cell”
Clusters change between runsLeiden clusters were not reproducible on our test slide“Cell clusters by marker intensity”
The store does not match the parameters-resume back to earlier parameters reuses in-place writes; see Pitfallsuns['segmentation'] of tables/{m}_table