Skip to content

File formats

The QC bundle (histo calibrate --out / qc.report)

File Content
calibration.json The full result (below).
stain_map.json The calibrated vectors in the legacy stain-map format (below).
report.html Self-contained page with relative links to the PNGs.
overlay_<slide>.png Thumbnail (long side ≤ 1024 px) with tissue outline, no-data outline and numbered boxes.
stain_density_<slide>.png qc.stain_density_image: amount of stain 1 (reference vectors, OD inverse with the slide's background; black = none, bright = dense; pixels with ‖OD‖ > 1 shown as none) with the region boxes in cyan, long side ≤ 1024 px. This is the map stain-guided sampling scores.
separation_<NNN>_<slide>.png RGB / stain 1 / stain 2 / Residual strip for enabled region NNN (long side of each panel ≤ 1024 px), with scale bar.
stain_vectors.png qc.vector_plots of the used regions' pixels (≤ 10,000 points; each region's pixels against its own slide's background), 1800 × 600 px.
qc_sheet_<slide>_<KK>.png QC sheets: overview + 8 regions each (layout).

<slide> is the slide id with characters outside A-Za-z0-9._- replaced by _.

stain_map.json

The format the collagen pipeline and QuPath-derived maps already use: stain name → unit RGB optical-density vector, in order. The stain names are those of the staining protocol (this example: psr-fg).

{
    "PSR": [0.4253907917734923, 0.7525956444533248, 0.5026355242362065],
    "FG": [0.9397786917362384, 0.19246947388490762, 0.2824385104425232],
    "Residual": [0.15930211124270702, 0.4844525752612502, -0.8601909902320292]
}

Read it with StainMatrix.from_json(path). Given two stains only, the third (Residual) is computed as their normalised cross product; a third given vector is kept as is.

calibration.json

Calibration.to_json(): deterministic (no timestamps), so the same inputs and seed give byte-identical files.

Key Type Meaning
stains stain map The result: robust spherical median per stain, Residual \(= (\mathbf{s}_1 \times \mathbf{s}_2)/\lVert \mathbf{s}_1 \times \mathbf{s}_2 \rVert\).
pooled stain map or null Pooled-pixel estimate over all enabled regions. Diagnostic only.
variance {stain: {median, mean, sd, p95, max, n_used}} Angular deviation (degrees) of the used regions' vectors from stains.
deviations list, one per enabled region {stain: degrees} for used regions, null for regions not used.
excluded {"<index>": reason} Enabled regions not used: "single-stain" or "failed". Keys are indices into the enabled regions, as strings.
per_region list of stain maps / null Each enabled region's own estimate (null when it failed).
eigen_ratios list of numbers / null \(\lambda_2/\lambda_1\) of each region's OD covariance (single-stain check).
params object See below.
regions list of regions All regions (enabled and disabled), as in regions.json.
pyhisto_version string pyHisto version that wrote the file.

params:

Key Meaning
method Estimator backend (numpy / qupath).
reference Reference stain map used for naming/ordering, or null.
protocol Added by histo calibrate: the staining protocol whose reference was used (e.g. "psr-fg"), or null when --reference FILE was given.
background Fixed white level if given, else null.
background_per_slide {slide_id: [R, G, B]} white level used for each slide's regions.
background_pooled White level of the pooled diagnostic.
background_level {slide_id: level} pyramid level the background was measured on, or null when background was given.
background_glass_px {slide_id: n} number of glass pixels the background was measured from, or null.
min_glass_px Minimum number of glass pixels required (default 50,000).
smooth Whether QuPath's GUI smoothing was applied.
min_eigen_ratio Single-stain threshold on \(\lambda_2/\lambda_1\) (default 0.02).
estimator Extra estimator parameters passed (e.g. min_stain).
aggregation "per-region spherical median (Weiszfeld on S2)".
cli, seed, sampling Added by histo calibrate: stores, n_per_slide, size, level, min_tissue_frac, sampling, min_glass_px, channel_order, reference_file, protocol; the seed; and the sampling strategy ("stain" or "random").

regions.json (RegionSet.to_json())

{
  "version": 1,
  "regions": [
    {"slide_id": "slide.ome.zarr", "level": 0, "x": 29871, "y": 5351,
     "w": 512, "h": 512, "source": "auto", "enabled": true}
  ]
}

x, y, w, h are pixels of level. source is "auto" (proposed) or "user". RegionSet.from_json also accepts a bare list of regions; missing source defaults to "user", missing enabled to true.

Input: OME-Zarr

See Slides and OME-Zarr: NGFF 0.5 (tanoa) or 0.4, uint8, 3 channels, with omero channel labels or an explicit channel_order.