pyHisto.slide¶
pyHisto.slide
¶
Slide adapter: uniform, lazy true-RGB access to OME-Zarr slides and arrays.
open_slide normalises the inputs accepted by the stain-calibration code:
- tanoa NGFF 0.5 stores (zarr v3,
omegroup attribute, axest,c,z,y,x, physical-µmscaletransforms, omero channel labels such asBlue,Green,Redfor Zeiss Bgr24); - legacy pyHisto 4D
c,z,y,xstores (NGFF 0.4 style top-level attributes are accepted too); - in-memory NumPy / dask arrays shaped
(Y, X, C)or(C, Y, X)with an explicitchannel_orderandmpp.
Channel order is resolved in exactly one place, :func:_resolve_channel_order,
from the omero labels (or the explicit channel_order). Unlabelled or
unrecognisably labelled 3-channel data without channel_order raises
ValueError -- there is no silent RGB/BGR guess (see the BGR defect of the
legacy CZI->zarr path).
All reads are lazy: :meth:Slide.read_region indexes only the requested window
of one level, so only the chunks overlapping it are fetched.
Slide
¶
Lazy, true-RGB multi-resolution slide.
read_region
¶
Return the (h, w, 3) uint8 true-RGB window at level coordinates.
nodata_mask
¶
Boolean mask of no-data pixels (all channels == 0) at level.
region=(x, y, w, h) restricts it to a window; otherwise the level is
processed in row strips (bounded memory, bool output only).
thumbnail
¶
RGB thumbnail with longest side <= max_px.
Read from the coarsest level whose longest side is still >= max_px
(or level 0 if every level is smaller), then box-averaged down.
open_slide
¶
Open an OME-Zarr store (path / zarr group) or a NumPy/dask array as a :class:Slide.
channel_order: stored channel order ("RGB", "BGR" or label sequence);
required when the input carries no recognisable omero channel labels.
mpp: level-0 pixel size in µm; overrides the store's physical scale and is
required for array input.