Interactive lab · digital pathology · data
A scanned pathology slide is one very large picture. A data pipeline for slides does the jobs any pipeline does (move files, check them, pass them on), but most of its checks look at pixels. This page follows one slide through five stations and runs a small version of each station's job right here, on a slide drawn by code.
The slide is made up and much smaller than a real one, and each station uses the simplest version of a real method. A note under each station says where it simplifies. Two other pages on this site sit on either side of this one: Slide to Screen follows tissue from the specimen to the scanner, and One Script to a Pipeline grows a general data pipeline stage by stage. This one starts at the scanned file.
Each station has controls. Move them and watch what changes, there and in the stations after it.
The scanner writes the slide out as one file, usually holding the full-resolution image plus smaller copies of it for zooming out [23]. These files are big:
Each scanner maker also has its own file layout: Aperio's SVS, Hamamatsu's NDPI, Philips' TIFF, and others. A pipeline that takes slides from more than one kind of scanner either reads all of them or converts them to one format first. DICOM, the medical imaging standard, has a format for whole-slide images, and open-source converters such as wsidicomizer turn vendor files into it [4]. The Imaging Data Commons project has been testing that converter as a replacement for the PixelMed tools it converts with now, and in 2026 reported gaps still to fix before switching [5].
Moving and converting files of this size is ordinary pipeline work, the kind the general pipeline page covers. The stations after this one are where slides differ.
Most of a slide is empty glass. Cutting the glass into tiles would waste storage and computing, so the first pixel job is a tissue mask. A common recipe, used by libraries such as histolab and TIAToolbox, turns a small overview of the slide to grey and splits it with Otsu's method [6] [7]: it picks the grey level that best splits the picture into a light group and a dark group. Anything darker counts as tissue. Analysis usually works on small square tiles cut from the slide rather than on the whole picture at once (more at station 5), so the mask decides which tiles are worth cutting. The grid on the drawn slide stands in for those tiles; ones with enough tissue go on to the next station.
| Otsu's pick | |
| Tiles kept | |
| Kept tiles with pen ink in them | |
| Tissue tiles dropped |
Real masks are usually made on a small overview image and then cleaned up: histolab's, for example, grows the mask outward and removes small holes and specks [6]. This one only applies the cutoff, so lone specks of dust show up in the mask view, though they rarely fill enough of a tile to keep it.
A scan can be out of focus in places. Tissue can fold over on itself when it is laid on the glass, and slides often carry pen marks. HistoQC, an open-source quality-control tool, has separate parts for these: a trained classifier that can find pen markings, one that finds tissue and folded tissue by how light or dark it is, and one for blur [9] [10]. This station runs three simple checks of the same kinds on every tile station 2 kept, and crosses out the ones that fail.
| Tiles in from station 2 | |
| Crossed out for blur | |
| Crossed out for ink | |
| Crossed out for a fold | |
| Passed |
Blur. The sharpness score is the variance of the Laplacian. The Laplacian responds to sudden changes in brightness, like the edge of a nucleus. A sharp tile has many of them and scores high; a blurred one scores low [11]. Pipelines set the cutoff for their own scanner, magnification, and tile size. One study, for example, drew its line between sharp and blurred tiles at a score of 500 [11]. The scores here are on this page's own scale. Slide the cutoff up and the crosses spread from the blurred patch into sharp tissue with few nuclei, which has few edges too.
Ink. A pixel counts as ink if it is much greener than it is red, a colour neither stain on this drawn slide makes. That rule is this page's own; real tools use colour rules or trained classifiers.
Fold. Where tissue folds over, light passes through two layers, and the tile comes out darker. A tile is flagged when its tissue pixels average darker than a cutoff set between one layer and two on this slide.
The drawn slide has one blurred patch, one fold, and one pen mark, each put there on purpose so the checks have something to find. Real artefacts are messier, and tools like HistoQC look at each slide at several scales. Checks that look at the whole tile, as these do, also catch good tissue at the edge of a bad patch.
Stain colour varies. Labs stain a little differently, and scanners see colour differently, so the same kind of tissue comes out a different pink from one place to the next. Models trained on one lab's slides often do worse on another lab's [12] [13]. One study, across 9 labs and 4 organs, compared two fixes: varying the colours while training (augmentation) and shifting new slides toward the training colours (normalization) [12]. This station tries the second.
The model here is much simpler than a real one: a nucleus finder that marks any pixel darker than a fixed grey level as nucleus, then counts the blobs. Its cutoff was set on lab A's slides. The tile is drawn from known amounts of two stains, so the true count is known.
| Nuclei in the tile | |
| Found | |
| Missed | |
| Blobs that are not one nucleus |
Reinhard's method converts the picture to Lab colour (one lightness axis and two colour axes), then shifts and stretches each axis so its average and spread match a reference image from the lab the model knows [14] [15]. Other methods, such as Macenko's, first separate the two stains in optical density space [22], and papers on stain normalization compare several of them side by side [16]. Reinhard's has known weak spots: it struggles when the amount of empty background changes a lot between images [17]. The tile here is all tissue, which suits it: on these tiles it brings the count back almost every time, close to its best case.
The labs and the scanner are made up, and the stain colours are chosen to look roughly like H&E. Colour is drawn with the Beer–Lambert idea that colour deconvolution rests on: each stain absorbs light in proportion to how much is there [18]. Real models learn far more than a grey cutoff, and their failures on new colours are subtler than this one's.
What leaves the pipeline is a set of tiles: small squares, often 224 or 512 pixels on a side, cut from the full-resolution image [19] [20]. The drawn slide stands for about 24 by 14 mm of glass, so each of its overview tiles covers a square 0.6 mm on a side. Scaled up to a real scan, the tiles that passed station 3 become:
Each of those tiles is a read from storage, often more than once while a model trains. A study of analysis runs over whole-slide images found that the slow part is often reading the data rather than computing on it. Reading tiles in parallel with an I/O library roughly doubled the I/O speed on CPUs in its tests [21].
The count assumes the tissue fills each passed tile and ignores the overlap some pipelines leave between tiles. Real slides carry more or less tissue than this one, so their counts differ. Change the cutoff at station 2 or the checks at station 3 and the count here moves with them.
This page runs toy versions of each stage to show what it is for. The tools below are open-source projects that cover these stages for real slides.