Skip to content

Command line: histo

pyHisto installs one command, histo (run it as pixi run histo ...).

histo calibrate

Sample regions inside tissue on every OME-Zarr store, estimate stain vectors per region (QuPath-compatible), aggregate them robustly and write calibration.json, stain_map.json, PNGs and report.html into --out.

usage: histo calibrate [-h] --out OUT [--n-per-slide N_PER_SLIDE]
                       [--size SIZE] [--level LEVEL] [--seed SEED]
                       [--sampling {stain,random}]
                       [--min-glass-px MIN_GLASS_PX] [--method METHOD]
                       [--min-tissue-frac MIN_TISSUE_FRAC]
                       [--protocol PROTOCOL] [--list-protocols]
                       [--reference REFERENCE] [--background R G B]
                       [--channel-order CHANNEL_ORDER]
                       [stores ...]
Option Default Meaning
stores (required unless --list-protocols) One or more OME-Zarr stores, e.g. tanoa output. Store folder names must be unique (they become the slide ids).
--out OUT (required unless --list-protocols) Output folder for the QC bundle; created if missing.
--n-per-slide N 10 Regions per slide.
--size PX 512 Region side in pixels of --level.
--level L 0 Pyramid level of the regions.
--seed S 0 Seed of --sampling random; same seed, same regions.
--sampling S stain stain: boxes where both stains are abundant and mixed, scored on a coarse amount map from the reference vectors (deterministic). random: stratified random boxes in tissue. How.
--min-glass-px N 50000 Minimum number of glass pixels to measure a slide's background; finer pyramid levels are read until it is met, else the run stops with an error naming the slide.
--method M numpy Estimator backend: numpy, or qupath when QuPath is found (how). An unavailable method exits with code 2 and lists the available ones.
--min-tissue-frac F 0.8 Minimum tissue fraction of a region.
--protocol NAME psr-fg Built-in staining protocol whose reference names and orders the two estimated stains: psr-fg, psr, masson-trichrome, he, h-dab, azan-mallory, alcian-blue-h (case-insensitive; aliases such as trichrome or h&e work). An unknown name exits with code 2 and lists the available ones.
--list-protocols Print the protocols (names, stains, reference vectors) and exit; no stores or --out needed.
--reference FILE Stain-map JSON whose first two stains name and order the result; overrides --protocol. Use it for a stain that is not built in (e.g. a map exported from QuPath).
--background R G B measured per slide One white level (\(I_0\)) for all slides; default: the mode of each slide's bright, non-saturated glass pixels (how).
--channel-order ORDER from labels Stored channel order (RGB or BGR) for stores without omero channel labels.

It prints the stain vectors, the variance table and the path of report.html, and returns exit code 0. Errors (e.g. no usable region, duplicate slide ids, unknown channel order) exit non-zero.

The calibration parameters, including the CLI arguments under params.cli, params.seed and params.sampling, are saved in calibration.json.

Placeholder subcommands

histo analyze, histo visualize and histo report exist in the parser from pyHisto 1.0 but only print a message; they do nothing yet. The pipeline commands are planned.