Ruler tool – physical scale (mpp)

Headless default + ruler (addUI: false). Two ways to get mm labels on the ruler toolbar: read mpp from tiledImage.source.mpp, or pass mpp programmatically to applyRulerPhysicalScaleFromMpp.

Scenario 1: No mpp (paper pixels)

No source.mpp on the tile — ruler stays at default px (unitsPerPixel: 1).

Ruler scale:

Scenario 2a: WSI — scale from tile source mpp

Host sets item.source.mpp (µm/px), then syncs the ruler from the active viewer image. Field-of-view and other overlays can read the same mpp from the tile.

attachMppToViewerItem(viewer, mpp);
syncRulerFromTileMpp(viewer, toolkit);
// equivalent: applyRulerPhysicalScaleFromMpp(toolkit, mppFromActiveViewerImage(viewer));

Ruler scale:

Scenario 2b: WSI — scale programmatic

Pass mpp from metadata/API directly — no source.mpp on the tile. Ruler shows mm; FOV would not work on this viewer without attaching mpp to the source separately.

const mpp = await prefetchDsaMpp();
applyRulerPhysicalScaleFromMpp(toolkit, mpp);

Ruler scale: