Repository navigation
Open
Description
Context
Owner decisions (2026-11-13, MorphoFeature #220 RGB data-flow audit, gap 2):
- a thin reader for TIFF-based whole-slide formats;
- a conversion helper for small RGB formats.
Today preprocessing reads only TIFF and OME-Zarr. Other extensions are skipped as "not an image".
Evidence (Aperio CMU-1-Small-Region.svs from the OpenSlide test data, preprocessing v0.5.2, tifffile):
tifffileparses the SVS:is_svs, seriesBaseline(2967, 2220, 3)axesYXS, photometric RGB, JPEG-compressed 240 px tiles, plusThumbnail,LabelandMacroseries. Withimagecodecsinstalled it decodes them.- As
slide.svs, preflight skips it: "1 file is not an image (TIFF or OME-Zarr)". - Renamed
slide_as.tif, it is read (YXS, mapping C = samples) and then refused: "1 image contain more than one image … several series … not supported yet". The thumbnail, label and macro series cause this.
Proposal: thin reader
- Extensions: accept
.svs,.ndpi,.scn(and other formats thattifffileidentifies as a whole-slide TIFF variant) through the existing TIFF path.imagecodecsbecomes an optional extra ([wsi]). Without it, refuse with a message naming the extra; never skip silently. - Baseline-image rule:
- Analyse only the full-resolution baseline series.
- The associated images (label, macro, thumbnail) are listed in the run record as ignored and are never read: the slide label can carry patient identifiers.
- This is an explicit, recorded exception to the "more than one image" refusal, limited to these named associated series. Any other multi-series file is still refused.
- Pyramid levels: level 0 only, unless a level is chosen explicitly (Design: windowed (lazy) Y/X reads of one plane for very large images (whole-slide OME-Zarr) #179: no default level). The physical pixel size comes from the format's own metadata (e.g. Aperio
MPP) when the format states it. Otherwise it is undeclared. It is never inferred from magnification. - Lazy reads: real slides are about 100k px per side. Histograms (
plane_histograms.csv) must stream tiles, and patching needs windowed reads (Design: windowed (lazy) Y/X reads of one plane for very large images (whole-slide OME-Zarr) #179, CellPatcher [Sad Catapella B5][Scientific integrity] Reused TIFF-converted Zarr copies are not validated against their stored pixels #87). Until then, refuse planes over the memory limit with the existing named error. - RGB declaration: these files carry photometric RGB, so
image_type = "rgb"matches the header (no override needed; compare MorphoBricks-Spec Masks have no plane identity (T/Z) #36 for MINISBLACK files). - Tests: decode parity of the baseline with
tifffileon a small public SVS (downloaded and checksum-checked in a test that skips without network, never committed); the associated series are recorded and not read; refusal withoutimagecodecs; multi-series files other than these are still refused.
Non-TIFF whole-slide formats (MRXS, CZI, VSI) are out of scope here. They enter by a documented conversion: bioformats2raw --series 0 slide.mrxs slide.zarr to OME-Zarr. --series 0 keeps only the baseline, or the same multi-series refusal applies.
Proposal: conversion helper for WebP/PNG/JPEG
A small helper, usable from the notebook and the API:
- Conversion: writes each image as photometric-RGB TIFF (uint8,
YXS) next to the source or into a chosen folder. - Record: the source file name, format, size and SHA-256 are recorded in a sidecar that the run picks up.
- Lossy formats: WebP and JPEG are refused unless the user acknowledges lossy compression explicitly, and that acknowledgement is recorded. Alpha is refused, never dropped silently.
- Not a reader: the helper writes TIFF before discovery, so preprocessing itself stays TIFF/OME-Zarr only.
Refs MorphoFeature #220, MorphoBricks-Spec #36, #179, CellPatcher #87.
Metadata
Metadata
Assignees
Labels
No labels
Activity