Use QuPath as the reference backend¶
pyHisto's default estimator (method="numpy") is a port of QuPath 0.7.0's
"Estimate stain vectors". To compare against real QuPath, pyHisto can run
QuPath headless on the same pixels (method="qupath"). This is a reference
for checking, not a production path.
Set it up¶
- Install QuPath 0.7.0 (the Linux tarball includes its own Java).
-
Point pyHisto to the launcher:
(or put
QuPathon yourPATH). -
Check:
The backend runs tools/qupath/estimate_stains.groovy from the pyHisto
repository. If pyHisto is installed somewhere without that folder, set
PYHISTO_QUPATH_SCRIPT to the script's path.
Use it¶
How it works and its limits¶
- The pixels are written to a temporary 8-bit RGB PNG and QuPath runs
QuPath script -i pixels.png ...on it; the vectors come back as JSON. - Only QuPath's "Auto" defaults are supported (
min_stain=0.05,max_stain=1.0,ignore_percentage=1.0); other values raise an error. - A fixed background must be whole numbers; without one QuPath uses the mode.
- QuPath downsamples images larger than 4000 × 4000 pixels.
- One JVM start per call: slow for many regions.
The live-QuPath tests¶
Tests that need QuPath carry the requires_qupath marker and are skipped
when QuPath is not found. The golden-file tests (stored QuPath results in
tests/fixtures/stain/) always run. To run the live comparison too: