Repository navigation
WSI annotations: measurements, points, freehand/brush, notes, review, sharing, list, GeoJSON, undo - #38
Draft
raylim wants to merge 78 commits into
Draft
WSI annotations: measurements, points, freehand/brush, notes, review, sharing, list, GeoJSON, undo#38raylim wants to merge 78 commits into
raylim wants to merge 78 commits into
Conversation
The viewer wrote the layer name into body.comment. It now writes layer_name and color, keeps comment for the user's note, and carries the stored provenance through every update so an edit never drops it. Rows written the old way sent neither layer_name nor color, so the service stored its defaults. Such a row (layer_name Default, color exactly #2f80ed, one-line comment of at most 100 characters) is read with comment as its layer. The viewer writes the service default color as #2F80ED, so its own rows never match. The rule is in wsiAnnotationBody.ts and the README. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
An annotation whose provenance.source is agent, as the service writes for a saved research-assistant proposal, shows an AI badge in the list and tooltip. Until a user reviews it, the list offers Accept, which saves provenance.review_status accepted and reviewed_at with a versioned PUT, and Reject, which deletes it. A checkbox hides unreviewed AI annotations on the slide and in the list. The service refuses an edit of another user's annotation with a 403 naming the creator rule; that is now shown as a per-annotation error instead of turning the study read-only. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
New annotations were always sent with visible_to []. The toolbar now has a Shared/Private default for new annotations (shared unless changed, remembered in localStorage), and each list row shows a Private or Shared badge that switches the annotation with a versioned PUT (null is private to the creator, [] is shared with the study). A PUT sends visible_to only when the viewer knows the stored value. There is no group choice: the proxy sends no groups. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Lines show their length; rectangles, ellipses, circles and polygons show area and perimeter, in µm/mm and µm²/mm² from the slide's microns-per-pixel (the tile metadata mpp the status bar uses), scaled per axis. The list rows and the click tooltip show them, and drawing a line or box shows its length or area next to the cursor. Without a valid mpp sizes are in pixels and the list says the slide has no scale. Selector parsing (FragmentSelector rectangles and the SVG shapes the viewer writes) and the shoelace, Ramanujan and path-length math are in wsiAnnotationGeometryUtils.ts with unit tests. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Each list row shows the annotation's note (body.comment) below its label, with + Note / Edit note for users who can edit. The note is edited in a textarea (Ctrl/Cmd+Enter saves, Esc cancels) and saved with a versioned PUT that leaves the label, layer and provenance as they are. The click tooltip shows the note too. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
The Annotations section gets a filter bar (label or note text, layer, author when there are several, AI origin when there is any) and counts of the listed annotations per layer and per label term (the label without a trailing number, so auto-labels count together; a label chip filters to it). Each label is a button that pans and zooms the slide to the annotation's bounds with a margin. Rows are a labelled list, and every control is a native button, input or select. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
A Point tool drops a point per click (a drag still pans) and stays on until Esc. Points are SvgSelectors holding a radius-0 circle in level-0 image pixels, labelled with the active color's name. Annotorious has no point shape, so points are drawn as fixed-size markers on a canvas over the viewer, redrawn once per frame from an affine image-to-screen mapping, and kept out of Annotorious; adding a point no longer re-sets the unchanged shapes there. A point shows and counts before its save returns. The toolbar shows the active label's count while the tool is on, the Annotations section a Point counts table per label and layer, and clicking a marker shows its tooltip. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Free draws while the mouse button is held and saves the traced outline as a polygon; Brush paints a band of a fixed on-screen width (8-64 px, chosen in the toolbar) and saves the band's outline as a polygon, offset to both sides with mitred corners and round caps. Strokes are sampled every 2 screen pixels and simplified with Douglas-Peucker at 1.5 screen pixels (iterative, so long strokes are safe). A brush stroke is a polygon rather than a line with a width so it has an area, edits like a polygon and exports to QuPath as a region. The preview shows the stroke as it is drawn. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
The toolbar gets a label field for new annotations (empty keeps the color-name auto-label). The runtime's annotations config can name label terms (labelVocabulary) and require them (labelVocabularyStrict); the portal passes the frontend properties wsi_annotation_label_vocabulary (comma-separated) and wsi_annotation_label_vocabulary_strict. The label field and the list's label editor suggest the terms and the slide's used labels while accepting free text, or with strict become a choice of the terms, and a label outside them cannot be saved. No default vocabulary ships: terms are site-specific, and without them the field suggests the slide's own labels. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
The Annotations section exports the slide's annotations (all, or those
on visible layers) as a QuPath-compatible GeoJSON FeatureCollection: one
Feature per annotation in level-0 image pixels, with name,
classification {name, color}, layer, note and QuPath-named measurements.
The collection names the slide by its opaque slide key only; no image
ids, sealed sources, object keys, creators or provenance details.
Import reads a GeoJSON file, validates it (point, line and polygon
geometries and their multi forms, finite coordinates inside the slide,
vertex and feature limits, strict vocabulary), shows a preview of what
it will create and what it skips, and on confirmation saves the
annotations four at a time with the file's label, class color, layer and
note. createAnnotation now resolves to the saved annotation.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Undo (toolbar button, or Ctrl/Cmd+Z outside text fields) reverses this session's last change on the slide: a create is deleted, an edit is reversed by a PUT of the previous version with the current version number, and a delete is re-created with its body, geometry and sharing, after which later undos follow the new id. A layer delete and an import undo as one step; the history holds 50 changes and resets with the slide or study. Annotorious already edits a selected shape's position and vertices. Its update now carries only the new geometry over the stored annotation, so a drag keeps the label, note, layer, sharing and provenance instead of falling back to the active layer and color. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
A WSI-suite Playwright test against mocked backend routes and an in-memory annotation service (versions checked on PUT) draws a line and checks its live and saved length in µm, saves a note and checks the versioned PUT, drops three points and checks the toolbar count, tally and radius-0 circle selectors, and exports GeoJSON, checking the FeatureCollection, its slide key, measurements and note and that no sealed source or image id is in it. wsi-foundation-mocks exports makeSlideRow so the test can give the slide an mpp. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
The annotation sections were added newest first. They now run from the stored body and sharing, through labels, notes and measurements, to the drawing tools, editing, the list and export/import. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
An annotation whose provenance.source is a model source (model, ai, precomputed) now gets the AI badge, the Accept/Reject buttons and the hide-unreviewed filter, like the research assistant's (agent, assistant). The badge's tooltip says which made it, naming provenance.model when set. A rejected AI annotation is not shown. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Accept and Reject now use the annotation service's review route
(POST /annotations/{id}/review with the decision and version), which any
user of the study may call on an AI annotation. An accepted annotation
shows as accepted; a rejected one is kept by the service as a review
record and dropped from the list.
With the signed-in user known (annotationUser, passed from the portal
user name), edit, delete, note and sharing controls show only on the
user's own annotations, only those shapes can be dragged, and deleting a
layer deletes only the user's annotations in it.
A service without the review route (404/405 not about the annotation)
falls back to the creator-only PUT/DELETE, hides the review buttons on
other users' annotations and says that reviews cannot be recorded.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
The brush width is now chosen in µm (10–500, 50 by default) and converted to image pixels with the slide's mpp, so a stroke covers the same tissue at every zoom. A circle under the pointer shows the brush's size at the current zoom, and the stroke previews at that width. Without a slide scale the width stays in screen pixels and the toolbar says so. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
GeoJSON imports and dropped points are created with the annotation service's batch route (POST /annotations/batch), up to 100 annotations and about 3 MiB per request. Points are saved half a second after the last click, when the tool changes and when the page is hidden; points still unsent when another slide opens or the page unloads are sent with keepalive. Undo waits for unsent points; each saved point still undoes on its own, and an import undoes as one step. A 422 naming items marks those refused, with the service's reason, and sends the rest once more; an import names the refused features in its message. A 413 halves the request. A service without the batch route (404/405) gets single POSTs for the rest of the session. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
A row with no layer_name or color gets the service's defaults, so a one-line note written by the assistant or a script was read as a legacy layer, and the next edit sent an empty comment. The legacy rule now needs a row without provenance, and a legacy row's stored comment is sent back unchanged until the user edits the note. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…d ids A point being saved was out of the queue but still had its draft id, so a delete sent then got a 404 (taken as done) and the save brought the point back, and an edit failed and reloaded the slide. Points in flight are now tracked by draft id; an edit shows at once and is saved on the saved id, and a delete waits for the save and deletes the saved point. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
… batch route Points flushed on a slide or study change, or when the page hides, were posted to /annotations/batch while the route was unknown; with no batch route the 404 was dropped and the points never resent, and the page-hide fallback sent only four single POSTs. These flushes now use the batch route only when it is known to exist, and otherwise send one keepalive POST per point, all at once. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
When a point save was refused (401 or 403), the queued points were removed from the slide and the failure was not reported, and points still queued were dropped on a slide change. Refused points now stay on the slide marked "Not saved", with "N points were not saved." and a Retry that sends them again (e.g. after signing in again); points that could not be sent before another slide or study opened are reported there. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
labelTerm dropped any trailing number, so "Grade 1/2/3" and "Gleason pattern 3/4/5" were counted, tallied and exported (GeoJSON classification.name) as one class. Only the viewer's own auto-labels (a palette color's name or hex and a number) now count under their base; a vocabulary term and any other label are their own term. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Without the review route, a creator's accept or reject now shows a note on how it was recorded instead of an error, and is not undoable, like a review. The route counts as missing only on a 405 or a 404 whose JSON detail is "Not Found"; another 404 (a proxy's page) reports that the review was not saved and decides nothing. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
… user The slide permalink route passed no user name, so annotation ownership fell back to the configured display name. It now passes AppStore.userName (the backend's Authentication.getName(), the user the study access check forwards as X-Auth-Request-User), and the Pathology Slides tab requires it; user_display_name stays only as the last fallback. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
… right An import now refuses a file over 25 MB before reading or parsing it, with the file's size in the message. A label outside a strict vocabulary named the draft's position instead of the feature's, which differ once a multi-part feature splits; drafts now carry their feature's index. Tests cover the remaining validation refusals: too many vertices, an unsupported geometry, a MultiPolygon with a bad part, a short open ring, and no slide size. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
- Edit, delete, layer-delete, remove-color and cancel icon buttons get aria-labels naming their target; the layer eye icon and the color dot are aria-hidden. - After accept, reject, delete or a label save, focus goes to the row, else the next (or previous) row, else the list. - Text on a color (color-name badges, the active palette color) is black or white by luminance; the blue of the active layer, links and buttons is darkened to 5.1:1, and the cBioPortal#999/#bbb text to the 4.7:1 muted gray. - The default-sharing toggle keeps a fixed label and reports its state with aria-pressed. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…er deletes - The point tool labels points "Point" with the default color, not "Default". - A label chip filters the list by that exact label term (and toggles), instead of a text search that also matched notes. - Editing stays off until the slide's annotations have loaded; a failed load shows an alert with Retry. - The layer delete confirmation counts only the user's own annotations, and says the layer stays while other users have annotations in it. - The "no microns-per-pixel scale" note shows before any annotation exists. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…-gesture Drawing previews were kept in screen pixels captured at each event, so a wheel or button zoom mid-gesture left the outline, the brush circle and the live measurement where they were on screen while the tissue moved under them. The polygon close check compared clicks to those stale positions, freehand/brush simplification and the no-scale brush width used the zoom at pointerup, and pointer positions were read against the end of a zoom animation rather than what was shown. The shape being drawn is now kept in image pixels and projected on each OpenSeadragon animation/update-viewport event; pointer positions are read with the current viewport; strokes simplify at the finest zoom used and the brush width is fixed at stroke start; only the pressing pointer draws, with pointer capture, and pointercancel/lostpointercapture end the press. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…nd label groups - Redo mirrors undo: each undo leaves the entry that applies the change again; imports and layer deletes redo as one step, re-created ids are followed in both histories, a new change clears redo, reviews stay out. - Annotate on/off and the Shape and Outline menus' last tools, remembered in localStorage; shape editing only while Annotate is on. - A color per layer: the user's choice, else its annotations' most common color, else the default or a color of its own. - V/R/L/P/F/B/. pick tools while Annotate is on and not typing; Ctrl/Cmd+Shift+Z and Ctrl+Y redo; OpenSeadragon's R and F are kept off. - labelGroup: list counts group labels without a trailing count such as " (13 tiles)", never merging vocabulary or graded labels. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…slide The slide's canvas is transparent outside the slide, so the JPEG was black there. The copy is now filled with the color shown behind the canvas (the stage's gray) before the slide and annotations are drawn, with annotations off too. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…s, notes, batches and point undo The mocked annotation service now answers batch-update, batch-delete and batch-review (all or none), comment threads and slide notes, and can hold writes. Seven new tests: a ruler that sends nothing; an HPF field with the points inside it and the per-10-HPF rate; "Saving… 1" then "Saved"; a comment added and edited; a slide note with tags; a bulk accept in one batch-review; three point drops undone and redone in one step. The bulk relabel test now expects one batch-update. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Fields placed quickly one after another read the slide's highest "HPF n" before the previous save had returned, so two could get the same number. The numbers being saved now count as taken. A batch refusal whose item is not in the request no longer blames the request's first annotation; the request counts as not saved. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Regions can have holes and several parts. One ring stays a <polygon> selector; holes and parts are stored as Annotorious writes a multi-polygon (an evenodd <path> per part in a <g>). Measurements take the outer rings less the holes, perimeters every ring; points inside, hit-testing and the downloaded view leave holes out; GeoJSON exports a Polygon with inner rings or a MultiPolygon and imports both whole. The selection bar's "Edit shapes…" menu merges, subtracts, intersects, cuts a hole (or Alt as a shape ends), splits by a line and separates parts, with polygon-clipping 0.15.7 (MIT). Results are the user's: the user's own regions change in place, others' stay and give new annotations; a merge deletes the user's own non-AI originals. An AI region changed in place keeps its source with edited: true; a new annotation from AI ones is source "manual" with derived_from_ai; both show "AI, edited". Each operation is one undo step. A region without points no longer reads "Points inside: 0", except while counting (Point or HPF tool) and on a field. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…plit, export holes The mocked service also refuses machine-made creates, as the service's trusted-writer rule does. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Magic wand (W, Outline menu): a click outlines the connected region of similar color (flood fill); drag up/down or scroll changes the tolerance live, Shift+click adds, Alt+click cuts out, Enter or double-click saves a polygon/multipolygon drawn as the toolbar's layer, label and color, Esc discards, Ctrl+Z takes back a click. Alt as the first click cuts the saved outline out of the selected regions. Smart brush (Shift+B): paints only pixels like the color under the start of the stroke, connected to the stroke, with the brush width in µm. Color distance in CIELAB with lightness at half weight, after a 3×3 blur; holes under 500 µm² filled; crack-following contour through edge midpoints (marching squares) and Douglas-Peucker at 1 µm. Pixels from the OSD canvas at 10× or more, else 10× tiles fetched as blobs and stitched, growing to 4096 px with a note when cut. Work runs in an inline Web Worker (rollup-plugin-web-worker-loader) in its own wsi-tissue chunk; checkWsiBundle checks it stays out of the initial bundles. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
An info icon (tooltip on hover and focus, the same text as each control's
aria-describedby) says what an HPF is: the Shape menu's "HPF field" item,
the field area picker and the field table. Area presets show their field
diameter ("0.237 mm² (0.55 mm), default"). The field table adds a per mm²
column and explains both rate columns.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
The active tool's options (brush width, tolerance, HPF field area, point
count) move to a strip anchored under the toolbar, out of its layout: the
tool buttons, Drawing as, Undo/Redo, Display and the menu stay put as
tools change. The strip is a labelled group ("Brush options") that
follows the tools in the arrow-key order. The save status keeps a minimum
width while annotating, with tabular figures. A mocked Playwright test
records the controls' boxes and switches through every tool, then drops
points until "Saved" shows, at a width where the toolbar is one row.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…der; smaller first tile window On 27720 the focus stayed on the tolerance slider after dragging it (a press on the slide does not move it), and Enter was ignored as typing. A range input takes no text, so Enter, Esc and the shortcuts now apply. The tile window around a zoomed-out wand click starts at 512 analysis pixels (2 or 3 tiles each way) instead of 1024: most clicks need few tiles, and larger selections still grow it. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…to the first outline On 27720 a zoomed-out click on tissue at a high tolerance grew the tile window 2 tiles per step up to the cap, re-stitching each time. It now grows by half its span (at least 2 tiles), shows the outline at every step, stops growing when a newer tolerance or click arrives, and the time shown is from the click to the first outline. A step's tolerance is no longer reset by an older run finishing. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
`data-seed` on the outline (beside `data-source` and `data-ms`) gives the last click in level-0 image pixels, so checks can confirm that two clicks at different zooms hit the same tissue. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
The box blur before selection is about 1 µm each way (3×3 at 1 µm per pixel, 9×9 at 0.25) and the seed color the mean within 2.5 µm of the click, both from the raster's scale, so a click on screen at 40× and one on 10× tiles average the same tissue. The blur uses running sums, so its cost does not grow with the radius. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
On 27720 a click soon after zooming read a half-loaded canvas (the 1.5 s wait for the view's tiles ran out) and outlined less than the same click on tiles. It now waits up to 5 s and, with tiles still loading, uses the tile source instead. Tests of the OpenSeadragon host: the canvas read at devicePixelRatio 2 and placed in image pixels; rotated, tainted and still-loading views; levels and blob tile fetches with the viewer's URLs. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…ansfer Compare (status bar) opens a second viewer next to the slide with a draggable divider. Each pane has its own slide picker (same block, then same part, then the rest of the patient's slides, the other stain first), stain and Slide ID, and shows its own annotations. Only the active pane shows the annotation toolbar and takes the annotation keys; F6 moves the focus between panes, and a hidden viewer (inactive tab) takes no keys. Views are locked by default: the pane last used leads, through 3+ point pairs fitted as a similarity or affine map (least squares, residuals in µm), else an anchor in µm, else the same relative position. Points are placed, dragged, nudged and deleted on the slides; the alignment is kept per slide pair in localStorage. Selected annotations or a layer copy through the alignment as new manual annotations (holes and parts kept), saved in batches as one undo step, marked transferred and unverified with the source, model and residual; Mark verified saves verified: true. The review card's focus fallback is scoped to its own viewer. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
wsi-compare-mocked.spec.ts (3 tests, PW_SUITE=wsi): Compare opens the same block's IHC with the picker grouped by match level, keys and H go to the active pane only and F6 switches; panning the right pane moves the left; three point pairs on synthetic H&E and turned IHC tiles give a small residual, a copied rectangle lands on the same tissue with its provenance, Mark verified and undo. The annotation service mock and PNG encoder move to wsi-annotation-mocks.ts, and the mock lists rows by slide. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…e "Block" in option labels On 27720 picking a slide in the right pane moved the left one: the new slide's home view raised pan and zoom events while the right pane led. A pane now follows while its slide opens and leads again once open. The picker's option labels for other parts read "Part 5 · Block 1", not "Block Block 1", when the source already names the block so. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…notes and links - Magic wand: every Shift/Alt+click is computed (a queue of steps, each at its latest tolerance), a raster still used by an earlier step is never dropped when the tile window grows (steps move to the grown raster; rasters are released only when nothing refers to them), a hi-DPI canvas larger than the cap is read around the click or stroke start rather than its centre, and after Esc nothing a late tile or step finishes shows. A new click or Esc cancels the earlier tile fetches (AbortSignal). - Smart brush: a stroke finishes on its own (stroke handles), so a stroke started while the previous one is still being saved is kept, and the save of one no longer resets the gesture of the next. - Shape edits run one after another, so two quick cuts both apply on the saved geometry and version. An operation saved only in part (a merge whose original-delete fails, a split whose PUT conflicts) is taken back: what it created is deleted, what it changed put back and what it deleted created again, with a clear message and no undo entry. The originals of a merge go in one all-or-none batch-delete. - Slide notes: an answer read after another slide opened is dropped, so a note can no longer land on the wrong slide. - Annotation list: a short list scrolls to the annotation the slide is pointed at (the row's offset in the list). - Links: a requested annotation opens only on the link's slide, once; the hosts pass that slide key and drop annotationId from the address once it was used. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
- Reject asks first and moves off R: X (or Reject) in the review card asks in the card and X or Enter confirms (Esc cancels); the list row's and the selection bar's Reject confirm with the count and what a reject does. Undo right after a review says "Reviews can't be undone." instead of undoing an earlier edit; pressed again it undoes that edit. - The selection bar's Move to layer…, Sharing… and Edit shapes… are menu buttons (the toolbar's role="menu", moved to wsiMenu.tsx), so arrowing through them never acts. - Deleting or merging away annotations with comments asks first, naming the comment count and whether other users wrote some; Undo that creates one again says its comments could not be restored. - HPF table: counts the user's own fields and points by default (or the drawing layer, or all users), counts a point in overlapping fields once and their overlap once, names overlapping fields, and marks the rate per 10 HPF provisional (not bold, "based on N fields") under 10 fields. Each rate column has an info icon (WsiInfo) instead of a title only. - README: the review, bulk-menu, thread and HPF rules, and the service changes that would allow undoing a review and keeping a thread. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
- R is always the rectangle; ellipse, circle and the HPF field are picked from the Shape menu, so R can no longer start an HPF field. - "." picks Point while Annotate is on, does nothing while the review card is open, and otherwise shows or hides the details sidebar (the sidebar's button always does), so it never folds the sidebar mid-review. - OpenSeadragon's R (rotate), F (flip) and W (pan up) keys are off with Annotate off too; the arrow keys still pan. - A checkbox or radio button (a list row's selection box) is not a typing target, so the shortcuts keep working after one is ticked. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…d live regions - Help that lived only in a title has an info icon whose tooltip shows on hover and focus and whose text is the control's aria-describedby (WsiInfo): the wand and smart brush tolerance, each HPF rate column; the review card says what a reject does (aria-describedby), and the list row's Reject is described too. - The AI and Transferred badges are role="img" with their description as their name, not an aria-label on a plain span. - Sidebar text of 9-10 px is 11 px, and the click tooltip's lines are no longer dimmed with opacity. - The toolbar has one Tab stop (a roving tabindex: the control last focused, else the first); the arrow keys, Home and End move within it. - Counting points no longer announces every click: the Point tool's count and the save status show at once and announce through hidden live regions that pass a changing count at most every 1.5 s (a change of state at once). Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…shape ops) - annotations is an observable.ref (the array is always replaced, items are plain objects); comment threads, comment counts and the selection are observable maps read per key, so a thread or a checkbox changing re-renders only its row. - Slide labels: bounds are computed once per change of the shown annotations, and on each frame shapes outside the view or too small for a label are culled in image pixels before mapping, sorting and placing. - Annotation list: the scroll position is applied once per animation frame, the view's height is measured on resize rather than read in render, and a render measures only rows not measured yet. - Shape operations and polygon-clipping load as their own async chunk (wsi-shapeops) when one first runs; region measuring moved to wsiRegionUtils.ts. The magic wand loads the same chunk for Shift/Alt clicks instead of bundling a second copy. checkWsiBundle fails a build with polygon-clipping outside that chunk. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…wait
- Comment threads and slide notes read the service's paged lists
({…, total, offset, limit, has_more, next_offset}) as well as an older
service's whole list: "Show more comments" / "Show more notes" load the
next page without repeating what shows, counts and the tag summary use
the service's totals, and a deleted item shifts the next offset back.
A cap's 422 (1,000 comments per annotation, 1,000 notes per slide)
shows the service's message.
- A 422 on an annotation's target (the service's selector rules) says
"This shape can't be saved" for a create, a batch item or an edit (the
edit reloads the slide as stored); a PUT on an annotation deleted
meanwhile (404) reloads and says so.
- The viewer element carries data-wsi-animating while OpenSeadragon
animates; the zoomed-mid-gesture e2e test waits for it instead of
sampling the outline until two reads agree.
- E2E: the review test confirms its reject (X twice, the row's dialog),
shape operations are picked from the Edit shapes… menu, a merge deletes
its originals in one batch-delete, and the save status's live region is
its own element.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
What shows is decided by the layers' eyes and solo plus one Show control with four kinds: Mine, Others, AI unreviewed and AI accepted. Show sits in the Display popover (checkboxes) and at the top of the Annotations section (toggle chips), each kind with its count on the shown layers. The sidebar's "Hide unreviewed AI annotations" checkbox and the list's "AI and manual" select are gone; neither was stored, so no preference needs migrating. The slide, the list and its counts, ]/[, Ctrl+A, the review queue (Review AI (N)) and "visible" exports all read the same shown set. A hint above the list says "N hidden by filters" with Show all whenever layers, Show or the list's filters leave annotations out, or H hides them on the slide. README: the Show model, and the service note that visible_to null is creator-only while the viewer creates shared annotations by default. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
While the review card is open, A or Enter accepts (Enter on a focused button stays that button's own), X asks before a reject (X or Enter confirms, Esc cancels), S or → skips, ← goes back and Esc exits. R is never a review key: it is always the rectangle once the card closes. "." now always shows or hides the details sidebar, Annotate on or off and while reviewing; the Point tool moves to C. The shortcut help lists every key, including "." and "|" for the panels and Enter for accept. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
While Annotate is on, the details sidebar puts Annotations first and
lets it take the height the other sections leave (at least 360 px, or
55% of the window when that is more; taller content scrolls inside
it); the list fills that height instead of a 260 px box and stays
virtualized. Layers and Slide notes follow, then the slide's details,
with Clinical collapsed until opened (its own remembered state while
annotating). With Annotate off the order is as before. Sections are
keyed, so turning Annotate on or off moves them without remounting.
The point table, the HPF table and the per-layer and per-label counts
move under one Counts disclosure, collapsed by default and remembered;
its button summarizes what it holds ("Counts · 6 points · 2 HPF"). The
chip clouds sit behind a remembered "Group by…" select, one at a time.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
The toolbar groups the tools by task, each a labelled group between dividers: Draw (Shape ▾: rectangle, ellipse, circle; Outline ▾: polygon, freehand, brush, smart brush, magic wand), Count (Point, now C, and HPF field, out of the Shape menu, Shift+C, its area preset in the options strip) and Measure. Line and Measure are one Measure tool with a "Keep as annotation" option in the options strip: on, the line is saved (L); off, a quick ruler that is never saved (M). The choice is remembered; toggling it while Measure is on switches at once, and a split by a line turns it on. A stored Shape tool no longer in the menu falls back to the rectangle. The toolbar stays one row at a 1600 px window with both sidebars open; the layout e2e check now runs at 1920 and 1600 px and checks one row as well as no shift. The shortcut help and README follow. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
The selection bar shows "N selected" and one Actions ▾ menu button: Relabel N… (a label field in the bar), Move N to layer ▸, Sharing of N ▸ and Edit shapes ▸ (submenus beside their item: → or a click opens, ← or Escape closes, focus returns), Accept N, Reject N…, Delete N… and Clear selection. Each item names its count and, at its end, whether Ctrl+Z undoes it. The confirm and undo rules are the same everywhere: Delete and Reject ask first; whatever Ctrl+Z can undo says so in the menu and, once done, under the status; reviews say they can't be undone. The shared menu moves only between its own items, so a submenu keeps its own keys. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Undo of a delete (one, bulk, layer, or the originals of a merge) restores
the annotation under its id with POST /annotations/{id}/restore or
batch-restore, sending the version it was deleted at, so its comments and
links survive; redo deletes it again. Shape-edit rollbacks restore the
originals the same way. The delete warning for annotations with comments
says Undo brings them back and that the service purges deleted
annotations after 30 days by default.
Accept and reject, one or in bulk, are one undo step each: undo sends
decision "reset" (batch-review for several), redo reviews again. The
reject confirmation stays, saying Undo can take it back. A reset refused
because another user reviewed it since says so.
On an older service (restore route missing; reset refused as an unknown
decision) the viewer remembers it for the session and falls back to
creating annotations again with new ids, and to reviews that can't be
undone. The in-memory test service models soft deletes, restores and
resets.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
The mocked annotation service models soft deletes, restores and review resets. Two Playwright tests: a reject undone returns to unreviewed, and the delete of an annotation with a comment undone keeps the annotation and its comment. The README documents the undo rules and deleting and restoring. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Below 960 px of viewer width the toolbar turns compact: the "Drawing as:" text becomes a tooltip on its group and the save status shows its icon alone at a fixed width, with the text in its tooltip and live region. A ResizeObserver on the viewer pane switches the mode, so the tools stay on one row down to about 780 px of viewer (the patient tab with both sidebars open at a 1600 px window gives 904 px). Switching tools still moves nothing, and the roving tab stop and accessible names are kept. The layout e2e now also sets the viewer itself to 904 and 880 px, and checks which mode the toolbar is in. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Annotation authoring tools for the WSI viewer package, on top of #19. Frontend only. Everything runs against the annotation service on cBioPortal/cbioportal-tile-server
main, except what needs cBioPortal/cbioportal-tile-server#51:POST /annotations/{id}/reviewroute. Without it, the viewer falls back to creator-only review.POST /annotations/batch. The route itself is already onmain.provenance.sourceof its own.Bulk actions in single requests, comment threads, slide notes, review undo and restoring deleted annotations need cBioPortal/cbioportal-tile-server#52 (stacked on cBioPortal#51):
POST /annotations/batch-update,/batch-deleteand/batch-review,/annotations/{id}/comments,/slide-notes(plus a/wsi/slide-notesroute in the proxy), reviewdecision: "reset", and soft deletes withPOST /annotations/{id}/restoreand/batch-restore. Without them, bulk actions send one request per annotation, the thread and slide-notes UI stays hidden, reviews can't be undone, and Undo of a delete creates the annotation again with a new id. The viewer reads both the paged thread and notes lists of that PR ({…, total, offset, limit, has_more, next_offset}, "Show more") and the whole lists of an older service, shows its 422 caps (1,000 comments per annotation, 1,000 notes per slide), and says "This shape can't be saved" for a 422 ontarget(its selector rules).Toolbar
role="group"between dividers: Select (V); Draw: Shape ▾ (rectangle R, ellipse, circle) and Outline ▾ (polygon P, freehand F, brush B, smart brush Shift+B, magic wand W); Count: Point (C) and HPF field (Shift+C); Measure (L or M); then Drawing as, then Undo and Redo. A save status sits before the Display eye.ResizeObserveron the viewer pane;data-compacton the toolbar): the "Drawing as:" text becomes the group's tooltip (the group keeps itsaria-label) and the save status shows its icon alone, its text in the tooltip and the live region. Compact, the row fits down to about a 780-pixel viewer and wraps between groups only below that. The e2e layout check runs at 1920- and 1600-pixel windows and at 904- and 880-pixel viewers.tabindex: the control last focused, else the first); the arrow keys, Home and End move within it.role="status"region kept on the page announces it: a change of state at once, a changing count at most every 1.5 s, so counting points does not read out every click (the Point tool's count is announced the same way). Failed edits, deletes and reviews reload the slide and say so in the Annotations section.localStorage(a stored Shape tool no longer in the menu, such as the HPF field, falls back to the rectangle).Magic wand and smart brush (tissue-aware selection)
Classical image processing, no model. Both save ordinary regions (a polygon, or a region with holes or parts), drawn as the toolbar's layer, label and color, and load with their Web Worker as their own async chunk (
wsi-tissue, about 70 KB) when either is first picked.√((0.5·ΔL*)² + Δa*² + Δb*²), from the mean color within 2.5 µm of the click, after a box blur about 1 µm each way (3×3 at 1 µm per pixel, 9×9 at 0.25; running sums). Both are in µm, so a click on screen at 40× and one on 10× tiles average the same tissue. Lab is near perceptually uniform, so one tolerance means about the same visible difference for H&E and IHC: eosin pink, hematoxylin purple, DAB brown and background differ in hue and chroma, which count fully, while staining intensity within a tissue varies with thickness and focus, so lightness counts half. Color deconvolution was not used: it needs stain vectors per stain and scanner. Colors are quantized to a 32,768-entry Lab table./wsi/tiles/zxy/…?studyId&key&enc, session cookie) and stitched offscreen; it starts at about 512 px square (2 or 3 tiles each way), grows on each side the fill reaches by half its span (at least 2 tiles) up to 4096 px a side (about 4 mm at 10×), shows the outline at each step, stops growing when a newer tolerance or click arrives, says when it is cut at the limit, and shows a spinner while loading. A new outline or Esc cancels the tile requests still waiting (AbortSignal), and nothing an earlier click finishes shows afterwards. Outlines are in image pixels either way; on a synthetic slide the two sources agree within 3% of the area. The status under the slide names the source and the time from the click to the first outline; the outline element carriesdata-source,data-msanddata-seed(the click in image pixels).rollup-plugin-web-worker-loader, started from a Blob URL, no extra file to serve); the raster is transferred once per click and kept for tolerance changes, and each click is computed at its latest tolerance. A raster stays while a click of the outline, a stroke or the next click can use it (one grown for a later click replaces it for all) and is dropped once nothing refers to it. A slider is not a text field, so Enter, Esc and the shortcuts still work with the tolerance slider focused. Without a worker (noWorker, or a CSP withoutblob:workers) the same code runs on the main thread.checkWsiBundlealso checks the tissue code is not in an initial bundle.Quick ruler
High-power fields and points inside regions
aria-describedby).aria-describedby): "HPF (high-power field): the area of tissue seen through the microscope at high magnification (40× objective). Mitoses and other counts are often reported per 10 HPF. The field's area depends on the microscope's eyepiece (its field number): pick your microscope's area, or enter it in mm². Default 0.237 mm² (0.55 mm diameter)." The table's icon also explains its two rate columns.Num points,Num points: <label>andPoints per mm^2to a region'smeasurements.Reviewing AI annotations one by one
provenance.model), layer, area/perimeter or length, and note.aria-describedby); S or → skips; ← goes to the previous one still unreviewed; Esc or × closes. The order wraps, so skipped ones come back. "N of M reviewed" counts those reviewed by anyone (or gone) of the ones the queue started with; the end says "All M AI annotations reviewed." or why some are left.Display
aria-pressed), each kind with its count on the shown layers, so the shown kinds add up to what the slide shows; both set the same state. The slide, the list and its counts, the section's title,]/[, Ctrl+A, the review queue (Review AI (N)) and "shown" exports all read the same set; the list's own filters (text, layer, author, label) only narrow the list. There is no separate "Hide unreviewed AI annotations" checkbox or "AI and manual" list filter; neither was ever stored, so no preference needed migrating.wsiAnnotationSnapshot.ts; holes filled even-odd, so they stay empty): what shows (layers, solo and Show), the Display fill or outlines only, points as their markers, and the labels on the slide when on; nothing while all are hidden (H). Shapes are traced in level-0 pixels through the overlay's image-to-screen mapping and drawn at the snapshot's measured pixel ratio, so they line up at any device pixel ratio. The quick ruler is drawn too while it shows. The copy is first filled with the color behind the slide (the stage's gray, read from the page), so the area around a zoomed-out slide is gray rather than black, with annotations off too. The shape being drawn, the selection, the selection box and the review highlight are left out. The file name is unchanged.localStorage(with try/catch); hide all and solo are not.Stepping through annotations, and links to one
role="status") with ‹ ›, Copy link and ×. A list row's label highlights its annotation too. Esc clears the selection first, else the highlight.]/[were picked because N/P would clash with P (Polygon) and the arrows belong to the review card and to OpenSeadragon's panning./patient/wsiHESlides?studyId=…&caseId=…&pathologySlideSettings={"annotationId":"…"}#wsi:slide=<slide key>: the existing deep-link hash selects the slide, andannotationIdis a new key of thepathologySlideSettingsnode (PatientViewUrlWrapper), read byPatientWsiSlidesTab;/wsi/patient/{patient}?studyId=…&slideKey=…&annotationId=…, read byWsiPatientViewRoute.requestedAnnotationId,requestedAnnotationSlideKey,onRequestedAnnotationUsedandannotationLinkprops. The linked annotation opens only on the link's slide (the hash's slide on the tab,slideKeyon the permalink), once, when its annotations load; both hosts then dropannotationIdfrom the address (history.replaceState, keeping the#wsi:hash), so a reload or another slide does not open it again. Opening it: its hidden layer is shown (ending a solo), its kind is turned on under Show, hide all is turned off, and it is fitted and highlighted. A missing, rejected or another user's private annotation (none of which the service lists) gives "The linked annotation is not on this slide…" in the bar. Without the Clipboard API the bar shows the link to copy by hand.Selecting several annotations
wsiMenu.tsx): Relabel N… (a label field in the bar; Enter applies, Esc cancels), Move N to layer ▸, Sharing of N ▸ and Edit shapes ▸ (submenus), Accept N, Reject N…, Delete N… and Clear selection. Relabel, move, sharing and delete apply to the user's own annotations; Accept and Reject to unreviewed AI annotations the user may review (anyone's, through the review route). Items act on a pick, never while arrowing through, and each names its count and, at its end, whether Ctrl+Z undoes it ("Ctrl+Z undoes" or "Can't be undone"). Arole="status"says what was done, skipped ("skipped 1 that is not yours") and not saved.POST /annotations/batch-update, delete throughbatch-delete, accept and reject throughbatch-review, and their undo throughbatch-review(reset) andbatch-restore, in requests of up to 100 annotations, each with its currentversion, saved all or none. A 409 lists the stale ones: they are reported as changed elsewhere, the slide reloads so they show as stored, and the rest are sent again from the reloaded versions. A 403 or 404 naming an item reports it by label with the service's reason and sends the rest again (a missing one also reloads the slide). A 404 "Not Found" or 405 means the route is missing: that action and later ones of its kind send one request per annotation, four at a time, as before. The status names up to three that were not saved, and why.grouphistory entry), as do a bulk delete (onebatch-restoreper 100) and a bulk accept or reject (onebatch-reviewreset per 100).Editing shapes: holes, merge, split
SvgSelector<polygon>, so existing annotations read, render and edit unchanged. Holes and parts are stored as Annotorious writes a multi-polygon, which the service stores as given: one<path fill-rule="evenodd">per part in a<g>, the outer ring then the holes as closed subpaths (<svg><g><path fill-rule="evenodd" d="M 0,0 L 100,0 L 100,100 L 0,100 Z M 40,40 L 40,60 L 60,60 L 60,40 Z" /></g></svg>), level-0 pixels rounded to 0.01. Annotorious draws it with the holes empty and edits its vertices; the viewer parses it (parseAnnotationShape→multipolygon), measures, counts points and hit-tests with holes left out. An older viewer draws it but lists it without a size.A bar under the menu says what to draw while a cut or split waits; the bar's status says what was done, kept and not saved.
provenance.source(an update by the creator may keep it; review fields stay as stored) and getsedited: true, also when its vertices are dragged; a new annotation made from AI annotations is written as{source: "manual", operation, derived_from: [ids], derived_from_ai: true}(from other annotations, the same withoutderived_from_ai). Both show AI, edited; History says "Created (merge of 2 annotations, from AI)" or "Shape edited by a person"; a derived one is the user's, so it counts as Mine and is not in the review queue.groupentry): undo deletes what it created, puts the previous shape back on what it changed (versionedPUT) and restores the deleted originals under their ids, with their comments; redo applies it again.PUTs), then the originals' deletes (one all-or-nonebatch-delete). If any part fails (a merge whose originals cannot be deleted, a split whose region changed meanwhile), what was saved is taken back (created ones deleted, changed ones put back, deleted ones restored under their ids), the status says what failed and that nothing changed, and nothing is left to undo. Operations run one after another, so a second cut drawn while the first saves applies to the saved shape and version.pnpm-lock.yaml. It andwsiAnnotationShapeOps.tsload as their own async chunk,wsi-shapeops, when a shape operation (or a wand Shift/Alt+click) first runs; area, bounds and parts (wsiRegionUtils.ts) stay in the viewer.checkWsiBundlefails a build with polygon-clipping outside that chunk. A split cuts a 0.2-pixel band along the line (about 0.05 µm at 0.25 µm/px), so pieces do not touch; slivers under 1 px² are dropped.Side by side: H&E and IHC, manual alignment, annotation transfer
role="separator", arrow keys by 5%, Home/End; each slide keeps at least 20%). It is disabled with the reason when the patient has no other slide. A bar above the slides holds Lock views, how the views follow each other, Set anchor/Clear anchor, Align and copy and close.#wsi:link); the right pane keeps no URL state (ownsUrlState: falseon its controller host). The main stage keeps its place in the React tree, so its OpenSeadragon viewer is not rebuilt when Compare opens or closes.]/[, review keys, Ctrl+A); the other pane's drawing stops (setPaneActive). The details sidebar follows the active pane. F6 moves the focus to the other slide. A viewer the host hides (hidden, e.g. an inactive tab left mounted) takes no annotation keys at all (setViewerHidden), so a key on another tab never reviews the AI annotation under review. The review card's focus fallback looks for the annotation list in its own viewer only.wsiComparePairing.ts): the picker lists the patient's servable slides relative to the other pane's slide in option groups: Same block, then Same part, then the rest by sample and part (that slide's sample first, unmatched last); within a group the counterpart stain first (IHC next to H&E, H&E next to IHC or other). Compare opens the first, so an H&E opens with the same block's IHC and an IHC with the same block's H&E. Groups come from the hierarchy (sample → part → block), stains fromstain_kind.wsiCompareSync.ts; Lock views, on by default): the pane last pressed, scrolled or typed in leads; itspan/zoom/rotate/fliprequests move the other to the mapped target, so both animate together; a pane opening another slide follows and does not lead until it is open. The map:wsiCompareTransform.ts,wsiCompareStore.ts): Align and copy opens a fixed-height panel (the slides do not move as it changes). With Place points on (on at first without an alignment), a click (a drag still pans) on a feature of either slide, then on the same feature of the other, makes a numbered pair; shapes ignore clicks meanwhile. Markers are buttons: drag to move, arrow keys to nudge (1 or 10 screen pixels), Delete to remove the pair (or × on its chip). A complete pair shows a dashed ring where the fit puts the other point.localStorage(wsi-compare-alignment:v1:<key>:<key>, keys sorted so either side order finds it), with try/catch.provenance:{source: "manual", operation: "transfer", transferred_from: {slide_key, annotation_id}, transform_model, transform_residual_um (or _px), verified: false}, plusderived_from_ai: truefrom an AI source (shown "AI, edited");source: "manual"passes the trusted-writer rule. List row and tooltip show Transferred · unverified/· verified; Mark verified (creator only, versionedPUT, off the undo history) addsverified: true,verified_by,verified_at. History reads "Created (copied from slide WSI-… through an alignment)" and "Place verified".Stored body
body.layer_name, the color tobody.color(letter case kept), andbody.commentholds the user's note.body.provenanceis carried through every update; shape editing addsedited: trueto an AI annotation a person reshaped, and writessource: "manual",operation,derived_from(andderived_from_ai: truefrom AI annotations) on the annotations it makes; a side-by-side copy writes the transfer provenance above.layer_namewas used kept the layer incommentand sent nolayer_name,colororprovenance, so the service stored its defaults (Default,#2f80ed). A row is read as legacy, withcommentas its layer, only when it has noprovenance, those defaults, and a one-linecommentof at most 100 characters. A row with provenance (the assistant, scripts, loaders) keeps its one-line comment as a note. The viewer writes#2f80edas#2F80ED, so its own rows never match.commentthat only repeatslayer_name(as the assistant writes) is not shown as a note. The rules are inwsiAnnotationBody.tsand the README.Review, sharing and notes
provenance.sourceisagentorassistant(the research assistant) ormodel,aiorprecomputed(a model). The tooltip says which, and namesprovenance.modelwhen set. Show hides them by their review (AI unreviewed, AI accepted), on the slide and in the list alike.POST /annotations/{id}/reviewwith{decision, version}. The service recordsreview_status,reviewed_byandreviewed_at.{decision: "reset", version}(batch-reviewfor several): the annotation is unreviewed again, a rejected one is listed again, and the review card goes back to it. Redo reviews it again. Only the latest reviewer may reset: when another user reviewed it since, the service's 403 is shown as "Could not undo the accept of "Tumor": bob reviewed it since, and only the latest reviewer can undo a review." (not as lost access). A 409 or 404 reloads the slide and names it.resetas an unknown decision (a 422 ondecision) is remembered for the session: the first Undo says "This annotation service cannot undo reviews…" and drops reviews from the history, later reviews stay off it, and Undo right after one says "Reviews can't be undone." before undoing the earlier edit.detailis "Not Found". The viewer then falls back for the session: the creator accepts with a versionedPUTand rejects by deleting, neither on the undo history, and a note (not an error) says how it was recorded. Other users see no review buttons. Any other 404, such as a proxy's HTML page, reports that the review was not saved and decides nothing.annotationUser: the page'sAppStore.userName(the backend'sAuthentication.getName(), which the study access check forwards asX-Auth-Request-Userand the service records ascreated_by). Both the Pathology Slides tab and the/wsi/patient/...permalink route pass it;user_display_nameis only the last fallback.visible_tobetweennull(private) and[](shared with the study). The README notes for services and loaders that an annotation created withvisible_tonull (or without it) is creator-only, so machine-made annotations meant for review must be created with[]; the viewer creates shared annotations by default.body.comment, separate from the label, saved with a versionedPUT. The tooltip shows it too.review_status,reviewed_by,reviewed_at) and the last change with its version (version,updated_at). The service records no editor for an update, so the last change is credited to the reviewer when it is the review (saved within 5 s ofreviewed_at), else to the creator, the only user who may edit. The tooltip says "By alice · version 3". A full audit log would need a change table in the service; the History block says so.Comment threads
comment_count) as a badge. A paged thread loads 100 at a time: Show more comments (N more) at its end; a cap's 422 message is shown.POST /annotations/{id}/restorewith the version it was deleted at (onebatch-restoreper 100 for several): the same id comes back at the next version with itscomment_count, so comments and links to it survive; redo deletes it again. Merge, split and shape-edit rollbacks restore the originals they deleted the same way. One already purged (404) is created again with a new id. On a service without the route (405 or 404 "Not Found", remembered for the session) Undo creates the annotation again with a new id, the history follows it, the delete warning says the comments go, and Undo says "… was created again as a new annotation; its 2 comments could not be restored." It loads the thread under the row, oldest first, each comment with author, time and "(edited)". Users who can edit add a comment (Ctrl/Cmd+Enter or Comment; 1–4,000 characters, a count near the limit) and edit or delete their own (Delete after a confirmation); others' comments have no controls. The annotation's note stays separate. The tooltip says "2 comments".comment_count; a 404 "Not Found" or 405 from the thread route turns them off for the session. Another user's comment ("Only its author can change this comment.") and a comment deleted meanwhile (the thread reloads) show on the thread asrole="alert"; an annotation gone or no longer shared reloads the slide.Slide notes and tags
/slide-notes), each with text, tags, author, time, "(edited)" and Private or Shared. Above them, the slide's tags with how many notes carry each, most used first; a tag filters the notes (aria-pressed)._-.:/+#starting with a letter or digit, checked before sending; a repeat in another case dropped) and Shared with the study or Private, starting from the ⋯ menu's default. They edit and delete only their own, with the note'sversion; a 409 or a note gone meanwhile reloads the notes and says so.total). Paged, Show more notes (N more) loads the next 100, the tag summary counts all notes, and a cap's 422 message is shown. An answer read after another slide opened is dropped, so a note never lands on the wrong slide. Without the route (404 "Not Found" or 405) the section goes away for the session.Measuring and drawing
tile_metadata.mpp, scaled per axis. A region with holes or parts measures its outer rings less its holes, and a perimeter along every ring. Shown in the list, the tooltip and, while drawing a line or box, next to the cursor. Without an mpp, sizes are in pixels, and the panel says so even before any annotation exists.SvgSelectorcircle of radius 0, drawn as a fixed-size marker on a canvas kept out of Annotorious, so hundreds stay fast. A toolbar count and a per-label/per-layer tally (under Counts) update at once.POINT_UNDO_GROUP_MS). Another tool or the Point tool picked again, Esc, any other change, undo or redo, or a longer pause starts a new step; the pause bounds what one undo can take back while counting at a steady pace. Each point stays its own annotation, edited or deleted on its own. A run undoes withbatch-delete(one by one without it) and redoes with batch saves.keepaliveand without waiting for an answer: in batches when the batch route is known to exist, else as one POST per point, all at once.SVGPointList.appendItem), placing the whole stroke again only when the slide moves, so a 5,000-point stroke costs the same per move as a short one. Both are simplified with Douglas–Peucker (1.5 screen pixels at the finest zoom the stroke was drawn at) and saved as polygons (the brush as its outline), so they have an area and export to QuPath as regions.animation/update-viewport, so they stay on their tissue. A polygon closes on its first vertex where it is now. The status bar's cursor position follows the pointer during a drag, stroke or polygon too. Only the pointer that started a press draws (with pointer capture);pointercancelor lost capture drops the drag shape or stroke, and a polygon keeps its vertices.PUTof the previous version with the currentversion), delete (restore under the same id) or review (reset). Redo (toolbar, Ctrl/Cmd+Shift+Z or Ctrl+Y) applies an undone change again the same way. Layer deletes, bulk actions and imports undo and redo as one step; annotations created again on a service without restores get new ids and both histories follow them. A new change clears the redo history.Labels, list, export and import
annotations.labelVocabulary/labelVocabularyStrictin the runtime, from the portal propertieswsi_annotation_label_vocabulary(comma-separated) andwsi_annotation_label_vocabulary_strict. The label fields suggest the terms and the slide's used labels and accept free text, or with strict offer only the terms. There is no default vocabulary.ResizeObservercatches a note or thread opening; a render measures only new rows, the view's height is measured on resize, and the scroll position is applied once per frame), witharia-posinset/aria-setsize; the focused row stays rendered when scrolled away. In any list ↑/↓ move between rows' labels and Home/End to the ends, rendering the row first, and the list scrolls to the annotation the slide is pointed at (]/[, review, a link).name,classification {name, color},layer,noteand QuPath-namedmeasurements(andai_edited). A region with holes is aPolygonwith its inner rings, one of several parts aMultiPolygon. The slide is named by its opaque slide key only.MultiPolygon), then previews the counts and skipped features. APolygonkeeps its holes and aMultiPolygonis one annotation of all its parts;MultiPointandMultiLineStringstill split into one annotation per part. On confirmation it creates the annotations with batch saves, which undo as one step. Refused items are named with the service's reason; the rest are still created.POST /annotations/batch, with at most 100 annotations and about 3 MiB per request (60 KiB withkeepalive). A 422 naming items marks those as refused and sends the rest once more; a 413 halves the request; a 404/405 switches the session to single POSTs (four at a time, or all at once withkeepalive).Accessibility
aria-hidden.titlehas an info icon (tooltip on hover and focus) whose text is the control'saria-describedby(WsiInfo): the tolerance, each HPF rate column, and the reject consequence. The AI and Transferred badges arerole="img"named by their text and description. Sidebar text is at least 11 px, and the click tooltip's lines are not dimmed.role="toolbar"with a label; the arrow keys, Home and End move between its controls, and fields keep their own arrow keys. Shape, Outline, ⋯ and the selection bar's Actions are menu buttons (aria-haspopup,aria-expanded) whose menus open with Enter, Space or the down arrow, move with the arrow keys, Home and End, close with Escape, Tab, a press outside or a pick, and return focus to the button. Actions' submenus (Move to layer, Sharing, Edit shapes) are menu items witharia-haspopup/aria-expandedthat open beside them with Enter, Space, a click or →, keep their own arrow keys, and close with ← or Escape back to their item; the parent menu moves only between its own items. Tools and the sharing default aremenuitemradio/aria-pressed; the color palette and the shortcut list are dialogs that close with Escape. Every icon button has anaria-labelnaming its shortcut.role="dialog"named "Review AI annotations": it takes the focus on Accept, keeps it inside as it moves on, ignores clicks while a decision saves (aria-disabled, so focus is not lost), and gives the focus back to the button that opened it (else the list). Its buttons carryaria-keyshortcuts. Progress, decisions, the focused-annotation bar, link messages and bulk results arerole="status".aria-valuetextin %) and closes with Escape back to the eye; the bulk bar is a labelled group whose Actions items say how many they apply to and whether Ctrl+Z undoes them. Slide labels are white on at least 70% black, and the new buttons keep 4.5:1 or more.role="status". Errors and the unsaved-points notice arerole="alert"; the review note isrole="status".role="status"region; Show is a fieldset of labelled checkboxes in Display and a labelled group ofaria-pressedchips in the sidebar; Counts is a disclosure (aria-expanded/aria-controls); the Draw, Count and Measure groups are labelled; History, Comments and the thread are disclosures (aria-expanded/aria-controls) with a labelledregion; comment and note fields, tag chips' remove buttons ("Remove tag QC") and tag filters (aria-pressed) are labelled; invalid tags are announced (role="alert",aria-invalid). New text keeps 4.5:1 or more on its background.Known follow-ups
Tests
packages/cbioportal-wsi-viewer,--env=jsdom): 742 tests in 57 suites. Besides geometry, GeoJSON round trips, the point layer and the panel and toolbar, they cover:wsiTissueSession.spec.ts): three Shift+clicks, two arriving while the first computes, all combined; an earlier step still computing after a later step grew the shared tile window (no "raster is gone"); a click at the left of a 5200×2400 hi-DPI canvas selected; nothing shown after Esc while tiles load, and those fetches aborted; a new click aborting the previous click's fetches;wsiTissueTools.spec.tsx); two quick cuts both applied on the saved version, a merge whose original-delete is refused and a split whose PUT conflicts both taken back with no undo entry, a merge whose first original was deleted before the second was refused taken back by restoring it under its id (with its comment), and the same on a service without restores by creating it again, undo of a merge restoring the originals in onebatch-restore, a 422 ontargetsaying the shape can't be saved, and the merge warning for originals with comments (wsiAnnotationShapeEdit.spec.tsx);wsiSlideNotes.spec.tsx); a paged thread with Show more and the cap's message, the delete warning naming other users' comments and saying Undo brings them back, Undo restoring the annotation under its id with its thread intact and redo deleting it again, and on a service without restores the annotation created again with a new id and Undo's "could not be restored" (wsiAnnotationThread.spec.tsx);aria-describedby), in the row and in bulk, R never rejecting, a key on another tab doing nothing; Undo of the queue's reject and accept resetting them and the card going back to the rejected one (wsiAnnotationReview,wsiAnnotationControls); the Edit shapes… menu acting only on a pick;wsiAnnotationListPerf.spec.tsx); a link opening only on its slide, once, telling the host (wsiAnnotationNavigation.spec.tsx);wsiAnnotationHpf.spec.tsx);wsiAnnotationController.spec.ts,wsiAnnotationReview.spec.tsx,WSIViewer.panels.spec.tsx);wsiAnnotationOrigins.spec.tsx,wsiAnnotationController.spec.ts,wsiAnnotationControls.spec.tsx): Show's checkboxes and the sidebar's chips setting one state; the slide, the list, "visible" exports and the review entry agreeing (Review AI disabled, saying why, with AI unreviewed hidden); "N hidden by filters" counting layers, Show and list filters, and Show all clearing them; a link showing a hidden kind again;wsiMetaSidebar.spec.tsx,wsiAnnotationControls.spec.tsx): the order with Annotate off and on, Annotations filling (flex: 1 1 0), Clinical collapsed by default while annotating and remembered on its own key, the usual state back with Annotate off; the list filling its section instead of the 260-pixel box; Counts collapsed by default, remembered, summarizing its points, with the chip clouds behind Group by;wsiAnnotationToolbar.spec.tsx,wsiAnnotationMeasure.spec.tsx,wsiAnnotationHpf.spec.tsx): the Draw, Count and Measure groups in order, the Shape menu without HPF, the HPF button disabled with the reason without a scale; Measure's Keep as annotation (L keeps, M rulers, toggling while on switches, remembered, the button picking the last); the compact toolbar below a 960-pixel viewer ("Drawing as:" and the save status text in tooltips, back to full when wider, a 0 width from a hidden tab ignored, the arrow keys and accessible names kept);wsiAnnotationBulk.spec.tsx,wsiAnnotationBatch.spec.tsx,wsiAnnotationShapeEdit.spec.tsx): its items in order with counts and undo notes, a submenu opened with → and closed with ← back to its item, Relabel… opening the field, Delete and Reject asking with "Ctrl+Z undoes" on Accept and Reject, Edit shapes acting only on a pick; one Tab stop in the toolbar, the tolerance's described info icon, the badge'srole="img", the throttled live regions (wsiAnnotationToolbar,wsiAnnotationControls,wsiAnnotationSaveStatus);wsiCompare.spec.ts): similarity fits exactly with rotation and scale, a mirrored section fitted as a reflection but never from noise alone, affine with shear and collinear points refused, inverse and composition, per-pair residuals in µm with RMS and largest (px without a scale), 3 pairs needed and affine-with-3 flagged exact; a rectangle mapped to a turned polygon, a multipolygon's holes and parts kept with area ×s², points/lines/polylines kept, ellipses as polygons, selectors written and read back; pairing order (same block with the counterpart stain first, same part, other parts and samples, unmatched last), the IHC defaulting to its block's H&E, option groups and labels; localStorage either way round, empty removed, unreadable or throwing storage survived; sync by relative position, by µm from an anchor, through an alignment both ways (centre, zoom, rotation), a mirrored alignment, the short way round;wsiCompareController.spec.tsx, stand-in OpenSeadragon viewers): one active pane; locked panning in both directions without echo, unlocked independence, relocking from the active pane; an opening pane following, not leading; the anchor; 3 pairs fitted then mapping centre, zoom and rotation, kept in localStorage; move, delete, clear and reset; a quick click placing a point while a drag does not; copying a holed AI region through the alignment as one batch create with the transfer provenance (derived_from_ai), the badge, Mark verified (PUT), undo and redo; no copy without an alignment; the panel's residuals and copy choices; two controllers listening: Ctrl+Z and H act on the active pane only, tool keys off in the inactive one;wsiAnnotationReview.spec.tsx,WSIViewer.behavior.spec.tsx): with the review queue open and the viewer hidden, R, A, S, Ctrl+Z and H do nothing;hiddenreaches the annotation controller;wsiTissueCore.spec.ts): Lab distance with half-weight lightness and H&E/DAB/background separations; flood fill of the clicked region only, transparent pixels never filled; tolerance growth; contour of a square through edge midpoints (99.5 px² for 10×10); the box blur at radius 0, 1 and 2 with transparent pixels left out; small holes filled and large kept; regions touching at a corner traced as two parts; Douglas–Peucker on closed rings; the smart brush stopping at an edge, not jumping a gap, and painting two parts across a stripe;wsiTissueOsdHost.spec.ts): the canvas read at devicePixelRatio 2 and placed in image pixels; no screen pixels when rotated, tainted or still loading after the wait (and read once the view's tiles are drawn); the levels from the tile source and tiles fetched as blobs with the viewer's URLs and the session cookie;wsiTissueSelect.spec.ts, on a synthetic slide served as tiles and as a canvas): the source switching at 10× (objective power, mpp, neither); the 10× level picked; tile stitching with edge and failed tiles and growth without refetching; the cap and its edges; the same click outlined from the canvas (devicePixelRatio 2) and from tiles within 3% of each other and of the true area; fallback to tiles when the canvas cannot be read; the tile window growing across tiles and keeping the lumen and disks as holes; the notes at the size limit and at the view edge; the latest tolerance winning; Shift adds, Alt cuts, a click taken back; hole, simplification, seed-window and blur settings in µm; the smart brush at both sources stopping at the tissue edge;wsiTissueTools.spec.tsx): W, click, Enter saving a<polygon>with the drawing-as layer and color, undo deleting it; Shift+click saved as a two-part region, Ctrl+Z taking back a click; Alt+click with a drag down to a lower tolerance cutting a hole; drag and wheel changing the tolerance (the wheel left alone when nothing waits), a range input not counted as typing, Esc discarding; Alt as the first click cutting the outline out of a selected region (one PUT, "Undo cut"); Shift+B and a stroke along an edge saved within the tissue; a stroke that painted nothing; the Outline menu entries, the tolerance slider and options group, the tolerance chip, the source and time, and the shortcut help;wsiAnnotationShapeOps.spec.ts,wsiAnnotationShapeEdit.spec.tsx,wsiAnnotationBody.spec.ts): the<polygon>/evenodd-path storage and parsing (relative, H/V, open paths as polylines, curves refused); area outer minus holes and perimeter over all rings (per-axis mpp); points inside and hit-testing with holes; Polygon-with-holes and MultiPolygon GeoJSON round trips and a bad part skipped by name; union, difference (hole, notch, nothing left), intersection, split by straight and bent lines keeping holes, separate parts; in the controller: cut by the menu and by Alt, as one undo/redo step, Esc stopping it; an AI region cut keeping its source withedited: true("AI, edited · unreviewed") and undo putting the stored provenance back; another user's region cut into a new annotation; a cut that misses or covers everything; merge deleting the user's originals with undo/redo re-creating them; another user's shared region kept with the message; the user's own AI region kept, the resultderived_from_ai("AI, edited", not in the review queue); split (largest piece in place, undo), a line that does not cross; subtract, intersect, separate; the selection bar's menu and hint; points inside hidden at 0 unless counting; the even-odd fill of the downloaded view. The in-memory test service refuses machine-made creates and source changes, as the service does;wsiAnnotationMeasure.spec.tsx): length and angle per axis; M, drag, the reading while dragging and after; nothing sent, off the history and out of exports; a click keeps it, the next replaces it, Esc clears it then goes to Select; it follows a zoom and goes with the slide; drawn in the downloaded view with H;wsiAnnotationHpf.spec.tsx): a field placed by click with the chosen area (0.237 mm² by default, unequal scales), "HPF n" numbering also for fields placed before the previous save returns, the area control (presets with their diameters, custom, out of range refused, remembered), the tool off without an mpp; the HPF explanation on the menu item (tooltip and description), the area picker (description and focusable info icon) and the table (both rate columns explained); points inside rectangles and polygons by label with the density, in the row, tooltip and GeoJSON; per-10-HPF and per-mm² rates;wsiAnnotationSaveStatus.spec.tsx): "Saving… 3" for queued then sent points, "Saved", an edit counting one, "2 not saved" with Retry sending them again, the live region always present;wsiAnnotationListPerf.spec.tsx): 5,000 annotations render as a window of under 30 rows within a 3 s budget, follow scrolling, keep checkboxes, move with ↑/↓/Home/End keeping the focused row, and scroll to the focused annotation; a 5,000-point freehand stroke is captured in place with each point placed on screen once (under 6 conversions per move) and placed again once when the slide moves;wsiAnnotationOrigins.spec.tsx): the history rules (review credited by time); Show toggles filtering what Annotorious draws and the list, counts, Manual when the user is unknown, a link lifting the filter; the History disclosure and tooltip line;wsiAnnotationThread.spec.tsx): read, add (Ctrl+Enter), edit, delete own with the count and focus, others' without controls, the note untouched, refusals, a deleted annotation, a service without threads and a route that turns out missing;wsiSlideNotes.spec.tsx): tag rules; loading only when shown; the tag summary and filter; add with tags and sharing, edit, delete with version and focus; a 409 reloading; a service without the route;wsiAnnotationBatch.spec.tsx): a single reject undone with one reset and a bulk accept with onebatch-reviewreset, redo reviewing both again; the bulk reject confirmation and undo note; a reset refused with 403 because another user reviewed since, explained and editing kept on; the older service refusingreset(422 ondecision): the notice, reviews dropped from the history, "Can't be undone" and "Reviews can't be undone." from then on, and Undo going on to the earlier edit; a bulk delete undone with onebatch-restore(same ids, comment count kept) and redone with onebatch-delete; a layer delete undone in onebatch-restore, comments kept, and redone;wsiAnnotationBatch.spec.tsx): relabel in batches of 100 as one undo step, delete and review in one batch, a 409 reported and the rest saved after a reload, 403/404 items named and the rest saved, the per-annotation fallback; the older-service path stays inwsiAnnotationBulk.spec.tsx;wsiAnnotationPointUndo.spec.tsx): three drops over two saves undone in one batch-delete and redone in onebatch-restoreunder their ids, created again with new ids on a service without restores, new steps after a pause, a tool change or another change, the fallback without batch-delete;wsiAnnotationSnapshot.spec.ts): shapes, points and labels drawn at the screen place times the pixel ratio, outlines only, hidden layers, solo and H left out, the background filled before the slide, taken from the nearest opaque ancestor, and used by the download with annotations off;wsiAppConfig,wsiClinicalRows,wsiPatientClinicalData,WsiPatientViewRoute,PatientWsiSlidesTab,PatientViewUrlWrapper,FilesAndLinks,ResourcePolicy,assertWsiOsdBundle): 71 tests in 9 suites pass. They check that both hosts pass the link's slide key and dropannotationIdfrom the address (keeping the hash), and thatcheckWsiBundlefails a build with the tissue tools in an initial bundle or polygon-clipping outside thewsi-shapeopschunk.wsi-shapeops29 KB (9 KB),wsi-tissue74 KB (24 KB); the initial bundles do not change.wsi-compare-mocked.spec.ts, 3 new tests,PW_SUITE=wsionly): five mocked slides (H&E, the same block's IHC TTF-1 rendered as the H&E's tissue turned 90°, an H&E recut, another block's Ki-67, another part's H&E) with PNG tiles. (1) Compare opens the IHC next to the H&E; the right picker's groups are Same block [IHC, recut] / Same part [Ki-67] / sample · Part 2; the left picker leads with the H&E; labelled regions; one toolbar, following the focus; H hides the active pane's annotations only, F6 switches and the other pane's H is its own; another slide from the picker; close (7.4 s). (2) Locked views: a drag on the right pane moves the left (its#wsi:x grows by over 500 px) (9.7 s). (3) Three point pairs on the disks of both slides give an RMS under 8 µm and "Aligned: 3 points"; the user's rectangle copied by layer is one batch create on the IHC with the transfer provenance, its corners turned with the tissue within 25 px; the right pane becomes active and lists it as "Transferred · unverified"; Mark verified (PUT withverified_by), "Undo transfer of 1 annotation" deletes it, the source is untouched (10.1 s). Passed--repeat-each=4with 2 workers (12/12, 7.4–10.5 s each); about 30 s with 2 workers, only in the WSI suite. The annotation service mock and PNG encoder moved towsi-annotation-mocks.ts(the mock now lists rows byslide_id).wsi-annotation-tools-mocked.spec.tshas 28 tests. On a synthetic 4096-pixel slide whose mocked tiles are rendered PNGs (5 levels): the magic wand zoomed out (10× tiles fetched), a tolerance drag (15 → 25) and a scroll (→ 24) without zooming, Shift+click adding a second disk, Enter saving one two-part region, undo; then the tissue outlined, an Alt+click dragged down to 4 cutting a lighter disk out as a hole, a double-click saving it, undo (5.2 s); the same click outlined from 10× tiles and from on-screen pixels at 18×, the saved areas within 3% of each other (9.4 s); the smart brush along a disk's edge saving a region that stops at the edge (5.6 s); and a layout check at 1920 px wide that records the boxes of the tool buttons, Drawing as, Undo, Display and ⋯, switches through every tool (rectangle, ellipse, circle, HPF, line, measure, polygon, freehand, brush, smart brush, wand, point), drops two points until "Saved" shows, and finds no box moved (7.1 s). These four passed--repeat-each=4with 2 workers. The HPF test also checks the per-mm² column. Among the earlier tests, shape editing: a hole cut with "Cut a hole…" and a rectangle (one versioned PUT, the list's area equals the outer ring less the hole, Shift+click in the hole selects nothing, undo; 4.3 s); two of the user's regions merged (one batch create + one batch-delete, a 200×120 union) and undone (4.2 s); a merge with another user's shared region keeping it with the message (3.7 s); a split along a line (PUT + batch create, both pieces labelled and selected, undo; 3.9 s); a holed and a two-part region exported asPolygonwith an inner ring andMultiPolygon(3.5 s). Also: a ruler that sends nothing (3.7 s); an HPF field with a custom area and the points inside it with the per-10-HPF rate (3.7 s); "Saving… 1" while a write is held, then "Saved" (3.4 s); a comment added with Ctrl+Enter and edited (3.5 s); a slide note with two tags, private (3.2 s); a bulk accept in onebatch-review(3.5 s); three point drops undone in onebatch-deleteand redone (4.3 s); a bulk relabel in onebatch-update. The mocked service answers the batch, comment and slide-note routes, can hold writes, and refuses machine-made creates as the service does. With 2 workers the three WSI files (28 + 9 + 3 tests) pass in about 2.4 min; the shape-editing tests passed--repeat-each=3with 2 workers. No fixed waits. They run only withPW_SUITE=wsi, so they add no time to the default CI shards.wsi-annotation-tools-mocked.spec.ts): the toolbar layout test runs at 1920- and 1600-pixel windows with both sidebars open (the 1600 one a 944-pixel viewer) and with the window narrowed until the viewer itself is 904 and 880 pixels, with a long layer name, checking full or compact mode, one row inside the viewer and no shift through every tool and Measure's Keep toggle (about 8.5 s each); Show's AI unreviewed chip hiding rows, the hint and Show all, Review AI disabled meanwhile (3.6 s); Enter accepting in the review card (7.6 s); Measure with Keep as annotation saving a line (4.2 s); Actions › Relabel… with the undo note (4.1 s); Actions › Accept 2 (3.4 s); the HPF field from the Count group and its table under Counts (3.6 s); C for points and the point table under Counts (4.2 s); a split turning Measure on with Keep (3.8 s). The new test adds about 8 s to the WSI suite. No fixed waits.wsi-annotation-tools-mocked.spec.ts, now 31 tests: 2 added, 2 changed; the mocked service keeps deleted rows and comments, restores them and resets reviews): rejecting an AI annotation (the confirmation saying Undo can take it back), then Undo returning it to AI · unreviewed with Accept offered, through onereset(3.3 s); deleting an annotation with another user's comment (the softened warning), then Undo restoring it under the same id withPOST …/restoreand its comment still in the thread (3.5 s). The two changed tests now expect the new reject confirmation and "Accept 2Ctrl+Z undoes". They add about 7 s to the WSI suite. No fixed waits.PW_SUITE=wsi, and CircleCI does not run them (enabling them upstream is a separate PR). They mock every backend route, so a production build is enough:pnpm run buildAll, servedist/with anindex.htmlfallback for SPA routes such as/wsi/patient/…, then inend-to-end-test-playwright/:PW_SUITE=wsi LOCALDEV=0 CBIOPORTAL_URL=http://127.0.0.1:<port> npx playwright test tests/wsi-annotation-tools-mocked.spec.ts tests/wsi-compare-mocked.spec.ts tests/wsi-foundation-mocked.spec.ts --workers=3. All 45 pass (about 2.8 min with 3 workers), compare and the four toolbar widths included;wsi-annotation-tools-mocked.spec.tspassed--repeat-each=5with 3 workers (165/165, 5.7 min). The zoomed-mid-gesture test waits for the viewer'sdata-wsi-animating="false"(OpenSeadragon'sanimation-finish) rather than for two equal samples.tsc --noEmit -p .,buildMain+checkWsiBundleand Prettier 1.19 on the changed files are clean.🤖 Generated with Claude Code