Source: ~/code/Exact (Django 4.2, DRF 3.15, PostgreSQL, Python ≈16k LOC in app code, 129 migrations, 43 documented paths in EXACT-API.yml).
Decisions so far:
- In-process Python server plugins are dropped (
plugins/ExactServerPlugin.py,pluginFinder.py,proc_EIPH.py, and the navigator-overlay/plugin-statistics hooks that use them). - Decisions from review (2026-10-27): browser runtime speed matters, but a clean architecture wins over absolute maximum speed; all slide formats EXACT supports today are in scope;
/api/v1byte-compatibility is not required (a v2 API is fine) but interface compatibility with theexact-syncPython module is mandatory (§2a); passkeys, registration and impersonation are in use and must be ported;zarrandh5pyare unused and dropped; image registration is heavily used (kept, §6a); the navigator overlay is rebuilt onPluginResultBitmap; forced re-login at cutover is OK; React + TypeScript + Vite is the frontend stack; QueueRunner moves to the v2 atomic-claim API in this project; registration runs as a Python worker; first milestone is a beta deployment checked against a backup of the production system (§5a), no staffed schedule yet; compatibility with any other API consumers is kept where cheap; target is single binary + PostgreSQL (no Redis, no Celery). - The
processingapp stays. It is the interface for external ML plugins (workers that poll jobs and push results over the REST API). It is ported as part of the public contract (see §6).
| App | Role | Size (views/models/api LOC) | Port? |
|---|---|---|---|
images |
Image, ImageSet, SetTag, SetVersion, ScreeningMode, ImageRegistration, FrameDescription, AuxiliaryFile; upload, tile serving, crop, move, search, statistics | views 2575, models 888, api_views 888 | Yes – core |
annotations |
Annotation, AnnotationType, AnnotationVersion, Verification, AnnotationMediaFile, SegmentationTile, Export/ExportFormat, LogImageAction | views 1526, models 782, api_views 557 | Yes – core |
users |
User (AbstractUser), Team, TeamMembership, UserPreferences, PersonalAccessToken (scoped), passkeys | views 426, models 148 | Yes – core |
administration |
Products, annotation-type admin, user admin API (impersonate, reset pw, toggle staff…), slide cache stats | views 987 | Yes (trimmed) |
datasets |
Dataset export/management views | views 909 | Phase 6 |
tables |
TableDataset/TableVersion/TableViewSettings (spreadsheet-like data, CSV/XLSX import/export) | views 423, models 208 | Phase 6 |
tools, tagger_messages |
Tool + ToolVote, Message (small) | ~150–240 | Phase 6 (low priority) |
base |
active-user tracking middleware, home, flex-fields | small | Yes |
processing |
Plugin, PluginJob, PluginResult, PluginResultEntry/Bitmap/Annotation (7 models); REST for external ML workers + small UI (job list/detail/stop/restart/cleanup/submit) | api 143, ser 144, models 168, views 149 | Yes – REST contract in Phase 3/5, UI in Phase 7 (see §6) |
~33 models total, all of which are ported.
- Versioned REST (DRF routers,
/api/v1/…): users, teams, team_membership, images, image_sets, set_tags, set_versions, screening_modes, registration, annotations, annotation_versions, annotation_types, annotation_media_files, verifications, log_image_actions, products, and the 6processing/*routes (plugins, pluginjobs, pluginresults, pluginresultentrys, pluginresultannotations, pluginresultbitmaps) used by ML workers. This is the public contract used byEXACT-Sync/exact-client, SlideRunner, and scripts. Features:LimitOffsetPagination(50),django-filterquery params,drf-flex-fields(?expand=/?fields=), OpenAPI at/api/v1/openapi. - Legacy "explore" routers (
*_explore) used by the UI tables (same viewsets, different mount). - Ad-hoc JSON endpoints (
/annotations/api/annotation/{create,update,delete,load,loadset,verify,copy,…},/images/api/image/{crop,metadata,move,opened,closed,…},/images/api/imageset/{create,tag,product…},/tables/api/…,/administration/…/api/…). These are called by the project's own JS only; they are not a stable contract and can be redesigned once the frontend is touched. - Tile endpoints: DeepZoom descriptor +
tile_files/<level>/<col>_<row>.{png,jpeg}, navigator overlay tiles, segmentation tiles (/annotations/api/segmentation/<id>/tiles/…), crops. - Auth: Session (Django), Basic, personal access tokens with scopes (
users/scope.py,tokens.py), JWT (simplejwt/djoser, largely commented out), RemoteUser backend, passkeys (WebAuthn), django-registration (email activation), password reset.
| Python dep / feature | Use | Rust approach | Risk |
|---|---|---|---|
| Django ORM + PostgreSQL only ("relies on Postgres features") | all data | sqlx (Postgres), reuse existing schema |
Low; need to grep exact PG-specific features (JSON/Array/FTS) in Phase 1 |
openslide / DeepZoomGenerator |
WSI read + tiling (patched zDeepZoomGenerator w/ frame + plane) |
openslide C lib via FFI (openslide-sys/own thin binding) + own DeepZoom math (small, well specified) |
Medium |
tifffile, ome-types, tiffzstack.py (425 LOC) |
OME-TIFF, z-stacks | tiff crate + own OME-XML parse (quick-xml) |
High |
slideio (util/slideio.py) |
CZI, other formats | No Rust equivalent → FFI to slideio C++ or out-of-process converter | High |
| pydicom | DICOM WSI | dicom-rs, or openslide ≥4.0 DICOM |
Medium |
| pyvips | conversion | libvips binding or drop |
Low–Med |
opencv (video_handler.py, cellvizio.py MKT) |
MP4/AVI/MKT video frames | opencv crate (heavy) or ffmpeg subprocess; MKT is custom → port by hand (321 LOC) |
Medium |
nibabel (nifti.py, MPR planes) |
NIfTI 3D | nifti crate |
Medium |
iSyntax (ISyntaxContainer.py, 547 LOC, separate Docker image with Philips SDK) |
Philips iSyntax | Keep as sidecar service (don't port) | n/a |
| zarr, h5py | unused (confirmed) | Dropped | None |
| pandas, xlsx | tables import/export |
csv, calamine (read xlsx), rust_xlsxwriter |
Low |
| Redis (django-redis, session cache backend) | sessions + tile cache | Removed: sessions in Postgres, tile/slide caches in-process (moka) + on-disk |
Low |
| Pillow | PNG/JPEG encode, palette PNG for segmentation | image, png, mozjpeg/zune-jpeg |
Low |
qt-wsi-registration |
WSI registration (ImageRegistration model; exact-sync calls register_images, convert_coodinates, create_inverse_registration) |
Keep data model + endpoints; check what the registration lib needs (verify in Phase 1) | Verify |
| Django templates + static JS (annotation tool ~8.8 MB static, OpenSeadragon, jQuery, jCanvas, Bootstrap) | the UI | see §4 | Largest unknown |
django.contrib.admin |
admin UI | replace with small admin pages or drop | Low |
| gunicorn + nginx | serving | single binary with built-in static files, TLS optional behind any reverse proxy | Low |
Image formats listed in slide_server.py FileType classes (all in scope for v1, per decision): BigTIFF, TIFF, Hamamatsu (NDPI), Olympus VSI, JPEG, PNG, Philips iSyntax, MIRAX, DICOM, Zeiss CZI, MKT (Cellvizio), MP4, AVI, NIfTI-1/2/GZ.
1.4 Behaviour hidden in Python (must be ported explicitly, with tests)
AnnotationType.validate_vector+ vector-type conversion rules (can_convert) and size-unit→pixel conversion (unit_to_pixel_factor) – pure logic, easy to port; existing teststest_size_unit.py,test_frames.pygive a head start.Annotation.similar_annotations/equal_annotation(duplicate detection),verify,AnnotationQuerySet.annotate_verification_difference.- Signals:
annotation_type_changed_handler,users/signals.py;AnnotationVersionbookkeeping. - Permission logic spread over views (team membership,
is_staff, imagesetpublic/collaborators/team) andadministration/permissions.py, token scopes. - Image move (
images/move.py), crop with source link, backfill command, management commands inannotations/,base/,images/,tagger_messages/,users/. - Active-user tracking middleware; image opened/closed tracking.
- Statistics endpoints (team + image).
- ImageSet "version" snapshots; screening mode.
annotations/{tests,test_frames,test_size_unit}.py, base/test_api_queries.py, images/test_{move_image,crop_source,backfill_crop_source}.py, users/test_token_scope{,_api}.py, plus EXACT-API.yml and the test.ipynb notebooks. Coverage is thin → we build a black-box HTTP conformance suite (§3).
- Strangler, not big bang. Rust server runs against the existing Postgres schema (no schema change until cutover); Django can be reverted to at any time. nginx routes path-by-path to Rust or Django.
- Contract first, but v2 is allowed. A new
/api/v2is designed cleanly (see §2a);/api/v1and the legacy endpoints thatexact-syncuses are served by a thin compat layer untilexact-syncis migrated, not as the primary design. - Postgres only. No SQLite support (Django version doesn't have it either). Single binary + DB: no Redis/Celery; sessions, job queue and (optionally) cache locks live in Postgres; slide/tile caches are in-process plus on disk.
- Out-of-process for the awkward formats (iSyntax, possibly CZI/slideio): a small tile/convert sidecar behind a stable internal HTTP interface, so Rust core stays pure and the long tail doesn't block cutover.
- In-process Python plugins removed; the external-plugin API (
processing) is kept and treated as a first-class public contract (§6).
Mandatory: the Python interface of exact-sync (ExactManager and the generated v1/api/* client classes in ~/code/EXACT-Sync) keeps working for users' scripts. The HTTP wire format underneath may change.
What exact-sync actually calls today (Phase 0 finding) is the compat surface:
| Group | Endpoints |
|---|---|
| Auth | HTTP Basic; Authorization: Bearer <personal access token>; GET /timesync/ on connect |
/api/v1 CRUD |
users/users, users/teams, users/team_membership, images/{images, image_sets, set_tags, screening_modes, registration}, annotations/{annotations, annotation_types, annotation_media_files, verifications, log_image_actions}, administration/products, processing/{plugins, pluginjobs, pluginresults, pluginresultentrys, pluginresultannotations, pluginresultbitmaps} |
/api/v1 custom actions |
annotations/multiple_delete/, image_sets/list_server/, images/index_image/, images/{id}/{thumbnail, get_patch, slide_information, update_image_cache, register_images}/, registration/{id}/{convert_coodinates, create_inverse_registration}/ |
| Legacy ad-hoc JSON | annotations/api/annotation/{create,update,load,loadannotationtypes}/, annotations/api/annotation/mediafile/upload/<id>/<type>/, images/api/{list_imagesets/, imageset/create/, imageset/load, imageset/product/add/, image/download/<id>/?original_image=}, images/image/upload/<imageset>/, administration/api/{products/create/, products/filter/, annotation_type/create/, annotation_type/delete/}, users/api/team/filter/, processing/api/plugin_job/create/ |
Strategy:
- Design
/api/v2as the real API: consistent resource names, JSON bodies everywhere, typed errors, cursor pagination, OpenAPI generated from the Rust types (utoipa). The new UI and newexact-syncuse only v2. - Compat layer (
/api/v1/*plus the legacy paths above) as thin adapters over the same service layer. Only the ~45 paths in the table are carried over; other legacy UI-only endpoints are not. - Migrate
exact-syncin a separate release, keeping its Python interface: add a v2 transport, auto-detect the server version on connect (/timesync/or a new/api/version), fall back to v1. Deprecate the compat layer later. - Acceptance: the
exact-synctest suite and the notebooks (SyncImageAndAnnotations.ipynb,ClusterAndSync.ipynb) run in CI against the Rust server. EveryExactManagermethod and generated client method must work; the JSON need not be byte-equal.
- Conformance suite (language-neutral, e.g. Python
pytest+httpx, kept intests/conformance/): fixtures load a seeded Postgres dump; every route in the compat surface (§2a) is exercised throughexact-syncitself and via raw HTTP; responses are recorded as golden JSON (volatile fields normalized) against Django and compared semantically (field-by-field, not byte-wise) with the Rust compat layer. v2 gets its own contract tests from the OpenAPI spec. This is the source of truth for "done". - Image golden tests: for a sample of each supported format, compare Rust DeepZoom tiles to openslide/Python output (SSIM threshold; byte-equality is not expected for JPEG).
- Rust unit/property tests for vector validation, unit conversion, similarity.
- Load test (k6/oha) on tile endpoint and annotation load of large sets (this is where Rust should win; set budget from Django baseline).
Phase 0 finding: the UI is a large server-rendered Django-template + jQuery/jCanvas/OpenSeadragon app (~9 MB static for the annotation tool, templates in every app). A line-by-line template port would carry the old rendering performance over, so the plan is a new SPA on v2, served from the binary.
Architecture (separates the fast part from the maintainable part):
viewer-core(framework-agnostic TypeScript package, the only place where speed is engineered): tile scheduler/cache, WebGL (fallback Canvas2D) tile + annotation rendering, R-tree spatial index with viewport culling, hit-testing and geometry in Web Workers, annotation tools as a state machine. No UI-framework imports; unit-testable headless; later reusable (e.g. embeddable viewer).- App shell (routing, forms, tables, admin, auth screens) in a UI framework; it only talks to
viewer-corethrough a small typed interface. - API client generated from the v2 OpenAPI spec (
openapi-typescript), so the Rust types are the single source of truth. - Assets embedded in the binary (
rust-embed, precompressed, hashed). Fast transport: immutable tile URLs + ETags, HTTP/2, optional WebP, compact/streamed annotation loads, server-side tile warm-up onimage_opened.
Framework recommendation: React + TypeScript + Vite (TanStack Query for server state, TanStack Table/Router, Radix/shadcn-style components, Vitest + Playwright).
- Why: for a team of 2–8 people that changes over time, hiring/onboarding, library coverage (tables, forms, a11y, i18n) and AI/tooling support matter more than framework microbenchmarks. The performance-critical code is in
viewer-coreand doesn't use React at all, so React's overhead is irrelevant to pan/zoom. - Alternative: Svelte 5 (smaller bundles, less boilerplate, smaller talent pool/ecosystem). Reasonable if the team already knows it; the architecture above makes the choice reversible for the shell.
- Not recommended: Rust/WASM UI (Leptos/Dioxus): slower iteration, larger bundles, smaller ecosystem, and no benefit for DOM-heavy admin screens. WASM can be used inside
viewer-corefor hot geometry if profiling justifies it.
Transition: until the new UI reaches parity, Django keeps serving the old UI (nginx path routing); there is no template port. API clients (exact-sync, ML workers) can move to Rust earlier. Cutover to the single binary happens when the new viewer + pages (Phase 7) reach parity.
Team shape (2–8 people): (1) backend core/API/auth, (2) slide pipeline/formats, (3) viewer-core, (4) app shell/admin pages, (5) QA/conformance + devops; a team of 2 does these sequentially in the order of §5, 4+ can run Phases 4, 5 and 7 in parallel after the Phase 1–3 foundations are in place.
Estimates are for one experienced developer; with two people (one backend, one frontend) the calendar time is roughly 60%. New SPA frontend (§4) assumed.
Phase 1 – Foundation & conformance harness (2–3 wks)
- Cargo workspace:
exact-core(domain types, vector logic),exact-db(sqlx, queries),exact-api(axum routes, OpenAPI viautoipa),exact-wsi(slide readers, DeepZoom),exact-server(binary),exact-cli(management commands). - Dump the Django schema (
manage.py sqlmigrate/pg_dump -s) → commit as baseline;sqlxmodels checked against it in CI. - Config via the existing
SQL_*/UPLOAD_*env vars where they still apply (CACHE_*and Redis go away). - Seed DB + conformance harness (§3) incl. running
exact-syncagainst Django to record goldens; Docker compose with Django, Rust and nginx. - Exit: CI green,
/health, DB connectivity, harness records Django goldens.
Phase 2 – Auth & users (2–3 wks)
- Django password-hash verification (PBKDF2, argon2, bcrypt) so existing accounts keep working; new sessions in Postgres (existing Django sessions need not be honoured: users log in again at cutover); CSRF for browser flows.
- Personal access tokens with scopes, Basic auth, RemoteUser header.
- Users, Teams, TeamMembership, UserPreferences endpoints; permission model as one
authzmodule with exhaustive tests. - In use, so required for cutover: registration + email activation + password reset (
lettre, activation-token format compatible or users re-request), passkeys (webauthn-rs; must read existingdjango-passkeyscredential table so enrolled keys keep working, keep the same RP ID/origin), impersonation (admin-only, audited, with a visible banner and a way to end it).
Phase 3 – Read-only core API (3 wks)
- ImageSet, Image, SetTag, SetVersion, ScreeningMode, Annotation, AnnotationType, AnnotationVersion, Verification, Product, LogImageAction and the
processingGET endpoints (plugins, jobs, results, entries, annotations, bitmaps) in v2, plus the v1/legacy compat adapters for the same resources (§2a): pagination,django-filter-compatible filters andexpand/fieldsonly whereexact-syncuses them. - Exit:
exact-syncread paths pass against Rust; nginx routes API GETs to Rust.
Phase 4 – Slide pipeline (4–6 wks, highest risk)
- All formats supported today are in scope (BigTIFF/TIFF, NDPI, VSI, JPEG/PNG, iSyntax, MRXS, DICOM, CZI, MKT, MP4/AVI, NIfTI incl. gz, OME-TIFF z-stacks). Order: openslide formats (SVS/NDPI/MRXS/TIFF/…) → plain JPEG/PNG → DeepZoom with frame/plane → OME-TIFF + z-stack → DICOM → NIfTI → video/MKT → CZI/slideio → iSyntax.
- Because "single binary" conflicts with C/C++ deps, decide per format: statically link (openslide, libvips) where it is feasible; for CZI (slideio), iSyntax (Philips SDK, proprietary) and MKT use a helper executable shipped next to the binary (spawned over a pipe/unix socket, restartable), not a separate service. Core server stays one process + helper(s).
- Slide handle cache (replaces
SlideCache), tile cache (mokain memory + on-disk spill), segmentation tiles, navigator overlay generated fromPluginResultBitmap(see §6), crop endpoint, thumbnails, metadata. - Upload pipeline (chunked;
jQuery-File-Uploadprotocol must be matched, or the JS adjusted), file-type sniffing (portgetSlideHandler), conversion jobs, aux files. - Exit: golden tiles match for every format; tile p95 latency and throughput measurably better than the Django baseline (set targets from a measured baseline in Phase 1).
Phase 5 – Write API & annotation logic (4 wks)
- Create/update/delete/copy/verify annotations, versions, media files, annotation-type admin, image move/delete, image set create/tag/product, screening.
processingwrites (job create/update/stop/restart/cleanup, result/entry/bitmap/annotation POST/PATCH/DELETE) incl.DjangoModelPermissions-compatible authz and the fake-worker test; bitmap storage/serving.- Transaction boundaries, optimistic concurrency, similarity detection, signals replacement (explicit domain events), LogImageAction.
- Exit: full conformance suite green incl. writes; Django and Rust can run in parallel against one DB.
Phase 6 – Secondary features (3–4 wks)
- Image registration (heavily used, see §6a): storage, coordinate conversion, inverse registration, the
register_imagesjob lifecycle, and the compute worker. - Export formats (Export/ExportFormat; check what exports exist, e.g. COCO/VOC/CSV), statistics endpoints, datasets, tables (CSV/XLSX), tools/votes, tagger messages, active-user tracking, administration APIs (impersonation, user toggles, cache stats), management commands →
exact-cli. - Migrate EXACT-QueueRunner to the v2 atomic-claim API (keeping the legacy flow working for unmigrated workers).
- Background jobs: Postgres-backed queue (
sqlx+SKIP LOCKED) with tokio workers inside the same binary;LISTEN/NOTIFYfor wake-ups; no Redis/Celery.
Phase 7 – New UI (8–12 wks; starts in parallel with Phase 3 once v2 read endpoints exist)
- Viewer first (tile rendering, annotation layer, tools, verification, screening mode), then image-set explorer, upload, annotation-type/product/team admin, processing job pages, tables/datasets, statistics, user pages (login, registration, passkeys, preferences, impersonation).
- Embedded in the binary; i18n via JSON catalogues (existing locales to be checked,
LocaleMiddlewareis active). - Exit: feature-parity checklist signed off; Lighthouse/interaction budgets met (to be defined, e.g. first tile < 300 ms on a local network, 60 fps pan with 50k annotations).
Phase 8 – Hardening & cutover (2–3 wks)
- Shadow traffic/mirroring, load tests, security review (authz, SSRF in
gdown/URL import, path traversal on uploads, token scope enforcement), docs (mkdocs),UPGRADE.md, Docker images (multi-stage; openslide + vips runtime deps), rollback runbook. - Cutover: Redis and Django removed, nginx optional. Rust takes over schema migrations (
sqlx migrate) from the baseline; drop unused tables/columns (zarr/h5py-related if any) in a first migration, after a backup. - Release a matching
exact-syncversion.
Total: ≈ 8–10 months single-developer (backend/API only ≈ 5–6, which is also the point where exact-sync and ML workers can move to Rust); with one backend + one frontend developer ≈ 5–6 months. Biggest variance: Phase 4 (formats) and Phase 7 (viewer).
Goal: run the Rust server on a restored copy of the current production system and prove it behaves like Django on real data, before any cutover. No production traffic is touched.
Inputs needed from you: (1) a pg_dump of the production DB, (2) the matching media/image files (DB rows reference slide files, aux files, annotation media files, segmentation data, registration files, plugin icons and result bitmaps on disk; a DB-only backup is not enough to test tiles), or a representative subset with a consistent DB subset, (3) the production settings/env (Django SECRET_KEY only if we want to test session or signed-token compatibility, otherwise not needed), (4) the Django/EXACT version of the dump.
Safety and privacy: the backup contains real users, password hashes, emails, PATs, and possibly patient-related image data. Restore only into an isolated environment (own Postgres instance, no outbound email, no external network); disable email sending (lettre to a file/log sink); consider scrubbing tokens, emails and session tables (script in the repo); never commit dumps or paths to them (.gitignore).
Steps:
- Restore & baseline (week 1): restore dump + files; boot Django on it (same version as production) as the reference; record goldens (conformance suite,
exact-sync, mock worker) and performance baselines (tile latency, annotation load of the largest image set). - Schema/data audit: compare the real schema with
makemigrations-state: unapplied/extra migrations, indexes, nullability drift, orphaned rows, odd values (invalid vectors, huge JSON, NaN, unknown file types). Output a data-quality report; each finding is a decision: fix in Rust, tolerate, or clean in DB. - Rust on the restored DB, read-only first: point the Rust server at the same DB (separate DB user with
SELECTonly, then a writable clone). Run the conformance suite and theexact-sync/mock-worker tests, then compare Rust and Django results over all image sets/annotations (bulk diff job: counts, ids, per-annotation fields, per-user visibility under each team/role). - Authz equivalence test: for a sample of real users (all roles, team admins, staff, worker accounts) compare the set of visible/editable objects in Django vs Rust. This is the highest-value check for security regressions.
- Format sweep: run every slide in the restored files through the Rust reader; report which fail to open, differ in dimensions/levels/MPP, or produce visibly different tiles vs Django (golden SSIM). This gives the real list of format gaps.
- Login/credential compatibility: real password hashes verify; real PATs and scopes work; passkey credentials load; account activation/reset flows work with the sink mailer.
- Writable beta: on a clone, run write paths (create/update/verify annotations, uploads, jobs, registration) via
exact-syncand the new UI; then run Django'smanage.py check/read paths against the Rust-modified DB to prove the schema stays Django-compatible (this keeps rollback possible). - Beta users (optional, later): a small group uses the beta instance on the cloned data (clearly marked as non-production, data discarded), feedback via the parity checklist.
Exit criteria for beta → cutover planning:
- 100% of restored slides open or have a documented gap; golden tile checks pass.
- Authz equivalence: zero unexplained differences.
- Bulk diff of annotations/image sets: zero unexplained differences.
exact-syncsuite + mock worker green against the clone; QueueRunner smoke test OK.- Performance targets from the Django baseline met.
- A rehearsed restore → cutover → rollback runbook on the backup.
What the beta needs from the project (scope cut): Phases 1–5 plus the minimum of 6 needed by those tests (auth/users, read+write API, slide pipeline, processing, registration) and a first viewer slice (open slide, view/create/verify annotations). The rest of the new UI (admin pages, tables/datasets, statistics) can follow after beta feedback.
Before the server beta, everything runs against the local EXACT instance:
- DB: Postgres 16.3 (Postgres.app,
127.0.0.1:5432, databaseexact, roleexact; theexactrole cannot create databases, use the local superuser for scratch DBs). Content: 71 images, 50 annotations, 5 image sets, 2 users, 154 applied migrations, 190 permissions, 15 MB. Note: a Dockerfreeleaf-postgrescontainer also maps port 5432; Postgres.app is the one that answers on localhost today, so always check the target DB name before running tests. - Backup:
backups/exact-local-20261027-111310.dump(custom format,pg_dump -Fc) plus…schema.sql, checksum inbackups/SHA256SUMS. Verified by restoring into a scratch DB (row counts for images, annotations, users, image sets, migrations, permissions matched) and dropping it.backups/is mode 700 and in.gitignore(contains password hashes). - Files:
~/code/Exact/exact/images(47 GB;exact_<team>_<set>folders, mostly one 44 GB set). Rust tests must treat it as read-only (never point write paths at it); writable tests use a copy or a small subset with a consistent DB subset.image.name+imageset.pathform the file path. - Rule: the Rust server and tests never connect to the live local
exactDB with a writable role; they use a restored copy (exact_rust_test, recreated from the dump by script).
Delivered (make targets in Makefile):
- Cargo workspace (
crates/):exact-core(config from the DjangoSQL_*env names, errors),exact-db(sqlx pool + schema introspection/diff),exact-wsi(DeepZoom pyramid geometry),exact-api(axum:/health,/api/version,/timesync/in Django's{"unixtime": …}shape),exact-server,exact-cli(schema-dump,schema-check).cargo fmt,clippy -D warningsandcargo testare clean (9 unit tests); GitHub Actions workflow in.github/workflows/ci.yml. - Schema baseline from the real dump:
baseline/schema-local-20261027.json(56 tables);exact-cli schema-checkpasses against the restored DB, and Django reports no pending migrations or model drift (154 applied). - Restore tooling:
scripts/restore-backup.sh(recreatesexact_rust_test, refuses to touchexact),reference/seed-users.sh(known test accounts, scratch DB only:aubrevillesuperuser,brummelstaff,rt_teamadmin,rt_member,rt_outsider; passwordrust-test-pw). - Reference Django (unmodified EXACT 4.2.30 code from
~/code/Exact) on :8001 viareference/run-django.shwith its own settings module, so logs/uploads/caches go toreference/instance/and the live image folder is only read (symlinks). - Conformance harness (
tests/conformance): 46 endpoint calls × 5 roles = 230 goldens recorded from Django (record_goldens.py; passes 230/230 against Django, i.e. normalization is stable) plus 9exact-syncinterface tests (generated client,ExactManager, QueueRunner-stylelimit=100000000, legacy image download). Rust currently fails them as expected (225/230 goldens, red baseline, because Phase 2+ is not built yet). - Format sweep + tile latency baseline (
tests/perf, reportreports/django-baseline.json): 69/71 images serve a full-resolution tile; median 47 ms, p95 1.6 s (slowest: CZI 3.6 s, two NIfTI 4–5 s, VSI and some NIfTI 0.5–1 s).
Findings that change the plan:
- The local data is a good format corpus: 71 images covering tiff (22), png (8), nii.gz (13), vsi (5), mrxs (3), ndpi (3), czi (3), tif/OME (2), dcm (4), mkt (2), mp4 (2), avi (1), jpg (3). Not covered locally: iSyntax, SVS, and other formats the server backup may contain, so the production-backup sweep is still needed.
- Tile requests need a session login (they return a 302 to login for Basic auth); only the REST API accepts Basic/token. The Rust tile route must accept session cookies (browser) and should additionally accept Basic/PAT for API clients (decision for v2: yes).
- Two images fail my sweep with HTTP 400 (a NIfTI and a DICOM multi-frame): likely my sweep's tile geometry for 3D/multi-frame images, not necessarily a Django bug; to be checked in Phase 4.
- Registration dependencies don't install here:
qt-wsi-registration/probregwere not installed in the reference env (they need compilation and are not needed for the baselines). Registration golden tests (§6a) need them; deferred to Phase 4/6. - Dev machine toolchain quirk: pip builds against the Command Line Tools SDK fail (
libSystem.tbd"unknown architecture"); building withSDKROOT=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdkworks. Rust builds and links normally.brew install openslide vipswas run for the reference environment (libopenslide 4.0.0). - The local DB is tiny (50 annotations; largest image has 13), so it is not a load benchmark for annotation loading; the production backup is needed for that.
PLAN.mdopen point: the legacytimesyncresponse shape is{"unixtime": …}(done).
Not done in Phase 1 (moved): performance baseline for annotation loading (needs production-size data, see 6), ML mock worker (Phase 3/5, needs the processing endpoints), /api/v2 skeleton and OpenAPI generation (start of Phase 3).
Delivered
exact-authcrate: verifies every Django hash format (pbkdf2_sha256, pbkdf2_sha1, argon2, bcrypt_sha256, bcrypt) against vectors generated by Django itself; PAT token format/hash (identical tousers.tokens); random session/CSRF tokens;make_passwordin Django's default format for future resets.- Authentication (
exact-api::auth) in the exact order and with the exact error messages of the Django deployment: Bearer PAT → Basic → session cookie. Failures are 403 (DRF coerces 401, because the first authenticator has no challenge), including: expired/revoked tokens, read-only tokens on unsafe methods, malformed headers, inactive users. Timing is equalized for unknown usernames. - Authorization:
DjangoModelPermissionssemantics read from Django'sauth_permission/users_user_user_permissions/group tables (superuser = all, inactive = none). Token team restriction reproduces Django'sScopedTeamSet(see findings). /api/v1/users/{users,teams,team_membership}/list + retrieve with DRFLimitOffsetPagination(default 50, huge limits allowed, sorted-query next/previous links), django-filter filters (id,username[__contains], booleans with Django's widget semantics,team,members,memberships,image_sets,is_admin,user), drf-flex-fieldsexpand/fields/omit, DRF-shaped 400/403/404 bodies,Allowheaders, naive Europe/Berlin datetimes. Writes pass the permission check and then answer 501 (implemented in Phase 5)./api/v2/auth/{login,logout,me,stop-impersonating}and/api/v2/admin/users/{id}/impersonate: server-side sessions in our own additive tableexact_rust_session(created byexact-cli migrate --confirm-db <name>; Django tables untouched), HttpOnly + SameSite=Lax cookie, CSRF double-submit header for unsafe session requests (Basic/Bearer exempt). Impersonation reproduces Django's rules (site-admin flag fromUserPreferences, not yourself, no nesting, only superusers may impersonate superusers) and is audit-logged.- Tests: 8 + 6 + 2 + 2 + 3 Rust unit tests; Django-vs-Rust conformance now 99/294 green (all 30 users goldens across 5 roles + 64 auth/paging/filter/flex/permission cases + timesync; the other 195 belong to Phases 3–5); 13 + 5 v2 session/CSRF/impersonation tests; Django self-check 294/294 (the harness is stable).
Findings (behaviour that exists only in Django's code, not in any API doc)
User.team_setis monkey-patched at startup (users/apps.py: ScopedTeamSet): for team-restricted tokens everyuser.team_setis narrowed to the token's teams, which silently scopes the whole API, includingusers/*. Ported viaViewer.token_teams. Every later resource must use the viewer scope, not raw memberships.- Django runs with
USE_TZ = False,TIME_ZONE = 'Europe/Berlin': all API datetimes are naive local time (e.g.2026-10-27T11:00:00.500000), and naive input is read as Berlin time. Ported for output; input handling comes with the write APIs. - Related-id lists (
team_set,members,image_sets, …) have no defined order in Django; Rust returns them sorted by id and the harness compares them as sets. - Authentication failures are 403, not 401, with
{"detail": ...}; the harness records status, body andAllow. - Django bug, not replicated: a Basic header with an empty password returns HTTP 500. Rust answers 403 like any wrong password.
- Deliberate hardening vs. Django: tokens of deactivated users are refused (Django still accepts them). Please confirm this is acceptable for existing worker accounts (it is only relevant if a service account is deactivated but its token is still used).
- Impersonation and user administration are gated by
UserPreferences.is_site_admin, notis_staff/is_superuser. exact-syncauth: Basic andBearer pat_…; nothing else needed.- Mistake caught: a CSRF comparison bug (operator precedence) was found by the first v2 test run and fixed before anything depended on it; a stray
exact_rust_sessiontable was created once in the live localexactdatabase by amigratecall withoutSQL_DATABASE(empty, additive, dropped immediately).exact-cli migratenow requires--confirm-db <name>matching the configured database, andmake migrate/make restorepin the scratch DB.
Phase 2 completed (second round, 2026-10-27), after your answers
- Decisions: token hardening for deactivated users confirmed; no
REMOTE_USER/SSO; the production server has no mail server and self-registration is abolished: users are invited. - Invite-only onboarding (no e-mail):
POST /api/v2/invitations(site admin: any teams or none; team admin: only teams they administer) returns a one-time link/invite/<token>that the admin hands over; the token is stored only as sha256 and shown once.GET /api/v2/invitations/token/{token}(public) tells the accept page which teams the person joins;POST …/acceptcreates the user in one transaction (username + password policy equal to Django's validators incl. its common-password list, preferences row, team memberships, not an admin), logs them in and burns the link. Links expire (default 7 days = Django'sACCOUNT_ACTIVATION_DAYS, max 30), can be listed and revoked. There is no registration endpoint at all (tested). Django's/accounts/register/disappears at cutover. - Forgotten passwords without mail: site admins create a one-time reset link (
POST /api/v2/admin/users/{id}/reset-link, default 1 day, audit-logged); accepting it sets the password under the same policy and ends all existing sessions of that user. Only superusers can reset superusers. - Passkeys (WebAuthn) in Rust:
exact-auth::webauthnreads thedjango-passkeystable and stored credential format (websafe(AttestedCredentialData)), verifies assertions (rpIdHash, origin by python-fido2's rule incl. public-suffix check, challenge, user presence, ES256/RS256 signature) and registrations (writes byte-identical tokens). Endpoints:POST /api/v2/auth/passkey/{begin,finish}(usernameless/discoverable or by username; uniform failure message; one-time challenges inexact_rust_challenge),POST …/passkeys/register/{begin,finish}(session + CSRF),GET/PATCH/DELETE …/passkeys. The test passkey was enrolled through the real django-passkeys endpoints with a software authenticator (reference/enroll_passkey.py,tests/conformance/softkey.py), proven to log in to Django, saved astests/fixtures/passkey.jsonand re-seeded on every restore; Rust accepts it (a Django-enrolled key works in Rust) and 14 further passkey tests cover tampering, replay, disabled keys and ownership. - Verification:
make verify(scriptscripts/verify.sh) restores the scratch DB, starts both servers, runs unit tests + lint, then read-only suites, then the mutating suites. Current result: unit tests 28/28; Django self-check 294/294; Rust vs Django goldens 99/294 (the rest are Phase 3+);exact-sync1/9 (rest Phase 3); v2 auth/passkey/invitation suites 39/39.
More findings
10. django-passkeys sends displayName: [] and a double-encoded user handle (websafe(urlsafe_b64encode(username))); Rust copies the handle encoding for compatibility. Django ignores userHandle and signature counters and does not require user verification; Rust matches that (documented parity, not a recommendation: we should consider requiring UV and counters after cutover).
11. The dev setting FIDO_SERVER_ID="127.0.0.1" cannot work in browsers (IP addresses are not valid RP IDs and need https), so the production RP ID is unknown to me: it must be taken from the production settings.py and set as FIDO_SERVER_ID for Rust, otherwise every enrolled passkey fails. Safari beta test: the Rust beta must be served over https on a host that matches that RP ID (or a subdomain of it).
12. Supported credential algorithms are ES256 and RS256 (what Safari/Touch ID, Chrome, Windows Hello and most security keys use). Django would also have accepted EdDSA and the ECDSA P-384/521 variants; the production-backup audit must parse every stored passkey token and report any other algorithm.
13. Test hygiene lesson: tests that create users change what the recorded Django goldens should say, so suites are ordered (restore → read-only → mutating) in scripts/verify.sh.
Not done / deliberately postponed
- Login rate limiting and lockout (Django has none; invitation/reset/login endpoints are unthrottled). Do before exposing the beta beyond your network.
- Admin user-management endpoints (
administration/users/api/*: list, toggle staff/active, update, delete, team add/remove/toggle-admin, random password): UI-only, Phase 6/7 with the new UI. - The accept/invite pages themselves belong to the new UI (Phase 7); until then links can be used through the API.
- Serving: https only (WebAuthn and
Securecookies need it); setEXACT_COOKIE_SECURE=1,FIDO_SERVER_NAME=EXACT, andFIDO_SERVER_IDper the rule below. TLS termination by any reverse proxy (Caddy/nginx) in front ofexact-server; the single binary listens onEXACT_LISTEN. - Passkey relying-party rule (browser-enforced, cannot be worked around): a passkey is bound to its RP ID and works only on that host or its subdomains. Production is
exact.hs-flensburg.de, so its RP ID can only beexact.hs-flensburg.deorhs-flensburg.de.exact-beta.deepmicroscopy.orgis in a different domain, so production-enrolled passkeys can never work on it, whatever the setting is. Consequences:- On the beta host (
FIDO_SERVER_ID=exact-beta.deepmicroscopy.org) everyone re-enrolls a passkey. That tests enrollment, login, Safari/iCloud Keychain and the whole flow, but not the production keys. - Compatibility with production-enrolled keys is tested separately by the software-key tests (done, §5d) and finally at cutover on
exact.hs-flensburg.dewithFIDO_SERVER_IDset to production's exact value. To test it earlier with real production keys, a second beta hostname underhs-flensburg.dewould be needed (works if production's RP ID ishs-flensburg.de, not if it isexact.hs-flensburg.de). - Resolved: production
FIDO_SERVER_ID=exact.hs-flensburg.de(a second beta host underhs-flensburg.decould therefore only test production keys if it is exactly that host). Cutover must keep the production host name and RP ID unchanged (sameexact.hs-flensburg.de, sameFIDO_SERVER_ID); otherwise all existing passkeys are lost and users must re-enroll (password login keeps working).
- On the beta host (
- Beta data and safety: the beta runs on the restored copy of the production backup (never the live database), outbound mail is not configured anyway, invitations/reset links are the only way in, and the beta must not be indexed or open to the public: restrict it (VPN, IP allow-list or basic-auth at the proxy) until login rate limiting exists (§5d).
- Mixed-content/URL note: invite links are returned as paths (
/invite/<token>); the new UI (or the admin) prefixes the beta host.
Delivered
- Resource engine (
exact-api::compat::{engine,specs,computed}): every/api/v1resource is one declarativeSpec(table, visibility SQL, serializer fields in Django's order, relations, filters); a single implementation provides scoped querysets, django-filter semantics (query parameter names and validation messages taken from Django's own FilterSets viareference/dump-filters.sh:exact,contains,in,range,lte/gte,ModelChoice/ModelMultipleChoiceincl. existence checks,Choice, naive-Berlin datetimes, both boolean widgets),LimitOffsetPagination, related-id lists, and drf-flex-fieldsexpand/fields/omit. The users/teams/memberships code of Phase 2 now runs on the same engine (hand-written handlers deleted). - 22 resources, list + retrieve: users, teams, team_membership, images, image_sets, set_tags, set_versions, screening_modes, registration (incl.
rotation_angle,inv_matrix,get_scale,get_inv_scalewith pseudo-inverse math), annotations (incl.concealed/blurred/verified_by_user), annotation_versions (has_changes), annotation_types, annotation_media_files, verifications, log_image_actions, administration/products, and the sixprocessing/*resources used by ML workers. - Legacy JSON endpoints used by
exact-sync:images/api/list_imagesets/,images/api/imageset/load[/](allfilter_annotation_type_idmodes incl. Verified/Unverified/NoAnnotations/ComputerGenerated, collaboration types,ImageSet.has_perm('read')incl. public sets),annotations/api/annotation/load/(all parameters),annotations/api/annotation/loadannotationtypes/,users/api/team/filter/. - Authentication cache: successful Basic-auth password checks are remembered in memory for 5 minutes (
AUTH_CACHE_SECONDS), keyed by a per-process-secret digest of (user, password) and bound to the stored hash, so a password change invalidates immediately (tested through the reset-link flow). This matters because Django's 600 000 PBKDF2 rounds cost ~100 ms on every API request ofexact-syncand the ML workers. - Seed data for resources that are empty locally (plugins, jobs, results, entries, bitmaps, result annotations, set versions, annotation versions, media files) so comparisons are not vacuous; recorded and replayed with all three roles and token scopes.
Results (make verify)
- Rust unit tests 39/39 (workspace), clippy clean; v2 auth/passkey/invitation suites 39/39.
- Django vs Rust: 1701 recorded cases (every resource × every filter ×
expand/fields/omit/pagination × roles superuser, member, outsider, team-restricted token, read-only token, legacy params and permission edge cases): 1686 pass; the 15 failures are allslide_information(Phase 4). The same 1701 cases pass 1701/1701 against Django itself (the harness is stable). exact-syncinterface tests: 7/9; the 2 failures need slide reading and file download (Phase 4).- Performance, release build, same machine, Basic auth on every request (Django 4.2 + gunicorn-less
runserver --noreloadvs Rust): 14–50× faster, e.g. images list 150 ms → 7 ms, annotations expand 194 → 8 ms, 3 834 log rows 230 → 17 ms, users 105 → 2 ms. (Django's own cost is dominated by the password hash; once an API client uses a session or token the gap shrinks, butexact-syncand the ML workers use Basic.)
Findings (Django behaviour to know about; all reproduced for compatibility unless noted)
- Processing data is visible to every authenticated user: plugins, jobs, results, bitmaps, results' annotations have no team scoping, so any user (e.g. an outsider) can list other teams' ML jobs and results. ML worker accounts probably rely on it. Kept in
/api/v1; recommendation for v2: scope by team, with an explicit "worker" permission for the queue runner. loadannotationtypeswithoutimageset_idreturns the active annotation types of all teams;users/api/team/filter/andlist_imagesetsuse plain team membership (ignoring token team restrictions), and the legacy endpoints let non-members read public image sets. Kept.- Django returns HTTP 500 (not reproduced; no clients can depend on it) for:
annotations?deleted=<bool>,images?expand=annotations, an empty Basic password;administration/api/products/filter/(used byexact-sync.filter_products) is broken in Django itself (request.QUERY_PARAMSno longer exists), so it is not ported;exact-sync.filter_productsalready fails against the current server. - Many list endpoints have no ORDER BY in Django (images, log actions, versions …): physical order, so pagination windows are not stable. Rust orders by id. The harness compares object lists as sets.
- Django's
vector_x_min/vector_y_minannotation filters have a bug (thegteis never applied, onlyvector IS NOT NULL) andvector_y_maxfilters ony1; reproduced exactly. SetVersionViewSetjoins through image sets withoutDISTINCT, so a version shared between two of the user's image sets is listed twice in Django; Rust lists it once (hardening).- Harness lessons: seed data must be deterministic (random UUIDs in the seed made Django disagree with its own recordings), Django's
Allowheader lists methods in per-process random order, and several Django lists are unordered, so the harness compares headers and object lists as sets. - Environment: with Postgres.app, the first connection of a new binary takes several seconds (its
auth_permission_dialogextension);DB_CONNECT_TIMEOUT(default 10 s) is now configurable;verify.shuses 60 s.
Not done (moved)
- Slide-dependent endpoints → Phase 4:
images/{id}/slide_information,thumbnail,get_patch, tiles/DZI,images/api/image/download,update_image_cache. - Writes → Phase 5 (all POST/PUT/PATCH/DELETE answer 501 after the permission check) incl. the custom write actions (
multiple_delete,register_images,create_inverse_registration,index_image, uploads). - Small read actions:
annotations/count/,image_sets/list_server/,registration/{id}/convert_coodinates/(pure geometry, goes with registration in Phase 5/6). /api/v2resource endpoints and the OpenAPI spec: not started. They need design decisions (below) rather than porting, so they are a separate step "3b".
Decisions needed for v2 (3b): (a) team-scope the processing resources in v2 (finding 1); (b) cursor pagination and a stable default order; (c) one URL scheme without trailing slashes and real REST verbs; (d) datetimes in RFC 3339 UTC instead of naive Berlin time; (e) JSON field names: keep Django's (objectivePower, FrameDescriptions) or normalize to snake_case. My recommendation: yes to (a), (b), (c), (d); (e) normalize in v2 only (v1 stays as is).
Decisions (user, 2026-10-27): (1) processing data is team-scoped in v2 (v1 keeps the Django behaviour; an explicit worker permission for the queue runner arrives with the processing write API); (2) cursor pagination with stable id order; (3) no trailing slashes, real REST verbs; (4) RFC 3339 UTC timestamps; (5) snake_case field names in v2 only.
Implemented: GET /api/v2/{resource} (items, next_cursor, optional count=true, limit 1..1000) and /api/v2/{resource}/{id} for all 22 resources, on the same engine as v1 (Ctx.v2, list_v2, effective_scope). Filters, expand, fields, omit work with v1 semantics but snake_case names. tests/conformance/test_v2_resources.py (9 tests) is part of make verify.
Open: writes (Phase 5), OpenAPI document (generate from the resource table + utoipa for hand-written endpoints), ordering parameter beyond id.
Done: exact-wsi with a Slide trait; OpenSlide loaded at runtime (dlopen, OPENSLIDE_LIB; formats without it are disabled, the server still starts) covering SVS/NDPI/MRXS/Ventana/Leica/DICOM/generic pyramidal TIFF; plain JPEG/PNG/TIFF (image crate); NIfTI-1/2 (+gz) with RAS reorientation and windowing; DeepZoom generator port (tile 254, overlap 1, limit_bounds=False as EXACT's openslide-python default); slide cache (20 handles), tile cache (512 MB, weighted). Endpoints (v1 under /api/v1/images/images/{id}/…, v2 as /api/v2/images/{id}/{slide-information,thumbnail,get-patch,download} and /{z}/{frame}/tile[_files/…]): slide_information, thumbnail (on-disk _thumbnail.png cache as in Django), get_patch (max 2048, Django error text), DZI, tiles, update_image_cache, image download (MRXS/VSI zipped with their companion directories). tests/perf/compare_slides.py compares both servers per image (slide information exact, DZI attributes, full-res tile by mean abs diff ≤ 4.5, low tiles by size, thumbnail).
Result: 15/15 slide_information conformance cases pass (5 are skipped on purpose, see finding 1); compare_slides: PNG/JPEG/TIFF/NIfTI/NDPI/MRXS/generic TIFF/OME-TIFF (2 of 3) match.
Findings:
- Django serves
slide_information(and thumbnails) from its cache before the team check: a user outside the team gets 200 if anyone asked earlier. Rust always checks (404). Harness skips these (cache_leak). - In the reference environment (libopenslide 4.0 + openslide-python 1.4.7) Django reads blank regions from lower pyramid levels of some TIFFs; Rust (same libopenslide through the C API) reads them correctly. Therefore low-resolution tiles are compared by size only; tile pixels are checked at full resolution. Several plain TIFF/JPG ids (78, 98, 99, 102) also differ against Django but match a PIL crop of the file: Django output there looks cache-contaminated; Rust is right.
- The DB
width/heightof some images (e.g. id 41) is stale; slide geometry always comes from the file.
slideio formats (CZI, VSI, DICOM) done via a helper process (decided 2026-10-27): helpers/slideio_helper.py speaks a line-JSON + raw-RGBA protocol over stdin/stdout; exact-wsi/src/slideio.rs runs a pool (2 workers, SLIDEIO_WORKERS), restarts a crashed helper and retries once. Config: SLIDEIO_PYTHON (interpreter with the slideio wheel; wheels exist for macOS/arm64 and Linux/x86_64), SLIDEIO_HELPER (script path, default searched next to the binary). Building slideio's C++ from source needs a custom Conan index and OpenCV (hours), so the helper is Python for now; because the protocol is language-neutral it can later be replaced by a C++ helper without touching Rust. compare_slides: all 7 CZI, VSI and 4 DICOM test images match Django. DICOM volumetric (CT/MR) beyond slideio is still open: a native reader (dicom-rs) is an option for the volume case.
Native DICOM and MKT done (2026-10-27): exact-wsi/src/dicom.rs reads uncompressed multi-frame DICOM (8/16 bit, grayscale or RGB, rescale slope/intercept, window from the file or from volume percentiles, frames as time series or z-stack for CT/MR/PT/NM) without Python; compressed transfer syntaxes and whole-slide DICOM fall back to slideio. exact-wsi/src/mkt.rs is a port of cellvizio.py (type-5 index chunk, int16 frames, circular-mask percentile window, [height, width] level dimension quirk kept). Both Cellvizio .dcm (4) and .mkt (3) test images match Django in compare_slides; unit tests cover a synthetic 16-bit CT volume. Not yet covered by real data: compressed DICOM (JPEG/J2K/RLE) natively, multi-file DICOM series, DICOM with palette or YBR.
Video (MP4/AVI) done natively with ffmpeg-next (2026-10-27, cargo feature video, on by default; --no-default-features builds without it): exact-wsi/src/video.rs decodes in process through the system libav* libraries (ffmpeg >= 5, dev packages needed at build time: libavcodec-dev etc. + libclang; runtime needs the shared libs). The Rust opencv crate was rejected: it binds the full C++ OpenCV, which needs a system OpenCV and is much heavier than libav. Seeks land on the preceding keyframe and decode forward; sequential playback reuses the decoder; 32-frame LRU. Frame index from pts uses the stream's nominal rate (r_frame_rate) - the average rate drifts and shifted frames by one (found against ffmpeg-extracted frames). MPEG-4 part 2 (mp4) and MJPEG (avi) test files verified: frame content matches ffmpeg exactly at frames 0..158, tiles match Django within JPEG noise. MKT non-square frames: Rust now reports (width, height) correctly; Django swapped them (KNOWN_DIVERGENT in compare_slides, id 109).
OME-TIFF native (2026-10-27): exact-wsi/src/tiff.rs (TIFF/BigTIFF IFD + SubIFD parser; tiled and striped 8-bit pages; raw, LZW, Deflate, JPEG incl. shared JPEGTables; horizontal predictor) and ome.rs (OME-XML via quick-xml: series = z planes, label/thumbnail series skipped, SubIFD pyramid levels, integer downsamples as Django, frame descriptors z=<pos> <unit>, default frame at z=0). All 5 OME test files work; z-stack frames verified frame-exact against Django (images 57/58/108, tile diff 2-5 from JPEG re-encoding only; the nearest Django frame is always the same frame index). Image 6 (83200x53504, JPEG tiles, 13 planes x 5 levels) is black in the reference Django because its environment lacks imagecodecs; Rust decodes it and a tile matches an independent PIL decode (mean abs diff 0.13). Production Django presumably has imagecodecs - re-check against the production image before cut-over. Not supported natively (falls back to OpenSlide/plain readers): 16-bit or multi-channel OME planes, planar configuration 2, JPEG2000/PackBits compression, OME images with Z/T/C > 1.
Not done yet (compare_slides returns 400 in Rust): iSyntax, multi-page non-OME TIFF as z-stack frames (ImageSlide3D), MPR planes for NIfTI, navigator overlay, upload pipeline, UI tile routes /images/image/{id}/…. Decision needed for the helper-process approach (slideio for VSI/CZI/DICOM; ffmpeg or opencv for video; MKT by hand).
Target UI (user, 2026-10-27): only the current "Lightroom v2" frontend (user pref frontend = 3: index_v2, imageset_v2, annotate_v3); the older templates are not reproduced. Visual language: dark glass, purple accent #aa0fea.
Done - frontend/ (React 18 + TypeScript + Vite, TanStack Query, react-router, OpenSeadragon; served by the Rust binary from frontend/dist with SPA fallback, EXACT_STATIC_DIR; rust-embed still to do):
- Login (session + CSRF via
/api/v2/auth/*), image set index (team sidebar, search, thumbnails), image set page (grid, filter), viewer (OpenSeadragon on the v2 DeepZoom routes, read-only annotation overlay on a Canvas2D layer with viewport culling, annotation type legend with toggles, frame slider, MPR plane switch for volumes). src/viewer-core/is framework-free (shapes, annotation layer, tile source) with Vitest unit tests; pages only talk to it through a small API.- New server endpoints for the viewer:
/api/v2/images/{id}/metadata(size, levels, frames, planes with frame counts and descriptors), viewer tile routes for old-UI paths/images/image/{id}/{z}/{frame}/tile[_files/...]and/api/v2/images/{id}/{z}/{frame}/...(single-file volumes:z= plane 1/2/3 as in Django). frontend/e2e/smoke.mjs(playwright-core on the system Chrome): login, set list, image grid, viewer on a pyramid TIFF, a NIfTI volume (3 planes + slider), an OME z-stack (frame change), a video (frame change); screenshots withSHOTS=dir.make ui,make e2e.- Passkey login screen not yet in the UI (API exists).
Not yet in the UI (old Lightroom v2 features still to build): annotation tools and editing (needs the Phase 5 write API), image set page actions (move/copy/upload/delete, tags, versions, export, plugin jobs), project/team admin screens, user preferences, registration/invite screens, processing UI, annotations/count.
Findings from the UI work
- libopenslide 4.0 reads generic pyramidal TIFFs nondeterministically at lower levels (the same region gives different pixels on each read, even from separate handles and the Python bindings). Rust now reads generic TIFF pyramids with its own reader (
generic_tiff.rs, LZW/Deflate/JPEG, RGBA, resolution tags); parallel vs sequential tile requests give identical bytes. Vendor formats (SVS, NDPI, MRXS, ...) still use libopenslide: re-check them against the user's SVS and an NDPI before beta, and pin the libopenslide version in deployment docs. - Thumbnails: Django cached some thumbnails rendered from those corrupt levels as
*_thumbnail.pngnext to the images (e.g. image 20, 19) and serves them forever. The Rust server no longer reads or writes thumbnails in the image folders; it ownsEXACT_CACHE_DIR/thumbnails/<id>-<mtime>-<size>.png(default./cache). A one-off cleanup of the old files in production is optional. - OpenSeadragon forces
position: relativeon its element; the container must get its height from normal flow (found by an e2e failure: zero-height viewer). - Dev builds:
[profile.dev.package."*"] opt-level = 2- image decoding in unoptimized builds was too slow to use. - Big-endian TIFF (
MM\0*/MM\0+, e.g.test.ome.tifffrom Bio-Formats) was not recognised as TIFF, so it fell through to libopenslide with a single level: every low zoom and every thumbnail decoded the full 17557x8649 image (thumbnail 49 s, viewer never finished). Fixed informats::is_tiff_magic; thumbnail now 22 ms. Django reports a single level for this file too (compare_slides lists id 2 as known divergent). - Broken TIFF pyramids: images 19, 48 and 95 (and probably more files from the same export script) have pyramid pages 1..n that are mid-grey noise (mean ~121) instead of downscaled copies of page 0; viewers show the grey levels first and thumbnails/overviews come out wrong.
generic_tiff.rscompares the centre window of each level with level 0 (mean colour, tolerance 20) and drops a level and all smaller ones when they disagree; DeepZoom then derives the zoom levels from the remaining pages. The clean ones (41-56, 70, 92) keep their pyramids. A warning is logged per file. The offending files should be re-exported at some point. - Zoom-level registration (wobble): the DeepZoom tile was an integer-cropped region resized (aspect-preserving, like openslide-python) to the tile size; tiles of a level were therefore scaled slightly differently (up to ~0.9 px shift between neighbouring levels when the level height is not a multiple of the downsample, visible as wobbling while levels cross-fade). Tiles are now sampled from a floating-point source rectangle with the true level scale (
level size / slide level size) viafast_image_resize(Lanczos3, fractional crop box) and are always exactly the tile size./tmp-style measurement: shift vs a reference reduction of the PNG was -0.86 px at one level, now <= 0.02 px at every level (images 103 and 119). Django has the same rounding artefact. Same for slideio-read slides (VSI, found on image 31): slideio's levels are exact 2^k decimation grids (every level is bit-registered with level 0 reduced by exactly 2^k when read at aligned positions) but report1/scale= 16.0007 because their stored sizes are rounded down. Two effects: (a) reads at positions that are not multiples of the downsample are displaced by up to ~1 level pixel (measured 0.0 px aligned, 0.8-1.4 px otherwise) -SlideIonow reports the exact integer downsample, so every read is aligned, and requests the region with exactly that size; (b) a level coverslevel-0 width / downsamplepixels of extent, not its stored width - the generator derives the DeepZoom scale from that (zw / (w0 / down)), which removed a systematic 0.2-0.5 px drift between coarse zoom levels. Measured on image 31 (3 regions, 7 level pairs): average level-to-level displacement 0.238 px -> 0.042 px, coarse pairs exactly 0.00.level_downsamplesof VSI/CZI slides inslide_informationare now 16.0 instead of 16.0007 (compare_slides tolerance 0.1%). Zeiss CZI (found on image 28) has levels that are not registered with each other even when read natively at aligned positions: consecutive levels are displaced by 0.2-0.8 px of the coarser level, in a regular alternating pattern, at every position (so it is a property of how the pyramid was produced).exact-wsi/src/registration.rsmeasures this once per slide: up to three textured spots (4x4 cells of the smallest level ranked by contrast), each level against the previous one reduced by the integer ratio (integer-shift SSD search + parabolic refinement, +-3 px), chained to level 0; a level is corrected only when the two closest spots agree within 0.15 px, offsets below 0.04 px are treated as noise. The generator adds the offset when it samples a tile (DeepZoom::tile, viaSlide::level_offsets). Estimated lazily on the first tile request of a slideio slide (1.6-5 s once) and stored in<cache>/registration/<hash(path,size,mtime)>-v2.json, so restarts read it (0.2-0.6 s for the DZI incl. opening). Result: average level-to-level displacement over 3-7 level pairs per image, 0.04-0.10 px for images 15, 16, 17, 28, 31 (before: 0.2-0.7 px for the CZIs); VSI files measure zero offsets and are untouched. Unit tests build a pyramid with a known displacement (including a chained one) and check the estimate to within 0.15 px. Registration offsets are stored in the database (user request, 2026-10-27): tableimages_pyramidregistration(image_id unique,offsetsjsonb[[dx,dy],...],algorithm,file_size,file_mtime,updated), shared with EXACT/Django - EXACT's migrationimages/0041_pyramidregistration(PR DeepMicroscopy/Exact#166) andcrates/exact-db/migrations/0005_pyramid_registration.sqluse identical DDL withCREATE TABLE IF NOT EXISTS, so either side can create it first.scripts/check-schema-sync.sh(make schema-sync, also amake verifystep) builds two databases from the backup (Django first / Rust first), compares the columns and checks Django's migration record and the schema baseline (baseline/schema-local-20261027.jsonregenerated with the table;schema-checkignores Rust-ownedexact_rust_*tables).get_dzinslides.rsreads the row, uses it only if size, mtime andregistration::ALGORITHMmatch, otherwise measures once (per-file lock) and upserts; first open 1.6-5 s, afterwards 0.2-0.6 s even after a restart. Level 0 is never shifted: offset 0 is forced inregistration::estimate_level_offsets,DeepZoom::buildandDeepZoom::tile(unit test: bit-identical level-0 tiles with an absurd level-0 offset; same test in EXACT's PR). Measured on the real Django server with EXACT PR #166: CZI/VSI neighbouring-level displacement 0.26-0.36 px -> 0.04-0.10 px. - verify.sh is sensitive to logins during the run (
last_loginfilter goldens): do not use the verify servers (8001/8002) while it runs. It prints failing test names now. - MPR planes:
compare_planes.py(Django UI routes vs Rust) matches for 12 of 13 NIfTI volumes; image 85 (SwiftWave_vyljummk.nii.gz) still differs a lot and needs investigation.
Decision (user): offer the repair to the user; same image (id, annotations, file name unchanged), the repaired file takes the original's name and the original is kept as <stem>.orig.<ext>; lower levels use the original page's compression (level 0 chunks are copied as stored, so its pixels are bit-identical). One-time, and it must work for huge files.
Implemented:
- Detection:
Slide::issues()(damaged_pyramidfromgeneric_tiff.rs), exposed asissuesin/api/v2/images/{id}/metadata. - Engine
exact-wsi/src/repair.rs+tiff_write.rs(streaming BigTIFF writer): level 0 raw chunks copied; each tile of a lower level is the 2x2 reduction of four tiles of the level below, read back from the file being written, so memory stays flat for any size; levels until the longer side is <= 512; written to<file>.repair-tmp, verified (opens, all levels, no issue), then renamed; failure leaves the original untouched. - API:
POST /api/v2/images/{id}/repair(202, background job; needs change permission on images; 409 when nothing to repair or already running),GET .../repair(status, progress, backup file name),POST .../repair/restore(undo; the repaired file is kept as<stem>.repaired.<ext>). State in the additive tableexact_rust_image_repair(migration 0004); a restart marks interrupted jobs failed. - UI: viewer banner offers the repair, shows progress (survives leaving the page), reloads when done, shows the backup name with an Undo link.
- CLI:
exact-cli check-images <dir>(read-only scan; 30 TIFFs in the test folder: 6 damaged: 19, 48, 95 and the small 10.tiff/11.tiff) andexact-cli repair-image <file>. - Tests: unit test (synthetic damaged TIFF: detect, repair, level 0 identical, restore),
scripts/e2e-repair.sh(browser flow on a scratch copy), checked with PIL, tifffile and libopenslide that they read the repaired file; the 24.6 MB test file repairs in ~1 s and grows 2%. - Requires write access of the server to the image folders (the Rust server was read-only before; uploads need it anyway).
Open: batch repair from the UI for a whole set, repair of OpenSlide-handled TIFF variants (SVS/NDPI are not touched), 16-bit or planar TIFFs (rejected with a message), JPEG-compressed levels use 4:2:2 subsampling; upload-time check.
Requirement (user): going through z levels should be smooth (blending), closer to a microscope; microscopy z-stacks, radiology volumes and movies are different things with different controls: microscopy z-stack = vertical slider on the right with smooth blending, start/end shown as real positions; radiology volume = vertical slider on the right, discrete slices, no blending; movie / time series (MP4, AVI, Cellvizio MKT/DICOM) = horizontal slider at the bottom.
Done:
exact_wsi::FrameKind(None | ZStack | Volume | TimeSeries) on theSlidetrait, withframe_labels()andz_positions(); OME-TIFF multi-series and slideio CZI/VSI z slices = ZStack (OME: realPositionZ+ unit; slideio:z_resolutionbased, relative to the first plane), NIfTI and DICOM CT/MR/PT/NM = Volume, video/MKT/other DICOM = TimeSeries./api/v2/images/{id}/metadatareturnsframe_kind,frame_labels,z_range {start,end,positions,unit}.- Viewer:
viewer-core/zBlend.ts(ZBlender): every plane is its own OpenSeadragon tiled image with identical geometry; at positionk+fplanekis opaque and planek+1is drawn on top with opacityf(linear cross-fade); planesk-1..k+2are kept loaded (opacity 0.001 so their tiles keep loading), the rest is dropped; no blending for volumes (only the nearest slice visible, neighbours preloaded). Slider drag is continuous (step=any) for z-stacks; Page Up / Page Down step one plane with an eased animation (~160-420 ms); the viewer persists while planes change (no re-open, no flicker).components/FrameControls.tsx:ZSlider(vertical, right; top = last plane; ends = real positions when known, otherwise labels; current position andn / N) andTimeSlider(bottom, first/last/current time label). - e2e: volume (vertical, one slice visible), OME z-stack (real positions at the ends, 5.5 -> opacities 0.5/1, Page Up), movie (bottom slider only).
Open: annotation visibility per plane (annotations are drawn on every plane), wheel/keyboard focus handling inside the viewer (arrow keys still pan), mouse wheel over the slider, playback (play/pause, fps) for movies, a time axis for CZI time series, preload tuning for very large planes.
Kept (public contract for external ML workers):
/api/v1/processing/{plugins,pluginjobs,pluginresults,pluginresultentrys,pluginresultannotations,pluginresultbitmaps}– full CRUD (ModelViewSet), with the existing query filters: jobs (image_id,user_id,filter_ids), plugins (imageset_from_image_id→ plugins linked via image-set products), results (image_id,job_id,plugin_id), annotations (image,annotation_type,pluginresultentry,plugin), bitmaps (image).- Job lifecycle fields workers rely on:
processing_complete,eta_time,error_message/detail,attached_worker,updated_time. - UI + helper endpoints: job index/detail/stop/restart/cleanup,
submit/<plugin>/<image>,submit_imageset,api/plugin_job/create/,administration/api/plugins/product/{add,delete},images/api/image/plugins/. Plugin–Product assignment decides which plugins are offered per image set. - Result bitmaps are consumed by the viewer as overlays (location_rect, scale, alpha, channels, frame) – bitmap file serving must be ported with the image pipeline.
Permissions caveat: these viewsets use DjangoModelPermissions, i.e. Django's auth_permission / group / user-permission tables (add_/change_/delete_/view_ per model). The Rust authz layer must read those tables (or map them) so existing worker accounts keep working unchanged. Also covers ImageField icon upload for Plugin.
Dropped (in-process Python plugins):
plugins/ExactServerPlugin.py,pluginFinder.py,proc_EIPH.py,plugins/templates.- The in-process hooks that used them (plugin statistics elements,
ExactServerPluginnavigator policies).
Rebuilt (decided): the viewer's navigator overlay (navigator_overlay_status, overlay tiles) is generated from PluginResultBitmap records: the server renders overlay tiles from the stored bitmap (location_rect, scale_min/max, channels, default_alpha/threshold, frame), caches them like normal tiles, and reports NEEDS_UPDATE/UP_TO_DATE/ERROR from the job/result state. In v2 this is a normal resource (/images/{id}/overlays/{entry}/tiles/…), not a plugin hook.
What the real worker does (EXACT-QueueRunner, local at ~/code/EXACT-QueueRunner, built on exact-sync): at startup list_plugins and create_plugin for each handler's package; then loops every 5 s: list_plugin_jobs(limit=100000000) (so the server must accept huge limits), filters processing_complete != 100, retrieve_plugin_job, claims a job by PATCHing attached_worker, sleeps a random <1 s, re-reads, and backs off if another worker won (optimistic, racy), runs the model (download_image, retrieve_image, retrieve_annotationtypes), reports progress via partial_update_plugin_job(processing_complete, updated_time), and posts create_plugin_result, create_plugin_result_entry, create_plugin_result_annotation; on cleanup it destroy_plugin_results; on failure it clears attached_worker.
Consequences:
- The compat layer must reproduce these semantics exactly (field names
job.plugin,job.result,attached_worker,updated_time,error_message/detail; PATCH with partial fields; hugelimit). - v2 adds an atomic claim (
POST /api/v2/processing/jobs/{id}/claimusingUPDATE … WHERE attached_worker IS NULL RETURNING, plus heartbeat/lease expiry for dead workers), removing the race. Old workers keep the old PATCH flow; the server makes that flow safe where it can (e.g. compare-and-set whenattached_workeris set from NULL). - Server-side stale-job detection (lease expiry) so crashed workers don't block jobs forever.
Worker compatibility test (mock, as decided): a small mock worker in tests/mock-worker/, written in Python using exact-sync exactly like QueueRunner does (no model, no GPU): registers a plugin, polls, claims, reports progress, creates a result with an entry, annotations and a bitmap, handles failure and cleanup, plus a two-worker race test. It runs in CI against Django (record) and Rust. The real QueueRunner is run manually as a smoke test before cutover.
Phase 0 finding: ImageRegistration stores transformation_matrix (JSON), registration_points, registration_error, runtime, optional file; register_images/convert_coodinates/create_inverse_registration are used by exact-sync. The registration algorithm is the external Python library qt-wsi-registration (quad-tree registration with OpenCV, scikit-learn, probreg, OpenSlide): research code that is not realistic to port first.
Plan:
- Rust owns storage, authz (team scoping), coordinate conversion (
convert_coodinates),rotation_angle/inverse-matrix math andcreate_inverse_registration: pure geometry, ported with tests against Django outputs. - Computing a registration becomes a job in the Postgres queue handled by a registration worker (Python, reusing
qt-wsi-registrationunchanged, same worker pattern as ML workers, run as a helper process/container).register_imagesreturns/polls as today for compat; v2 exposes it as an explicit job resource with progress. This keeps the single server binary Python-free, while registration stays fully functional. - Optional later: native Rust implementation if the Python worker becomes a maintenance burden.
- Test: golden registrations (matrix, error, converted vectors) from Django on a set of image pairs.
| # | Risk | Mitigation |
|---|---|---|
| 1 | Format long tail – all formats are in scope (CZI, MKT, iSyntax, OME z-stacks, video, NIfTI) and conflicts with "single binary" | Helper executables for non-linkable libs; per-format golden tests; feature flags |
| 2 | Logic scattered in 2.5k-LOC images/views.py and 1.5k-LOC annotations/views.py |
Inventory per endpoint during Phase 3/5; conformance tests before porting |
| 3 | Django session/password/CSRF compatibility | Dedicated compatibility tests with real Django-produced hashes/cookies |
| 4 | New viewer is the largest single deliverable; scope creep vs. parity | Parity checklist from the existing UI, viewer built first and demoed early; old UI keeps running until parity |
| 5 | Hidden PG features / raw SQL | grep for raw SQL/JSON/Array fields in Phase 1 (not yet done) |
| 6 | Django model-permission tables needed by DjangoModelPermissions for ML worker accounts |
Read auth_permission/groups directly; compatibility tests with real worker accounts |
| 7 | Passkey/registration/impersonation compat (credential format, RP ID, activation tokens) | Port with tests using real exported data from a staging DB |
| 8 | exact-sync interface drift while v2 is introduced |
CI runs exact-sync + notebooks against Rust; version negotiation in exact-sync |
| 9 | Registration algorithm is Python research code with heavy deps | Keep as worker process; port only geometry; golden tests |
| 10 | Old racy job-claim flow in QueueRunner/exact-sync |
Server-side compare-and-set + leases; v2 atomic claim; two-worker race test |
| 11 | Bus factor / maintenance of FFI (openslide, slideio) | Pin versions, vendored build in Docker |
Decided: runtime browser speed with clean architecture first (new SPA, viewer-core separated from app shell, §4) · all formats in scope · v2 API allowed, exact-sync interface compatibility mandatory, other consumers kept compatible where cheap (§2a) · passkeys/registration/impersonation ported · zarr/h5py dropped · single binary + Postgres · processing API kept, in-process Python plugins dropped · navigator overlay rebuilt on PluginResultBitmap · mock worker modelled on EXACT-QueueRunner for tests · image registration kept, compute as worker (§6a) · forced re-login at cutover is fine.
Still open:
0. Phase 2 follow-up (§5d): the production FIDO_SERVER_ID/FIDO_SERVER_NAME values from the production settings.py (without them no enrolled passkey can work), (production is exact.hs-flensburg.de, so it is either that or hs-flensburg.de; the Safari test host is exact-beta.deepmicroscopy.org, see §5e).
- Backup logistics (§5a): can you provide the dump plus the file store (or a representative subset) and say how large they are? Is a scrubbed copy needed (patient data, user emails)?
- Which environment hosts the beta (your workstation, a lab server)? Needs Postgres, enough disk for the file store, and Docker.
- Production Django/EXACT version of the backup (to match the Django reference).
- You: provide the backup + files + version (§5a, open questions 1–3).
- Phase 1 kickoff: cargo workspace, schema baseline from the real dump (not just from the migrations), restore scripts (
scripts/restore-backup.sh, idempotent, isolated DB), Django reference environment on the dump. - Phase 2 is done (§5d). Next: Phase 3 (read-only core API on the same pattern: images, image sets, annotations, types, processing, with the token/viewer scoping), .
- Grep pass for raw SQL / Postgres-specific fields; data-quality audit report (§5a step 2).
- Then Phases 2–5 toward the beta exit criteria.
Caveat: Phase 0 was a structural survey (file sizes, models, routes, settings, dependencies). Per-field model details, serializer shapes and exact permission rules have not been read yet; they are the first task of Phases 2–3.
Done, verified against real Django by the mutation-parity harness (scripts/mutation-parity.sh, tests/mutations/): two
copies of the same database, one served by Django (:8001), one by Rust (:8002), identical scripted writes, responses and the
resulting rows of annotations_annotation / annotations_verification compared.
- Legacy JSON endpoints used by exact-sync and the old UI:
annotations/api/annotation/{create,update,delete,verify,blurred_concealed}/(compat/writes.rs, permission model incompat/perms.rs=ImageSet.get_perms, vector validation incompat/vector.rs=AnnotationType.validate_vectorincl. its int-identity quirk for lines). - REST v1
/api/v1/annotations/annotations/: POST (single, with idempotent update byunique_identifier; list = bulk), PUT, PATCH, DELETE,multiple_delete,count(compat/rest_writes.rs), DRF-shaped validation errors. - Deliberate differences: the image-set permission (
annotate/edit_annotation/delete_annotation) is enforced on REST writes (Django only checks the model permission, so any authenticated user withadd_annotationcould write into foreign teams' sets); annotations that have versions answer 409 on deletion (Django 500); a missingunique_identifiercreates the annotation (Django 500); bad time strings answer 400 (Django 500);"true"/"false"strings for Django-BooleanField inputs that Django 500s on are accepted. - Still open in Phase 5: v2 write endpoints for annotations, image / image set writes, processing writes with atomic claim, registration worker, QueueRunner v2, upload pipeline.
A better UI, not a Lightroom v2 clone; users are mainly pathologists. Requirements: click-to-select annotations, and a selected annotation is editable in place (move, resize for variable-size types, add area / edit nodes for polygons); the toolbox follows the context (nothing selected, selection by vector type, drawing); a one-click mode where each debounced click creates an annotation of the predefined size; all old shortcuts kept; annotation on desktop and tablet (pointer/touch events, large hit targets), viewing also on phones. Order: collect the old shortcut list and write one-page workflows -> v2 annotation write endpoints -> annotation layer (selection, handles, undo/redo) -> contextual toolbox -> side panel -> responsive layout.
/api/v2/annotations POST (idempotent by unique_identifier, global annotation once per image/type, vector validated, verified by
creator), PATCH (partial, conditional via expected_last_edit_time -> 409 with the current state, type change only within the same
vector family), DELETE (soft; ?hard=true removes, 409 when versions exist; undo = PATCH {"deleted": false}), POST {id}/verify.
Authority is the image-set permission, not Django model permissions; invisible annotations answer 404. Tests:
tests/conformance/test_v2_annotation_writes.py (18, part of make verify). Next in 5.2: image / image-set writes, processing
claim, upload pipeline; batch endpoint for the new viewer if the one-click mode needs it.
POST /images/image/upload/{set}/ (exact-sync, old UI; answers {"files": [...]} like Django, error texts included) and
POST /api/v2/image-sets/{id}/images ({"items": [...]}), multipart, any number of files, streamed to disk (no body limit) while
hashing (SHA-512, as Django). Needs edit_set and an unlocked set. ZIPs are unpacked (path traversal safe; .mrxs/.vms/.vsi
rule as in Django, entries checksummed over their first 10000 bytes), documents become auxiliary files, everything else goes through
the slide readers (width/height, mpp, objective power, frames + images_framedescription rows with the reader's labels, default
frame in the middle for z-stacks/volumes); unreadable files are removed again. No format conversion on upload (Django converted CZI,
multi-page TIFF, HDF5 to pyramidal TIFF with pyvips; the Rust readers read them natively). Tests: tests/conformance/test_v2_upload.py.
Not done yet: HDF5 overlay, iSyntax (dropped), MKT/NIfTI-specific frame directories (not needed), image lock/zip state side effects.
Old-UI shortcut inventory: docs/old-ui-shortcuts.md (extracted from the Django JS; lists three existing quirks of the old UI).
UI decision: the old viewer's heatmap is not ported (flawed implementation); Ctrl+Z is undo only.
v2: POST /api/v2/image-sets (team member; folder <SQL_DATABASE>_<team>_<id>, mode 0777, products optional), PATCH (edit_set;
name unique per team), DELETE (delete_set; cascades and removes the folder), DELETE /api/v2/images/{id} (delete_images, set
unlocked; removes the files unless another image of the set still uses them). exact-sync: POST /images/api/imageset/create/
(team: {"id"}, products: [{"id"}]; answers serialize_imageset). cascade.rs reproduces Django's on_delete=CASCADE from the
catalog's foreign keys with an explicit SET_NULL list (Django's FKs have no ON DELETE clause); the deferred FK constraints are the safety
net (a missing child would fail the commit). Tests: tests/conformance/test_v2_image_sets.py.
Still open in 5.2: tags/products of sets, move image, legacy GET image delete, annotation types / products admin endpoints
(administration/api/...), media-file upload, processing claim.
Legacy (exact-sync, old UI): images/api/imageset/{tag,product}/{add,delete}/ with Django's messages and status codes,
administration/api/annotation_type/{create,delete}/ (create keeps Django's sort_order <- enable_concealed quirk; delete: superuser, and
only if unused). administration/api/products/create/ is not ported: Django has no URL for it (exact-sync's create_product already gets
404 there). v2: POST /api/v2/image-sets/{id}/tags, DELETE .../tags/{name} (unused tags disappear, except test),
PUT|DELETE .../products/{pid}, /api/v2/annotation-types and /api/v2/products (POST, PATCH, DELETE; Django model permissions;
types in use cannot be deleted or change their vector type -> 409/400; products can copy the types of another product with copy_product).
Tests: tests/conformance/test_v2_catalog.py.
Still open in 5.2: move image, legacy GET image delete, annotation media-file upload, REST v1 writes for the other resources, processing
claim, registration worker, QueueRunner v2.
compat/generic_writes.rs: one implementation of POST/PUT/PATCH/DELETE for the resources that are plain tables, serving v1 (DRF-shaped
errors, v1 representation) and v2 ({"detail","errors"}, snake_case, UTC): Plugin, PluginJob, PluginResult, PluginResultEntry,
PluginResultAnnotation, ImageRegistration, ScreeningMode, SetTag, LogImageAction, Verification. Columns come from the resource Spec;
Django's defaults / auto_now_add are listed per resource (the tables have no column defaults). Django model permissions per method,
referenced images must be readable by the caller, existing rows must be inside the caller's scope (v2: processing data is scoped to
the teams of the image), deletes cascade like Django (cascade.rs, PluginResult.job SET_NULL). Not covered: file fields
(PluginResultBitmap.bitmap, Plugin.icon, ImageRegistration.file; need multipart) and M2M fields.
POST /api/v2/plugin-jobs/claim {"worker", "plugin"?}: one statement picks the oldest free job (no worker, not finished, no error, in the
caller's teams) and marks it, FOR UPDATE SKIP LOCKED; 200 with the job or 204. The test claims 6 jobs from 10 concurrent workers: every
job goes to exactly one worker. Django's workers read the list and then PATCH attached_worker, which can hand a job out twice.
Tests: tests/conformance/test_v2_processing.py.
Still open in 5.2: move image, annotation media-file upload, bitmap/icon uploads, writes for users/teams/memberships (admin), registration
worker, QueueRunner v2.
media.rs: storage like Django's FileSystemStorage under MEDIA_ROOT (valid file names, an existing file is never overwritten:
name_<7 chars>.ext), body parsing for multipart / urlencoded / JSON (Payload), and /media/ is served (public, like Django's). Body limit
raised to 1 GiB for the API routes. File fields in the generic writer: PluginResultBitmap.bitmap (required, plugins/<plugin>_<id>/<image>/),
Plugin.icon; JSON fields arrive as JSON text in form bodies. Annotation media files: legacy
annotations/api/annotation/mediafile/upload/{annotation}/{type}/ (a file name the annotation has already is skipped), POST /api/v2/annotations/{id}/media-files, DELETE /api/v2/annotation-media-files/{id} (removes the file); needs edit_annotation.
Not done: ImageRegistration.file, AnnotationType.image_file, streaming of very large bodies (bodies are held in memory).
Open in 5.2: move image, admin writes for users/teams/memberships, registration worker, QueueRunner v2.
POST /api/v2/images/{id}/move {"image_set"} and legacy POST /images/api/image/move/{image}/{set}/, GET /images/api/image/move-targets/;
port of exact/images/move.py with its checks and messages (same set 400, server generated 400, delete_images in the source / edit_set in
the target and no locks 403, name clash 409, annotation types used by non-deleted annotations must be offered by the target's products 409,
file name clash in the target 409; sets of other teams 404). Files (original, converted file, thumbnails, frame / MRXS folder) move first, the row
and zip_state after; on failure the files go back. Symlinked copies in other sets are re-pointed. Tests: test_v2_move_image.py.
Open in 5.2: admin writes for users/teams/memberships, registration worker, QueueRunner v2.
v2: POST /api/v2/teams (3-30 characters, unique; creator becomes admin), PATCH / DELETE /api/v2/teams/{id} (team admins; superusers may delete;
deleting releases the sets: public + locked, team cleared), PUT|DELETE /api/v2/teams/{id}/members/{user} (admins manage; leaving yourself is
always allowed; any member may promote while the team has no admin; no self-demotion; the last member leaving ends the team like leave_team).
Users, rules of administration/views.py: PATCH /api/v2/users/{id} (staff: names, email, username, frontend; site admin: is_active, not for site
admins or yourself; superuser: is_staff), DELETE and POST .../random-password (site admin; not yourself; superusers only touch superusers; the
password is returned once and stored with the Django-compatible hasher). User deletion clears every nullable reference (creator, last editor, ...) and
deletes the mandatory ones (tokens, passkeys, memberships, preferences, sessions): cascade::delete_users; cascade.rs also copes with tables
without an id column (sessions) and keeps image sets alive when their team goes (SET_NULL list extended).
The v2 Team / User representations are Django's serializers (no website / names yet; to be extended when the admin screens need them).
Not ported: password-reset mail (send-password-reset), user creation by an admin (users arrive through invitations). Tests: test_v2_admin.py.
Open in 5.2: registration worker, QueueRunner v2.
Rust owns the queue (exact_rust_registration_job, migration 0006; results land in the shared images_imageregistration), permissions, the job
lifecycle and the geometry; the compute stays in Python (qt-wsi-registration, unchanged). v2: POST /api/v2/images/{id}/register (202, answers
the job; an open job of the pair is reused), GET /api/v2/registration-jobs[/{id}], worker API POST .../claim (SKIP LOCKED, 30 minute lease,
answers the image paths on the server and the parameters), .../{id}/complete (matrix, error, runtime, pickled quad tree as multipart file;
creates or updates the registration of the pair, optionally the inverse), .../{id}/fail; GET|POST /api/v2/registrations/{id}/convert,
POST .../inverse. exact-sync v1: POST images/images/{id}/register_images/ (waits for the worker, REGISTRATION_WAIT_SECONDS, default 900:
201 new / 202 recomputed, 202 with the job when the wait ran out), registration/{id}/convert_coodinates/ (202), .../create_inverse_registration/
(201; inverse as cv2.invertAffineTransform, singular -> zeros; an existing inverse answers 409 where Django fails with a 500).
Conversion: matrix registrations natively (no perspective division, like Django), registrations with a quad tree pickle through
helpers/registration_helper.py (REGISTRATION_PYTHON, REGISTRATION_EXACT_DIR: the pickle holds EXACT's slide classes). Worker: helpers/registration_worker.py
(stdlib only except qt_wsi_reg; --once, several workers side by side). Differences: registering an image onto itself is refused (400).
Tests: test_v2_registration.py, plus with REG_E2E=1 (set by make verify when qt_wsi_reg imports) the real worker registers images 43 -> 2
through the API and the helper converts a point through the stored pickle (verified: 10 s).
Open in 5.2: QueueRunner v2 (mock worker with exact-sync, two-worker race test; the real QueueRunner as a manual smoke test).
tests/mock-worker/mock_worker.py: a worker that does what EXACT-QueueRunner does with exact-sync (register the plugin, list/retrieve jobs, claim,
progress, result + entry + annotations + bitmap upload, destroy an earlier result), with the old racy claim (legacy) or the v2 claim.
tests/conformance/test_mock_worker.py (7): both flows end to end, a failing handler leaves the error on the job and the job unclaimed, a re-run
replaces the earlier result, three v2 workers process six jobs exactly once (no result twice), two legacy workers lose no job.
The v2 claim now also skips jobs that have a result (QueueRunner's job.result is None). docs/queuerunner-v2.md: the proposed change for
QueueRunner (not applied, the user's checkout has local changes) and three findings in exact-sync (broken create_plugin, PluginJob.result
never filled, no multipart for bitmaps). The real QueueRunner as a manual smoke test remains for the cutover checklist (§5a).
Phase 5.2 is complete.
Built to the requirements of §5m. viewer-core/: geometry.ts (pure: hit tests, handles, move/resize/vertex editing, vectors, unit conversion of type sizes with the
image resolution; 13 tests), editor.ts (AnnotationEditor: select tool and draw tool on OpenSeadragon's pointer events, so mouse, pen and touch behave the same),
annotationLayer.ts (selection glow + handles, preview while dragging, polygon in progress, ghost of the box a click would place, dashed outline = not verified by
you), history.ts (undo/redo, serialised, 4 tests), shortcuts.ts (the old key table as a pure matcher, 7 tests), palette.ts (types of the image set by digit key,
conversion rules, hints; 4 tests). hooks/useAnnotationActions.ts: optimistic create / update / delete / change type / verify against the v2 endpoints, conditional
edits (409 -> "somebody else changed it", reload), history commands. components/Toolbox.tsx: contextual (select / draw, type chips with their keys, hints,
one-click toggle, selection tools: type, size, verify, delete, remove vertex; image labels for global types; undo/redo; show/hide).
Behaviour: click selects (smallest annotation first); only a drag that starts on the selected annotation or a handle edits (every other drag pans); box handles resize,
fixed-size boxes and points move, polygon / polyline vertices drag, the dot between two vertices adds one, click a vertex + Delete removes it; types with a fixed node count
keep their vertices. Drawing: drag (box, line), click (point, fixed-size box), clicks + Enter / double-click / click on the first point (polygon, polyline), one-click mode (A) places
the type's default size (converted from mm / µm with the resolution) with every click, debounced; the ghost outline shows where. Keys as the old UI: 1-9 type (changes the class
of the selected annotation), Shift+1-9 global labels, C draw/select, Enter/V finish, Esc cancel, Delete/Backspace/X delete, Y show/hide, Ctrl+Z / Ctrl+Shift+Z, E/Q image,
Shift+E/Q frame; new: A one-click. OpenSeadragon's own keys are switched off (no more R/F collisions); arrows, Shift+arrows, +/-, 0 are provided by the shortcut table.
Layout: tablet (touch targets >= 44 px, tool bar wraps), phone (type list and tools open on demand, no horizontal scroll). Server: global annotations (vector null) are
switched on again instead of duplicated; annotation type names are unique per product (400 instead of 500).
Tests: frontend/e2e/annotate.mjs (system Chrome, own image in a new image set: drag-draw, select, resize, move, pan-vs-edit, verify, delete, undo/redo, one-click, polygon incl.
midpoint insert and vertex delete, hide, tablet touch taps, phone layout), make e2e.
Not yet: brush union / scissors / glue / knife of polygons (old S, G, D keys), segmentation tool, "add area" to a polygon, drawing with a stylus pressure, multi-select, copy/paste.
Polygon reshaping, with polygon-clipping (viewer-core/polyops.ts, pure, 10 tests): brush (Shift+drag adds area, Alt+drag erases; on touch screens the toolbox
buttons "Add area" / "Erase" switch the brush on; the wheel or the slider sizes it; a ring follows the pointer, the result shows live), scissors (S: click the corners of an
area to cut away), glue (G: area to add), knife (D: a line that splits the polygon). Enter / double-click applies, Esc cancels. Results are simplified to about one screen pixel,
kept inside the image, rounded to integers; the largest piece keeps the annotation, further pieces become annotations of the same type (useAnnotationActions.replace: one undo
step takes it all back). Holes are dropped (annotations have none; the outline is kept and the user is told). Types with a fixed node count cannot be reshaped. Test: annotate.mjs
(brush add, band erase that splits off a piece, scissors notch, knife split, undo of each).
Not yet: the segmentation tool, multi-select, copy/paste of annotations.
Feedback after the first trial: the tool bar took too much room, image sets have many annotation types, and the selection should show its area. Now: one row (Dropdown.tsx:
types, the selected annotation's type, reshape tools and image labels are drop-downs that open upwards, close on Escape / outside click, and get a filter field above 7 entries);
the draw-type list hides while something is selected (digit keys still change its class); the left type list folds (remembered). A selected box or polygon shows its area (µm² / mm²
with the image resolution, px² without; the pixel numbers in the tooltip), a line its length, live while it is dragged (viewer-core/measure.ts, tested). Test: annotate.mjs.
Right click (long press on touch screens) on an annotation selects it and opens its menu: Info (type and shape, area / length, position, created by and when, last edited by and when,
who verified, description, id), Change class (only types of a compatible shape: same vector type, or box <-> fixed-size box; filter above 7), Crop to new image (boxes and polygons; a polygon
crops its bounding box) and Delete annotation (confirmation; undo brings it back). Crop asks for the target image set (the writable ones, grouped by team) or a new one (name, team; it gets the products of the source set), then
the server crops: POST /api/v2/images/{id}/crop {x, y, w, h, frame, image_set} and the legacy GET /images/api/image/crop/{id}/{x}/{y}/{z}/{w}/{h}/{set}/ (exact-sync).
The crop is a pyramidal JPEG BigTIFF written in bands (exact-wsi/src/crop.rs, flat memory; resolution tags from the image's mpp), named like Django's (<stem>x<x>_y<y>_z<z>_w<w>_h<h>.tiff),
the new image remembers its origin (crop_source, crop_x, crop_y, crop_frame); edit_set in both sets, target not locked, region inside the image, at most CROP_MAX_PIXELS (400 MP);
the same crop into the same set again answers 409 with the existing image. GET /api/v2/image-sets/writable lists the targets. Tests: crop.rs (unit), test_v2_crop.py, annotate.mjs
(menu, info, class change + undo, disabled class change for a lone polygon type, crop into a new set, repeated crop, delete with confirmation, long press). scripts/run-e2e.sh restores the scratch DB,
starts the server and runs the browser tests (and leaves the server up).
- Verification is gone from the UI (no button, no dashed outlines, no "verified by" in the info); writing an annotation through
/api/v2no longer verifies it (the verify endpoint stays for later). - Area label while editing: resizing, moving, brush strokes and drawing show the area (or the length) in a pill in the middle of what is visible of the shape.
- Class change to a fixed-size type asks whether to resize the annotation to the type's size around its centre (or keep the class); applies to the context menu, the toolbar and the digit keys; undo restores class and size.
- Crops know their origin: the top bar says "Crop of at (x, y)" with "Show in original" (opens the original zoomed to the cropped region, outlined, same frame); the pointer position is shown in the image's and, for crops, in the original's coordinates.
- Movies: play / pause (Space) left of the frame slider, right click chooses the speed (the movie's own
frame_ratefrom the file, presets, any number); frames are preloaded further ahead while playing. - Image 2 wobbled, and it was a pyramid offset - and two bugs of ours. (1) Its OME-TIFF levels are made by sub-sampling (
exact-cli level-offsetsshows 0.38 / 0.47 / 0.48 px against level 0); OME and generic TIFFs were not corrected, now they are (needs_registration). (2) The offset estimator under-estimated fractional shifts (parabola on the SSD grid: 0.27 instead of 0.38): it now refines with a gradient-based (Lucas-Kanade) step after both images were blurred (registration.rs, ALGORITHM 3; EXACT's Python port of the estimator still has ALGORITHM 2 and the same bias: it needs the same change, rows of different algorithm numbers are re-measured by each side). (3) DeepZoom sampling usedlevel size / image size, but OpenSeadragon places leveleas exactly 2^e level-0 pixels per pixel, so levels (sizes are rounded up) drifted against each other by up to a pixel towards the far edge, and edge tiles were stretched when clipped at the slide boundary; now exact powers of two, edge tiles padded with the background (generator.rs, test with a dot in the far corner). Measured withtests/perf/level_shift.py(phase correlation between neighbouring viewer levels): image 2 from 2.15 px to 0.18 px.
/sets/:id is now a working page. Header (name, lock / public badges, counts, team), Upload images (file picker or drop anywhere on the page; two files in flight with progress, per-file result: duplicates and unreadable files say why;
ZIPs unpack), Settings (name, description, location, main annotation type, collaborative / competitive, lock, public + public collaboration), More > Delete image set (type the name), tags (type + Enter,
cleaned as the old UI does; ✕ removes) and products (chips, "+ product" lists the team's products), tabs Images (filter, sort, select; selected: Move…, Delete…, Register these two…; tiles show size, frames, "crop") and Registration.
The registration tab lists the registrations of the set's images (thumbnails of both, error, scale, rotation, runtime) and the jobs that are waiting / computing / failed (polling every 2.5 s while any is open; "Try again"),
New registration… (source, target, "also create the inverse", parameters), Add inverse, Recompute, Delete. The index has New image set (name, team, products).
Server: GET /api/v2/image-sets/{id}/settings (flags, counts, the caller's permissions: the page shows only what the user may do); registrations are managed by team members (edit rights on the source image's set) without Django model
permissions (POST /api/v2/images/{id}/register, POST /api/v2/registrations/{id}/inverse, DELETE /api/v2/registrations/{id}, which also removes the pickle); the worker API keeps the model permission.
Tests: frontend/e2e/imageset.mjs (create, upload by picker and by drop, duplicate, tags, filter, select, registration through a worker played by the test, inverse, delete, move, delete images, settings, lock, delete set), test_v2_registration.py, test_v2_image_sets.py.
Not yet: rename of single images. (Auxiliary files, export and team statistics are done, see 5al.)
POST /api/v2/registrations/manual{source_image, target_image, points:[{source,target}], inverse?}: matrix estimated from picked point pairs (1 pair: shift; 2: similarity; 3+: least-squares affine; collinear points refused), stored withregistration_pointsand the RMS error, replacing the pair's registration (and its pickle) and optionally the inverse. Edit right on the source's set, read on the target.- New-registration dialog: automatic or manual, any target image set (images are loaded for the chosen set); the panel also names images of other sets and offers "Redo manually".
ManualRegistration: two viewers, click a spot in the source, then the same spot in the target. - Viewer overlays:
OverlayControllists the images registered with the current one (either direction; the other direction through the inverse), one overlay at a time with an opacity slider, hidden when there is no registration.viewer-core/overlay.tsplaces the image from the affine map (scale, rotation about the centre; shear is averaged out). Not done (side-by-side view of a pair was considered and dropped, the overlay is enough): multi-frame overlays use frame 0. - ConfirmResize shows the old (dashed) and new (solid) box around the common centre.
- Build note: with macOS 27 the default SDK breaks the ffmpeg link step;
SDKROOT=.../MacOSX26.5.sdkhelps (scripts/run-e2e.sh uses the Xcode SDK).
- Registration dialog picks images by preview (
ImagePicker); manual registration is a full-screen page with a crosshair in the viewer that takes the next point (the other points stay visible); the toolbox has a pointer icon for "select" and a separator before "Add annotation" + type list. - Export (
v2/export.rs): the template engine ofannotations/views.py: export_formatin Rust (all placeholders,%%if...%%endif, per-image aggregation, Python number/date/dict formatting:py_float,py_repr,py_time; quirks kept, e.g. fixed-size boxes have no centre). Endpoints:GET /api/v2/image-sets/{id}/export-formats,GET|POST .../exports,GET /api/v2/exports/{id}/download,DELETE /api/v2/exports/{id},POST|DELETE /api/v2/export-formats(team members). UI: "Export" on the image set page. Not done: format editor UI (create via API for now), comparison of the text with Django's output on real data (to do with the production backup; the unit tests pin the number formats), verification-based filters (min_verifications).
- Uploads are cards in the image grid (circular progress while sending, a spinning ring while the server reads the file, error cards with Dismiss); a finished card is replaced by the real one as soon as the list has the image. A name that exists in the set (or earlier in the same drop) opens a dialog: new name or cancel.
- Toolbox: "Annotate with:" button around the type drop-down. Overlay selector shows a spinning ring while the overlay loads.
- Start page: no "All image sets" entry (a team is a toggle), the search also finds images (
name__icontainsfilter on/api/v2/images, case-insensitive) and image set descriptions. - Manual registration: after saving, the source is laid over the target (slider) to check the result; "Review" in the registration list opens that view for any registration; a manual registration reopens with its stored points (
GET /api/v2/registrations/{id}/points, also reads Django's stored format).
- The TIFFs written by crop and repair carried YCbCrSubSampling 2:1 while the image crate's JPEG tiles are 4:4:4. Our reader and openslide did not mind, libtiff/Pillow (and so Django's EXACT) refused the file ("improper JPEG sampling factors").
JPEG_SUBSAMPLING = [1, 1]now, with a unit test that compares it with the JPEG frame header and a Pillow decode intest_v2_crop.py. Files written before this (pyramids repaired withexact-cli/the repair button, crops) have the wrong tag: re-crop them, or repair again from the.origbackup. - Viewer: an unknown image (404) shows an error with its id instead of leaving the previously opened image on the canvas (the world is emptied and redrawn on every image change).
GET|PATCH /api/v2/export-formats/{id}(members of the team; PATCH bumpslast_change_time, so earlier exports show as "format changed"),ExportFormatEditor(types, templates, flags, placeholder help) reachable from the Export dialog (new / edit / delete).Modalnow renders intodocument.body(a dialog opened from a dialog was unclickable inside the transformed parent box).- e2e flake fixed: the manual-registration "existing registration" lookup was cached from before the save.
/admin(link "Administration" for site admins and team admins;GET /api/v2/admin/metells what to offer): Teams (create, rename, delete; members with team-admin flag, remove/leave; add an existing user (site admins); invite someone into the team: link shown once; open invitations with revoke) and, for site admins, Users (filter; active; staff (superusers); reset-password link; random password, both shown once; delete). Names/emails of existing users are not editable in the UI yet./invite/:token(no login): accepting an invitation creates the account and signs in; the same page serves password reset links.scripts/run-e2e.sh admin(e2e/admin.mjs) covers the whole round trip including a second browser.
- Selecting: Shift+click adds or removes an annotation, Ctrl/⌘+drag draws a frame (everything that touches it, added to the selection), Ctrl+A selects all shown; the toolbox has a "Select several" toggle for touch (tap = add/remove, drag = frame). On a Mac Ctrl+click is the system's right click, so the click modifier is Shift (⌘ works for the frame).
- Acting: dragging one selected annotation moves all (one shift, kept inside the image); Delete / Backspace / X removes all; "Change type" (or a digit key) for the types every member can take (a change to a fixed-size type resizes around the centre and says so); the right-click menu of a member offers the same plus Copy. Each of these is one undo step (
History.group). - Copy / paste (Ctrl+C / Ctrl+V, buttons): the clipboard lives in the page, so it survives moving between images by the viewer's own navigation. In the same image the copies are offset (and stacked further on repeated pastes); into an image with a registration (either direction) the points are mapped through it (boxes become the box around the mapped corners, fixed-size boxes keep their size around the mapped centre), without a registration they land at the same position (with a note). Types the target image set does not offer are left out.
viewer-core/clipboard.ts(unit-tested), e2e inannotate.mjsincluding the registered paste.
- Server (
v2/segmentation.rs, also at the old/annotations/api/segmentation/...path):GET|PUT|DELETE /api/v2/segmentation/{annotation}/tiles/{plane}/{x}/{y}?frame=&ph=&nf=store 256 x 256 mask tiles per annotation as Django does (annotations_segmentationtile, binary PNG; PUT reads the red channel), axial tiles are stored, coronal / sagittal tiles of volumes are derived and written through (the voxel mapping ofannotations/views.py, Python rounding included); newGET .../tiles?frame=lists the tiles that exist, so a viewer asks only for those (sparse masks at any zoom). Read needs read access, writingedit_annotation; the annotation must be of a segmentation type (400 else). - Viewer: segmentation types of the set's products are in the "Annotate with" list marked ▨; choosing one creates (or finds) the one mask annotation of the type in the image and opens the mask tools: brush (round / square, size, Alt+wheel), eraser (or Alt), magic wand (colour tolerance, grows over connected pixels of the shown image; Alt removes), pan, opacity. All masks of the image are shown in their type colour (hidden with the type / "Hide"), painted ones are saved per tile after each stroke; every stroke is one undo step (undo / redo write the tiles back). Escape leaves the tool. The editor is suspended while it is on.
- Limits: for volumes (MPR planes) and other non-axial views the tiles are requested per tile, so the mask shows and paints only while at most 80 tiles are in view; a flood fill without image colours, lasso and polygon-to-mask are not there; the plane / frame handling of the UI was tested on the API level only (
test_v2_segmentation.pycovers axial, coronal and sagittal), the browser test covers 2D.
- NIfTI loading (done): voxels stay in their file dtype and are decoded per slice from a memory map; a
.nii.gzis inflated once, streaming, into a sidecar ($EXACT_NIFTI_CACHEor the temp dir, keyed by path/size/mtime) that later opens map directly; the display window uses the same sparse sample as before. Still open: bounded sidecar cache size, rendered-slice LRU.
- NIfTI voxels are decoded per slice from a memory map;
.nii.gzis inflated once into a sidecar cache (see backlog). - Admin → Users → Edit: username, first/last name, email (
GET /api/v2/admin/users/{id}/profile, existingPATCH /api/v2/users/{id}). - Auxiliary files:
GET /api/v2/image-sets/{id}/auxiliary-files,GET /api/v2/auxiliary-files/{id}/download,DELETE /api/v2/auxiliary-files/{id}; "Files (n)" button on the image set page when there are any. - Team statistics:
GET /api/v2/teams/{id}/statistics(storage, file types, image kinds, annotation types; members only), "Statistics" button on the start page when a team is selected. Per-image statistics of Django (image_statistics) is not ported: the viewer already shows the counts. - Administration → Products (visible with any of the Django model permissions for products / annotation types, shown in
GET /api/v2/admin/measperms): list of products by team, new / edit / delete product (a new one can start with the types of another), annotation types per product with colour, shape, order, active, number of annotations using it; the edit dialog shows only the fields that matter for the shape (size + unit for boxes and points, point count for lines and polygons, ...).GET /api/v2/products/{id}/annotation-typescarriesactiveandannotation_count(the shared resource representation lacksactive, as in Django). Types in use cannot be deleted (409) or change shape; deactivate them instead.
v2/jobs.rs: the common face of everything workers compute.GET /api/v2/jobs(registration jobs and plugin jobs together:kind,statusin queued/running/done/failed,progress, worker, times, error, result; filterskind,status,image; also the workers that asked for work in the last 90 s),POST /api/v2/jobs/claim({worker, kinds, plugin}: the oldest waiting job of the kinds the worker does,{kind, job}or 204),POST /api/v2/jobs/{kind}/{id}/restart(failed jobs),DELETE /api/v2/jobs/{kind}/{id}(cancel / remove; plugin jobs take their results along, as EXACT's "stop"). Creator or a user with the model permission may act. The tables stay as they are (Django'sprocessing_pluginjob, ourexact_rust_registration_job); the kind-specific endpoints stay for the workers written against them. Registration jobs have a lease (30 min) so a lost worker's job is claimed again.- UI: Jobs in the top bar (count of waiting + running), page with kind / status filters, links to the images, error details, Restart / Cancel / Remove, and a hint when jobs wait and no worker of that kind is connected.
helpers/registration_worker.pyclaims through the common endpoint withkinds: ["registration"]. - Next: the worker started by the server (managed child process,
REGISTRATION_PYTHON), progress for registrations, image analysis submit from the UI.
- DB (shared with EXACT, migration
0007_registration_plugins.sqlhere,processing/0015_registration_pluginsin EXACT PR DeepMicroscopy/Exact#167):processing_plugin.plugin_type(1 image analysis, 2 registration) andparameters_schema(jsonb, the parameters a job accepts);processing_pluginjob.parameters({name: value}, for any algorithm) and the new tableprocessing_pluginjobimage(job, image, position): the images a job concerns in order,imagesin the v2 API (a registration job has two: source, target).processing_pluginjob.imagestays the main image, so the v1 API, exact-sync and QueueRunner are unchanged (v1 reports one image, shows only image-analysis plugins and their jobs, and none of the new fields; registration plugins and jobs belong to the new API; Rust:effective_scope, Django: the PR's viewsets); a job without rows concerns just itsimage. The result of a registration is not stored on the job (jobs may be cleaned): it is theImageRegistrationof the pair, created or overwritten when the job completes. Same DDL on both sides, idempotent;scripts/check-schema-sync.sh(withEXACT_DIRset to a checkout that has the migration, e.g. a worktree of branchregistration-plugins) checks both orders and the baseline.exact_rust_registration_job.plugin_idis ours. PR #167 is merged (2026-10-29). Registration jobs are jobs of registration plugins inprocessing_pluginjob(migration0008, idempotent: jobs of the former tableexact_rust_registration_jobare moved over, the table is dropped):image+processing_pluginjobimageposition 0/1 = source/target,parameters, status through the common words (waiting: noattached_worker; running:attached_workerset, claimed again after 30 min without a touch; done:processing_complete100; failed:error_message), the result is theImageRegistrationof the pair (overwritten by a new result). A job always names a registration plugin (default: the lowest id); without any plugin a registration cannot be queued (409: start a worker). Claims of image-analysis jobs skip registration plugins. The registration endpoints (/registration-jobs…) keep their shape. UI: a review of an automatic registration offers no points; the new-registration dialog says when no method is registered. - API (
v2/plugins.rs):GET /api/v2/registration-plugins(default first),POST /api/v2/plugins/register(a worker announces a plugin: created or updated by name + package, schema checked),GET /api/v2/admin/plugins(site admins: every plugin with jobs by status, last use, products, the workers that serve it).POST /api/v2/images/{id}/registertakespluginand the parameters the plugin's schema names (no plugin: the default registration plugin); the claim (/api/v2/jobs/claim) takesplugins: [ids]and only hands out jobs of those plugins; workers that ask are remembered for 90 s (workersin the lists). - UI: the "register two images" dialog offers the registration methods and a form for the chosen one's parameters (
ParamFields, built from the schema); Administration > Plugins lists everything registered (type, parameters, jobs, last use, who serves it, products); the jobs list names the plugin. - Worker:
helpers/queue_worker.pyhosts plugins fromhelpers/plugins/(interface:helpers/queue_plugin.py:Plugin,RegistrationPlugin,RegistrationResult,param), announces them, claims through the common queue and reports results.helpers/plugins/qt_wsi_registration.pyis the worked example (the algorithm ofperform_registration, parameters, availability check).helpers/registration_worker.pystays as a shim. Tests:test_v2_plugins.py,test_queue_worker.py(a worker with a plugin of its own).
/images/:id/planes(pages/MprPage.tsx): axial, coronal and sagittal planes of a NIfTI volume side by side, linked by a crosshair (lines in the colour of the plane they stand for, planes coloured red / green / blue). A click in a plane sets the crosshair (its own slice stays, the other two planes jump to the slices through the point); the mouse wheel and Page Up / Down step the slices of the plane last used; each plane has a slider and its slice label; drag moves the image, Ctrl + wheel / pinch zooms, a track pad swipe moves. The crosshair is in the address bar (vx,vy,vz, voxel indices) so a link shows the same position. Geometry inviewer-core/mpr.ts(voxel <-> point of a plane, asexact-wsi/src/nifti.rsrenders), tested;CrosshairLayerdraws the lines; every plane is aZBlenderstack (smooth stepping as in the single view).- Volumes open in this view by default; "Single plane" (remembered in the browser,
exact.mpr) leads to the old viewer with the annotation tools, "Three planes" back. Not in this view yet: annotations (only axial annotations exist; drawing stays in the single plane), window/level, DICOM volumes (they have no planes on the server).
- As in the old EXACT an annotation of a stack, volume or movie carries the frame it was drawn on in its vector (
vector.frame, counted from 1) and is shown on that frame only; annotation types with multi frame are shown on every frame; an annotation without a frame (older ones, single images) is shown everywhere. New and pasted annotations get the current frame, every edit keeps the frame (viewer-core/frames.ts,useAnnotationActions). In a volume annotations live in the axial plane: the coronal and sagittal planes of the single-plane view show none (and cannot be drawn on); the three-plane view shows the axial slice's annotations read-only. - The vector validation (shared with the legacy writes) ignores the
framekey when it counts coordinates; the REST API of EXACT takes it, only the legacy views count it. - Not done: the frame of a global annotation (no vector), segmentation masks per frame are separate (tiles carry their frame), moving an annotation to another frame, "copy to next frame".
deploy/(Dockerfile: UI + Rust build + Python with slideio/qt-wsi-registration + EXACT checkout for the registration worker;docker-compose.ymlserver + worker;exact.env.example; systemd units;Caddyfile.example),docs/DEPLOY.md(runbook: copy of files, restore,exact-cli migrate, audit, first checks, operating notes).scripts/audit-backup.sh(reads only: migration state, sizes, formats, source files missing on disk, data quality, biggest image sets, annotation-load timing through the API) andexact-cli audit-passkeys(every stored passkey parsed the way the server does).- The server writes to the image store (uploads, move, delete, repair, crop): the beta runs on a copy of the files.
exact-cli migrateis not run by the server on start. - Image build verified on arm64 (no slideio wheel there); not yet on x86_64.
The beta on the real image store (24k images, mostly SVS / MRXS / VSI / NDPI) was slow when the overview of a team with 200+ image sets asked for 200 covers
at once, with the CPUs idle: htop showed the slideio helpers in disk waits (D). Causes found in the code: the thumbnail handler did a stat of the slide file on the
async runtime thread; every cache miss opened the slide as a pool of up to four handles and put it into the 20-entry viewing cache (evicting what was being viewed);
the number of renderings at once was unbounded (all the blocking threads), the helper pool had two processes and kept every slide it had ever opened.
Now: file access off the async threads, EXACT_THUMBNAIL_JOBS (4) and SLIDEIO_WORKERS (4) semaphores (helper formats have their own queue), single-flight per
thumbnail, atomic cache writes, a five-minute negative cache, a single light handle that is not cached (SlideCache::get_light), the helper keeps at most 12 slides
(SLIDEIO_MAX_OPEN), the home page draws 48 sets and loads thumbnails at low priority, and scripts/warm-thumbnails.py renders the covers ahead.
Test: tests/conformance/test_v2_thumbnails.py (a burst of 40 requests for different images; 24 at once for one thumbnail renders and stores it once).
Not measured on the production storage: the numbers there decide EXACT_THUMBNAIL_JOBS.
Model permissions (the registration worker needs processing.add_plugin, processing.change_pluginjob, images.change_imageregistration) could only be set in the Django
admin or SQL. Now (superusers): GET /api/v2/admin/permissions (catalog of the apps administration / annotations / images / processing without view_*, and the presets
registration_worker and analysis_worker), GET / PUT /api/v2/admin/users/{id}/permissions (replaces the user's own permissions in that range; group permissions are shown
read-only; not for one's own account), POST /api/v2/admin/users (service account: random password shown once, preset / permissions, team memberships). UI: Users tab, "New
worker account…" and "Permissions" per user (components/UserPermissions.tsx). Tests: test_v2_admin_permissions.py, e2e/admin.mjs.
Not done: group management, permission editing for non-superusers (site admins), an audit trail beyond the server log.
Users tab: "New user…" (names, e-mail, teams, read only; random password shown once, or a link to choose one; superusers also get worker kinds) for administrators.
Read only is a per-user flag in exact_rust_user_flags (migration 0009; Django's users_user is untouched, so EXACT itself ignores it): authenticate() refuses every
non-safe method for such an account whatever the login (session, Basic, token), authenticate_account() is for self-service (sign out, stop impersonating, passkeys);
the legacy GET that creates an image (crop) is refused explicitly; perms() (the Django get_perms port) leaves only read, so the UI hides upload, settings etc.;
viewer: no tools, the context menu informs only, a note; top bar badge; PATCH /api/v2/users/{id} {"read_only"} and POST /api/v2/admin/users (site admins; permissions and presets
stay superuser-only), GET /api/v2/admin/roles lists read_only_ids. exact-server now refuses to start on a database without the tables every request needs.
Tests: test_v2_read_only.py, e2e/admin.mjs. Not done: a read-only badge in the user lists of teams, per-team read-only memberships.
A "what's new" tour (four short pages with pictograms, only what is better than the old EXACT: speed with a before/now bar picture, every device, Apple Pencil on the iPad, the annotation tools; Back / Next / Skip / dots / arrow keys) for people who have not been on this server: shown once after the first login, remembered per user (exact_rust_user_flags.welcomed_at, migration 0010; the startup check now
needs the column), closed in any way counts as seen; "What's new" in the top bar (menu on phones) opens it again. GET /api/v2/welcome (show, notice), POST /api/v2/welcome/seen (account
self-service: read-only accounts may dismiss; an administrator impersonating a user neither sees nor dismisses it). EXACT_WELCOME_NOTICE puts a line at the top (the beta says it is a copy of production).
The scratch users are marked as greeted by reference/mark-welcomed.sh (make restore), otherwise the dialog would stand in the way of every browser test; the admin e2e's login closes it for users it creates.
Tests: test_v2_welcome.py, e2e/admin.mjs. Not done: versioned "what's new" (a second greeting for a later release), a changelog feed.
First opening of a CZI took 5–8 s: not slideio's open (0.05–0.23 s) nor the tiles (20–110 ms) but estimate_level_offsets, measured once per file and stored.
exact-cli precompute-offsets [--jobs N] [--limit N] [--force] [--dry-run] does that for every single-file image with a candidate extension (czi, vsi, dcm, tif/tiff/btf, ome.tif[f]) whose reader needs_registration, skipping what is stored with the same algorithm, size and mtime. Scratch DB: 40 files in 17 s with 2 jobs; the CZI DZI descriptor then answers in 0.2 s instead of 5–8 s. Not done: parallel levels inside one estimate; multi-file z-stacks (never stored).
Right click (long press on touch) on an image of the set page opens a menu: Open, Download, Move…, Related images. Move needs no selection (it acts on the whole selection when the image is part of it); permissions as the toolbar's Move. Download is the existing GET /api/v2/images/{id}/download (Django's download_image_api); its MRXS / VSI ZIP is now written to a temporary file in EXACT_CACHE_DIR/downloads (stored, not deflated, streamed copies, unlinked at once) instead of being built in memory, which read whole slide folders into RAM. GET /api/v2/images/{id}/related (v2/related.rs): crop_of, crop, registered_to, registered_from, only images of the user's teams. Viewer: a round icon at the right of the top bar opens a movable window (FloatingPanel, position remembered) with brightness, contrast, gamma (SVG filter), saturation, hue, grayscale, invert, applied as a CSS filter to the drawn tiles only (annotation layer untouched), remembered in localStorage, dot on the icon while changed. Tests: test_v2_image_menu.py, adjust.test.ts, e2e imageset.mjs (menu) and smoke.mjs (window). Not done: zipping z-stack / frame folders on download; downloading several selected images at once; sharpen / per-channel curves; a streamed ZIP (the zip is complete before the first byte is sent).
Scope chosen by the user: masks in the three-plane view, 3D tools, automatic / AI-assisted segmentation; NIfTI and DICOM volumes.
- Geometry (
v2/volmask.rs): the mask grid is the axial pixel grid (w x hper slice,nslices, tiles as before inannotations_segmentationtile); planes are tied to it in millimetres (a plane pixel has a position, the mask voxel containing it is the one it shows or changes), so anisotropic voxels and resampled plane images need no special cases. Django's coronal / sagittal tile mapping is not used by the new code: its sagittal plane is mirrored against the picture the reader renders (mask column c = axial row c, the picture shows y voxel c = axial row ny-1-c) and its coronal / sagittal frames are off by one (y_frame + 1); the old tile routes keep that behaviour (legacy parity), the single viewer therefore offers no mask tools on coronal / sagittal planes any more, the three-plane view is the place. The axial height of a volume comes from the reader (plane_dimensions(0), 233 for the CT test volume), not fromimages_image.height(232). - Engine: sparse voxel mask (256 x 256 tiles), brush strokes (2D disc in the plane / 3D sphere, radius in mm, polylines), region growing (wand) in the plane (4-neighbours) or the volume (6-neighbours) on display intensities with tolerance, optional radius and a voxel cap (40 M), shape-based interpolation between painted axial slices (signed distance transform, Felzenszwalb EDT), copy slice(s), grow / shrink, fill holes, keep largest component, clear, import of a whole mask (
PUT labels, raw, gzip allowed). Every operation is journalled per tile: one undo step (max 40 per annotation, PNG before / after, in memory). - API (
v2/seg3d.rs):GET /api/v2/segmentation/{a}/volume(geometry, planes, count, volume mm³, slices painted, undo state),GET .../slice/{plane}/{frame}?color=&alpha=(RGBA PNG at plane size),POST .../ops,POST .../undo|redo,PUT .../labels?mode=replace|add. The open mask lives in a moka cache (6 annotations, 15 min idle) with a per-annotation async lock; the old per-tile writers callseg3d::forget. Undo history is lost on restart and when the old tile routes write. - DICOM volumes (CT / MR / PT / NM multi-frame, native readers only) have coronal and sagittal planes now (
exact-wsi/dicom.rs): plane images in physical proportions (width of the axial image as reference), slice spacing from SpacingBetweenSlices / SliceThickness (else like the in-plane spacing),openslide.mpp-z; last frame at the top (frame order is assumed to be inferior to superior: ImagePositionPatient is not read), frame f of the coronal plane shows image rowrows-1-f. Single-frame-per-file series (a folder of slices) are still not supported. - Tests:
volmaskunit tests (geometry round trips, strokes in mm, wand, interpolation, morphology),dicomplane test,test_v2_seg3d.py(NIfTI 80: planes agree with the picture, incl. the non-mirrored sagittal; a synthetic CT DICOM with two balls: planes, wand 3D count equals the ball volume).
- UI (
MprPage.tsx,Segment3DPanel.tsx,hooks/useSegment3D.ts,viewer-core/{mpr3d,maskOverlay,brushLayer}.ts): a Segment menu in the top bar of the three-plane view (segmentation types of the set's products; the one mask annotation of the type is made on first use), the mask of that type laid over all three planes, a movable tool window: brush (2D disc / 3D sphere, size in mm, ring cursor, onestrokeop per drag), eraser (Alt), wand (plane / volume, tolerance, reach), interpolate, copy to next / previous slices, grow / shrink, fill holes, largest part, clear, undo / redo (Ctrl+Z), opacity, volume readout, an area for extra buttons (Auto segment). Read-only accounts see the mask only. The single viewer's mask tools are offered on the axial plane of a volume only (hint with a "Three planes" button). Tests:mpr3d.test.ts,e2e/seg3d.mjs(also covers the automatic segmentation with a real worker). - Automatic segmentation (own fork, merged 2ce817c): Rust-only tables
exact_rust_segmenter/exact_rust_segmentation_job(migration 0011),v2/seg_jobs.rs(worker: register, claim with SKIP LOCKED and a 30 minute lease, progress, complete, fail; user: list segmenters,POST /images/{id}/auto-segment, jobs),GET /api/v2/images/{id}/voxels?kind=display|intensity(raw mask-grid voxels;Slide::intensity_slicefor NIfTI / DICOM),helpers/segment_worker.pywith segmenters as Python modules inhelpers/segmenters/(threshold.pyworks: Otsu or fixed bounds, closing, fill holes, largest part;nnunet_example.pyis a skeleton that registers nothing until nnU-Net and a model are there), the worker uploads withPUT labels, theAutoSegmentDialog(button in the tool window; the tool window reloads the mask when the job is done), compose servicesegment-worker(profilesegmentation). No trained model ships; deep-learning segmenters need the user's own model. - Found while building: the whole-volume wand with a
HashMapof visited voxels did not finish on 11 million voxels; now a dense bitset and linear indices (11 s in a debug build). Not done: segmentation jobs on the jobs page UI label (the list includes them), multi-label masks, mask export to NIfTI, a compressed in-memory mask (a 512 x 512 x 600 volume is a few hundred MB while open), DICOM series of single-frame files, ImagePositionPatient-based slice order.
-
helpers/plugins/deeperhistreg_plugin.py(queue worker plugin, parameters: mode affine/deformable, initial transform rigid/affine, overview size, registration size, device, SIFT, SuperGlue, angle step). DeeperHistReg reads image files itself, which EXACT's slides are not always, so the plugin renders an overview of both slides with EXACT's readers (helpers/plugins_common.py: open_slide, shared with the qt-wsi plugin), runsDeeperHistReg_FullResolutionin memory on them (CPU or GPU) and keeps the final displacement field. -
Convention verified on a synthetic pair with a known 12° rotation: the field maps target to source (
source = target + field(target), pixels of the preprocessed overview, channel 0 = x), padded pair,initial_resample_ratio.helpers/dhr_transform.py: DhrTransform(numpy/scipy only) chains slide px -> overview -> padding -> field and inverts the field by fixed-point iteration; it is pickled intoimages_imageregistration.file, soregistration_helper.py(now putting its own folder onsys.path) converts points through the full deformation like with the quad tree. The matrix stored is the least-squares homography on points inside the field;registration_erroris its mean distance from the deformation (0 for affine). -
Runs in a process of its own (
helpers/dhr_run.py, started by the plugin with the worker's Python): PyTorch deadlocked (OpenMP) once it shared a process withqt_wsi_reg, and importing scipy ordeeperhistregbeforeqt_wsi_regcrashes the worker (134/139), so the plugin's availability check only usesfind_specanddhr_transformimports scipy lazily. Found when the worker hosting both plugins hung on a job; the same child process returns a large registration's memory afterwards. -
Tests:
tests/helpers/test_dhr_transform.py(3),REG_E2E=1conformance testtest_real_worker_registers_with_deeperhistreg[affine|deformable]against real slides 43 -> 2 on CPU (passes, 98 s together). Synthetic check: rigid 1 px, deformable 0.04 px (1200 px overviews). -
Not done: progress reporting (the library has none), GPU run, the full image build (the Python layer of the Dockerfile was built and a registration run in it on arm64, x86_64 not tried), real stain pairs (accuracy on H&E vs IHC unmeasured), a UI hint that the parameters differ per plugin (the form is built from the schema).
-
Tissue crop (user report: H&E -> very pale PHH3 of the same block, 182k x 413k px MRXS, qt-wsi gave error 99999999 = no match): both overviews are cropped to the tissue (
tissue_box: 255 - grey > 6 on a 1024 px overview, median-filtered, 3 % margin; holds for H&E and for the pale IHC) andDhrTransformhasorigin_source/target(slide px of the overview corner; old pickles default to 0). On that pair DeeperHistReg (affine, 2048 px overviews, 1024 px registration, CPU, 57 s) finds scale 0.998, rotation 0, shift (78, 128) px; side-by-side of the mapped region shows the same cracks and outline. The quad-tree plugin still registers the whole slide atthumbnail_sizeand was not changed. -
Docker: DeeperHistReg is in the image by default (
WITH_DEEPERHISTREG=0leaves it out; CPU torch; a layer with the Python packages + torch measured 3.0 GB on arm64). The image has an entrypoint (deploy/docker-entrypoint.sh) that runsexact-cli migrate --confirm-db "$SQL_DATABASE"beforeexact-server(EXACT_AUTO_MIGRATE=0turns it off; workers anddocker compose run server exact-cli ...are not wrapped), so an update needs no manual migrate. Restore the dump before the first start: migrating an empty database first would collide withpg_restore. -
CUDA is the default (later):
TORCH_INDEXdefaults to the cu124 wheels,docker-compose.ymlreserves the GPU for the worker,deploy/docker-compose.cpu.yml(deploy: !reset null, Compose 2.24+) is the opt-out for hosts without a GPU;docker-compose.gpu.ymlis gone, its notes are in docs/DEPLOY.md §4c. (The bullet below describes the first, opt-in version; it ran on the server's RTX 2060.) -
GPU worker (written, not run: no GPU here):
TORCH_INDEXbuild argument (default the CPU wheels,.../whl/cu124for CUDA) anddeploy/docker-compose.gpu.yml(an override adding the NVIDIA device reservation to the worker, so hosts without a GPU keep working with the main file). Target: the server's RTX 2060 (6 GB, Turing). To check on the server:nvidia-smiandtorch.cuda.is_available()in the worker container (commands in the file's header), then a deformable registration at registration size 1024 and 2048 (memory). -
Docker worker could not read slides (found on the server:
ModuleNotFoundError: zarron the first DeeperHistReg job; the qt-wsi plugin would have failed the same way): EXACT'sutil.slide_serverimportszarr.core,zarr.hierarchyandtifffile.tifffile.ZarrTiffStore, so the image now pinszarr==2.18.7,xmltodict==0.13.0,tifffile==2023.2.28like EXACT's requirements.txt (zarr 3 / current tifffile break the import), and a build step importsutil.slide_server(skipped with a warning where slideio has no wheel). Tested in a container with the same pins (arm64, slideio stubbed): the module imports and opens the 182k x 413k MRXS; the x86_64 image build not run here. -
Bug found on the server (image 88 -> 118, source portrait, target landscape = turned ~90 degrees; reported error 32367 px, "really off"): DeeperHistReg's own result was right (checked: its warped source matches the target for a 100 degree rotation),
DhrTransform.convertwas wrong: it inverted the target -> source field by the fixed pointt = s - u(t), which converges only where |grad u| < 1 and diverges for rotations above ~60 degrees (12 degrees was what had been tested). Now Newton's method with the field's gradient (exact for rotations;_gradcached, not pickled),convert(..., with_residual=True), and the matrix fit uses only points that converged (a residual < 0.5 field px: points whose counterpart is outside the registered area have no solution) and only the source tissue box (affine(box), was the whole slide, where the field is extrapolated). Synthetic pairs through the real pipeline: 100 / 185 / -60 degrees recovered within 1 px (before: 380-2300 px off, found rotation -178 degrees and scale 0.6 for a true -100 degrees and 1.0). Tests:test_a_rotation_of_more_than_ninety_degrees_converts_too. Registrations stored by the earlier code keep their wrong matrix: register again. -
System health for site admins (§5ba; user documentation: docs/system-health.md):
GET /api/v2/health(site admin only;crates/exact-api/src/health.rs): CPU (/proc/stat), GPU (nvidia-smi), active users (in-memory last-seen map filled inauthenticate_account, browser sessions and bearer tokens, 5 minutes, basic auth = workers excluded), RAID and optional temperature from a host status file (EXACT_HOST_STATUS_FILE, written bydeploy/host-status.pyfrom cron: hardware RAID is invisible to the container), temperatures (/sys/class/hwmon), free space of image/media/cache volumes (statvfs). Frontend:SystemHealthicon in the top bar (dot only on warning/critical, storage in the tooltip, click for the checks). Unreadable checks are "unknown", never an alert. Compose: the server container gets the GPU withutility(nvidia-smi) and the status folder;docker-compose.cpu.ymldrops it. Not run on Linux/with a real GPU or RAID (developed on macOS; parsers unit-tested, host script tested with a fakestorcli64): check CPU/GPU/sensor values on the beta, and the output ofssacli ctrl all show config/show statuson the DL380 Gen9 against the parser (written from HPE's documented layout, unit-tested with that sample, not with a real controller). The host script is Python (deploy/host-status.py: ssacli, storcli, /proc/mdstat, ipmitool for temperature).
Requirement (user): a Slicer .seg.nrrd must not be an "image"; it should be linked to the NIfTI/DICOM volume and shown with it ("related"). Two steps: (1) linked, read-only overlay, no annotation types needed; (2) an import tool that turns the segments into annotations (not built yet). CTs are NIfTI.
-
Reader
exact-wsi/src/nrrd.rs: header + raw/gzip data, integer label types, 3D or 4D with a leading layer axis (Slicer overlaps),spaceLPS/RAS/LAS,space directions/originto a voxel-to-RAS affine, SlicerSegmentN_*(name, colour, label value, layer) or a segment per value for a plain label map;Nrrd::resamplelooks every voxel of the volume's grid up in millimetres (nearest) and reportskept(labelled volume that stays on the grid);plane_labelscuts plane images in the orientationnifti.rsrenders.nifti::Nifti::grid()exposes the reoriented grid (canonaffine = voxel to RAS, plane sizes); test with flipped / shifted sforms. -
Storage / API (
v2/linked.rs, migration 0012exact_rust_linked_volume, Rust-only; the file lies in the set folder): upload of a.nrrdthrough the ordinary image upload answerstype: "segmentation";GET /api/v2/image-sets/{id}/linked-volumes,GET /api/v2/images/{id}/linked-volumes,GET|PUT|DELETE /api/v2/linked-volumes/{id}(GET adds the set's NIfTI volumes with a name score; PUT{image}links after resampling, 422 when no labelled voxel is inside, 400 for another set or a non-NIfTI;{image: null}unlinks),.../slice/{plane}/{frame}?hide=0,3&alpha=(RGBA PNG at plane size),.../at?x&y&z,.../file,.../thumbnail. Resampled labels are kept in a moka cache (about 640 MB, 20 min idle). Read = read access to the set, link/delete =edit_set; moving the volume to another set unlinks; deleting the image unlinks the files, or deletes them with it when asked (DELETE /api/v2/images/{id}?segmentations=unlink|delete; the delete dialog asks). Bug found by the user: the application-level cascade (cascade.rs) reads the foreign keys from the catalog and cascades all but a hard-codedSET_NULLlist, so the table'sON DELETE SET NULLwas ignored and a deleted volume took its file's row with it (file left behind);exact_rust_linked_volume.image_idis on that list now. An upload tile that outlived its deleted image also came back; it is dismissed when the image shows up in the grid;/images/{id}/relatedlists the files (kind: segmentation). -
UI: the upload dialog
LinkSegmentationDialog(segments, the volume the name says is chosen), the file is a card in the image grid (SegmentationTile: picture fromGET .../thumbnail= busiest axial slice, over the volume's slice when linked; click opens the volume's three-plane view or asks for a volume; right click / long pressSegmentationMenu: open, download, relink, unlink, delete; there is no separate list),LinkedPanelin the three-plane view (file and segment toggles, opacity, segment under the crosshair), one read-onlyMaskOverlayper file and plane under the mask being edited, "Segmentation file" in the image menu's related images. -
3D render (user: the Mask checkbox could not be turned on):
GET /api/v2/linked-volumes/{id}/render-mask?max=&hide=answers the render grid of the volume with two bytes per cell (coverage, majority segment + 1;nrrd::render_cells),x-channels: 2;volumeRender.tshas a third texture (RG8) and a 256 x 1 palette, the labels are composited like the annotation mask but in the segment colours (GLSL reserves thegl_prefix: a helper calledgl_broke the shader);Render3Dshows the first linked file that is switched on with a Segmentation checkbox (the Mask checkbox is hidden while no annotation mask is chosen and a file is linked). With the image on, bone hides inner segments: switch Image off. -
Bug found by the user and fixed: uploading the same file twice stored it again, hit the unique key and then removed the file the first row owns ("No such file" on linking). Now the duplicate is refused before anything is written, a failed insert never removes a file a row owns, and a missing file is reported as such (no server path in messages).
-
Tests:
nrrdunit tests (swapped LPS axes, outside grid, layers, unsupported, plane orientation),test_v2_linked.py(axes as the volume and swapped/LPS, link, slices at the right pixels, hide,at, unlink, 422 for a shifted file, permissions),frontend/e2e/linked.mjs. -
Step 2 done (2026-11-03):
POST /api/v2/linked-volumes/{id}/import {segment, annotation, mode}writes one segment into an existing mask annotation of the linked volume (seg3d::import_with: the same journalledvolmask::import+commitasPUT labels, so one undo step, tiles stored, caches forgotten; the segment is cut onto the volume's mask grid withplane_labels, i.e. exactly what the overlay shows; 400 for a mask of another image, 409 unlinked,edit_annotationneeded).ImportSegmentsDialog(button in the Segmentation window): per segment include + type (the type of its name, else a new segmentation type in a product of the set in the segment's colour, viaPOST /api/v2/annotation-types), replace/add, sequential with a status per segment; creates the mask annotation when the type has none; segments sent to one type are united (the later onesadd); afterwards the first type is opened in Segment mode. Tests:test_v2_linked.py(import is the overlay pixel for pixel; replace repeatable; add; undo; refusals),e2e/linked.mjs. Overlapped Slicer layers are imported as the combined label volume (later layer wins). Annotation types used by any annotation (also a deleted one) cannot be deleted: the e2e leaves typesBall/Cubebehind (reused by the next run, gone withmake restore). -
Export done (2026-11-03):
GET /api/v2/images/{id}/export-segmentation?format=nrrd|nifti&types=(v2/export_seg.rs): a segment per segmentation type (masks of one type united,mask_bytes), cut from the mask grid onto the volume's voxel grid (nrrd::display_to_voxels, the inverse ofplane_labels), written bynrrd::write_seg(Slicer.seg.nrrd: LPS, gzip,SegmentN_*fields, 3D or 4D with layers when masks overlap, greedy layer assignment) ornifti::write_labels(+ gzip), the position of the volume (Nifti::grid()).Export masksdropdown in the three-plane bar when the volume has masks; 404 without voxels, 400 for non-NIfTI. Tests: writer round trips (nrrd,nifti),place, pytest on an anisotropic volume (position within 2 mm, count within 15 %, exported file re-uploaded and linked), e2e download. Found on the way:Nrrd::resample'skeptcounted overlapping segments twice, a file with layers would have warned "cut off" for no reason. Checked on the user's real volume (4 masks, 345 kB, same volumes as the masks). -
Old NRRD images (2026-11-03; user: what happens to NRRD files that already are images?): they stay broken images (thumbnail/metadata 400 "The slide cannot be read", download works).
POST /api/v2/images/{id}/convert-to-segmentation(linked::convert_nrrd_image, needsedit_set+delete_images, set not locked): plan = NRRD file, nothing depends on the image (non-deleted annotations,images_imageregistration/images_pyramidregistration, crops; 409 with the reason), readable integer label map; then in one transaction the unlinked file row is inserted and the image deleted throughcascade::delete_rows; the file stays. UI:ConvertSegmentationDialogon a click on an NRRD card (badge "segmentation file?"), in the card menu and on the viewer page of such an image (/images/{id}), followed by the link dialog (?link=after converting from the viewer page) which opens the volume. Bulk:exact-cli convert-nrrd-images [--dry-run] [--confirm-db <db>](exact-cli now depends on exact-api for it). Tests: pytest (convert, refusals for annotations / damaged file / non-NRRD, outsider), the CLI on a scratch DB (dry run = real run, repeatable, bad and missing files reported), e2e. Production backlog is unknown: run the dry run on a copy first. -
Several files on one volume (user: not all should show when one is opened): a card, the card menu, the link dialog and the volume's Related images entry open
/images/{id}/planes?seg=<file>;MprPagedraws only that file (else the newest), the others are inLinkedPanel, unticked (a hint says so);/relatedhasfileon segmentation entries. e2e with two files. -
Pen strokes with the mask brush (user: "drawing / dragging with the pen doesn't work for segmentations"): an Apple Pencil is two pointers for OpenSeadragon (hovering id, touching id) and its
canvas-dragevents carry the position of the hovering one, so the brush painted a dab at the touch-down point and nothing more (the polygon editor was safe: it reads pointer events itself).SegmentationTool(single viewer) and thePaneof the three-plane view now take the stroke's points from the touching pointer's ownpointermoveevents (coalesced events too: no gaps in a quick stroke) and end it on itspointerup/pointercancel;canvas-dragonly stops the image from moving. e2e:annotate.mjsandseg3d.mjshave the hover-then-touch sequence (fail without the fix, 0 / 481 px against 4,6xx px). Mouse, touch and a single-id pen were already fine. e2e on a throw-away database (so that a working scratch DB stays):TARGET_DB=exact_rust_e2e SQL_DATABASE=exact_rust_e2e scripts/restore-backup.sh; reference/seed-users.sh; exact-cli migrate --confirm-db exact_rust_e2e; reference/mark-welcomed.sh, start a second server withSQL_DATABASE=exact_rust_e2e EXACT_LISTEN=127.0.0.1:8003, runnode e2e/<test>.mjs http://127.0.0.1:8003(RUST_DB=exact_rust_e2efor tests that write with psql;admin.mjsneedsEXACT_WELCOME_NOTICE);seed_test_users.pyaccepts that name now.annotate.mjsneeds a database no other e2e run has used. -
Not done: DICOM volumes (they need ImagePositionPatient/orientation), NIfTI label maps as linked files, the file name is the only check of "right scan" (the fit report only says whether labels lie inside the volume).
-
macOS note: after the system update to SDK 27 the Command Line Tools linker fails on
libSystem.tbd(arm64e.x1); build withSDKROOT=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk(asscripts/run-e2e.shdoes). -
Small tool palette for the 3D mask (user: "the segmentation panel takes up much too much space on a tablet"):
Segment3DPanelhas three views, remembered inlocalStorage(exact.seg3d.view):compact(default; floating palette 296 px wide: tools, + / −, undo / redo, brush size or wand tolerance),full(the whole window as before, with ⤡ to collapse) anddocked(the same quick tools in the top bar through a portal into.seg3d-dock-slotof theMprPageheader; falls back to compact while the slot does not exist).FloatingPanelgotactionsandbareprops and re-keeps itself inside the window when its size changes (ResizeObserver). Also − / + step buttons at the ends of each plane's slice slider. e2eseg3d.mjsstarts in the full view (init script) and tries collapse / dock / reload / undock / expand first. -
Maximize one plane of the three-plane view:
mpr-max-<plane>button at the top right of eachPane;MprPagekeeps all panes mounted and hides the others (hidden, grid.maxed= one cell) so viewers, masks and state survive; after the size change the pane dispatches a windowresize(OpenSeadragon only measures on that) and goes home. Checked by hand against the scratch server (sizes 500x319 -> 1008x646 -> back); no e2e yet. -
Download several images, rename an image:
GET /api/v2/images/download?ids=1,2,3(max 500; every image must be readable, 403 otherwise; ZIP built in a temp file like the MRXS/VSI download, files stored not deflated, repeated names get the id in front, images whose file is missing are listed inNOT_INCLUDED.txt;add_companionswas split out ofzip_companions); the image-set toolbar shows Download for a selection.POST /api/v2/images/{id}/rename {name}changesImage.name(the original file name) only,filename(what the viewers read) stays; a separate original file is renamed with it, andoriginal_imagedownload falls back to the viewer file when no file has the name. Same extension required, needsdelete_imagesin an unlocked set, 409 for z-stacks / frames / MRXS / VSI / server generated images and for a name another image of the set has. Right-click menu Rename… +RenameImageDialog. Tests intest_v2_image_menu.py; no browser test yet. -
Mouse wheel in the three-plane view (user: old EXACT zoomed on the wheel): the single-plane viewer already did (
classifyWheeltells a wheel from a track pad swipe / pinch, touch uses OpenSeadragon pointer gestures). The planes now zoom on the wheel by default, Shift + wheel steps slices; top-bar buttonwheel-mode("Wheel: zoom / slices",localStorage exact.mpr.wheel) swaps them (slices mode: wheel steps, Ctrl + wheel / pinch zooms). Track pad swipes still move, pinches still zoom. smoke.mjs covers both modes. -
Old EXACT navigation (per user, off by default):
exact_rust_user_flags.prefs jsonb(migration 0013,schema_readychecks the column) withGET/PUT /api/v2/me/preferences(legacy_navigation; whitelist + type check, self-service so read-only accounts may, impersonation reads only); frontendusePreferences. In the editor (EditorHost.legacyNavigation()) with the select tool: a mouse click on no annotation zooms 2x about the pointer (Shift: 0.5x), andstartMarqueereturns without a session so a drag on the background pans (Ctrl / Cmd framing stays). Toggle: Preferences page (see "User menu and Preferences" below; the ⊕ / Layout menu toggles were removed). Pen / touch taps never zoom. Not in the three-plane view (its wheel mode has its own switch). smoke.mjs covers it (the test image is small, so it liftsmaxZoomLevel); conformancetest_v2_preferences.py. -
User menu and Preferences (user: mouse/navigation mode belongs in the user settings): the user name in the top bar is a drop-down (
UserMenu: Preferences, User statistics, Sign out; the old Layout toggle and the viewer's ⊕ are gone)./preferences(PreferencesPage): email (PUT /api/v2/me/email, plausibility check), password (POST /api/v2/me/password: current password verified,validate_password, other sessions of the account deleted, the current one stays), passkeys (the existing/api/v2/auth/passkeys*API; new browser sideauth/webauthn.tsfor register and login, plus a "Sign in with a passkey" button on the login page), and the slide navigation as two radio cards (NavigationDemo: looping SVG/CSS animations, paused under reduced motion) writinglegacy_navigation.GET /api/v2/me/account,GET /api/v2/me/statistics(totals, per team, per day) inv2/account.rs; impersonating sessions may not change anything. Tests:test_v2_account.py, smoke.mjs (menu, statistics, email, wrong password, navigation switch). Not verified: a real passkey registration/login (needs a device authenticator and https or localhost with the configured RP id). -
Shortcuts aligned (user, 2026-11-04): the table is
viewer-core/shortcutTable.ts(what?shows; keep it in step withshortcuts.ts,GlobalShortcuts,MprPage). New:?help (GlobalShortcuts+ShortcutHelp, buttons in the top bar and the viewer bar),G Ppreferences,/and Ctrl/Cmd + F (the topmostinput[data-search], i.e. everySearchInput; Esc clears, second Esc leaves), viewerO(eventexact:overlay-toggletoOverlayControl, which remembers the opacity) andH(overview),,/.brush size byevent.code(Comma / Period, same place on EN and DE keyboards; polygon brush, pen brush, 2D mask tool, 3D tools;[ ]removed). Three planes:E/Qare next / previous image of the set (E no longer erases), Space tap toggles add / subtract (a drag with Space held pans and sendsexact:mpr-space-dragso no toggle follows),Oswitches the linked segmentation files off and on. Dropped by decision: B (push type to background), wheel-scales-annotation (never ported). Kept: A = one-click mode (not "force new"). Start page infinite scroll:ScrollEnd(IntersectionObserver, 600 px margin, remounted per page so it fires again) replaces "Show more" and the 60-set search cap; the team's cards are still fetched in one go, only drawing is incremental. Tests: shortcuts vitest, smoke.mjs (H, ?, /, Esc, Ctrl+F, G P), seg3d.mjs (Space). Not verified: scrolling with more than 48 sets (the scratch data has fewer), G P / ? on a German keyboard. -
Registration crosshair, auto overlay, image finder (user, 2026-11-04):
PointViewerkeeps an OSD overlay crosshair (reg-pending-cross, 10000 px lines, tracks pan/zoom) on the unpaired point until the partner is picked; markers are now a dot on the exact point with the number beside it. Preferenceauto_overlay(default false;v2/preferences.rs, Preferences page "Viewer"):OverlayControlpicks the only candidate once per image.ImageFinder(Ctrl/Cmd + F and/inViewerPageandMprPage; names via/api/v2/images?image_set=&fields=id,name, words all must match, Up / Down / Enter, search history) — the Modal focuses its close button first, so the finder focuses its own field in an effect.SearchInputnow also calls a caller'sonKeyDown. Tests: imageset.mjs (pending crosshair, auto overlay + O, finder), stale menu-order check fixed (Rename…). -
Screenshot, screening mode, selection, overscroll (user, 2026-11-05):
viewer-core/screenshot.tscomposites every canvas insideviewer.canvas(tiles with the adjustments' CSS filter, annotation / brush / mask layers; not the navigator) into a PNG download; camera buttonscreenshotin the viewer bar. Screening:viewer-core/screening.ts(pure:createMode,starts,moved,keyMove,tileAt,coverage,overlapOf; vitest) andScreeningPanel(FloatingPanel: settings, canvas map with thumbnail + green screened + magenta current, click to jump, ▲◀▶▼ for touch). Storage is the old tableimages_screeningmode(format kept:screening_tiles {i: {x_min,y_min,x_max,y_max,Screened}}, x_steps columns, row-major) but a tile is now the window itself and neighbours overlap (step = window x (1 - overlap), last window pushed back to the border; the overlap is recovered from the first two tiles; old cells read as overlap 0); old EXACT instead stored non-overlapping cells and widened them by a client constant. Own endpointGET/PUT /api/v2/images/{id}/screening(v2/screening.rs; upsert per image and user, partial PUT, image must be readable, no change while impersonating) because/api/v1/images/screening_modes/needs the Django model permission, which an ordinary member lacks. Keys as the old EXACT (W A S D step + mark the window left, I J K L step only) in a capture-phase listener that stops the viewer's tool keys while the panel is open; progress is flushed 3 s after a mark, on close and on unmount. Limit 40,000 windows (the whole mode is one JSON document), default overlap 20 % (remembered; the user first said 80 %, then corrected to 20 %), default window = current view if zoomed in, else 2000 x 1200. Selection:user-select: nonefor the viewer, tiles, cards, buttons and everything on(pointer: coarse); inputs stay selectable;-webkit-touch-callout: none. Overscroll:overscroll-behavior: containon modals, lists and body,nonewhile a viewer is shown (the finder list pulled the iPad page into a reload). Tests: screening vitest, smoke.mjs (PNG download, screening start / D / J / stored),test_v2_screening.py. Open question to the user: "overlap" is taken as the share of a window that the next window shows again (the old EXACT widened every cell by 10 % per side); at a high overlap a 100k-pixel slide needs many windows, hence the limit. Not verified: Safari / iPad (no selection, no pull-to-refresh), Apple Pencil in the map. -
Shortcuts on a keyboard (user, 2026-11-06): the
?dialog has tabs "On a keyboard" / "As a list".viewer-core/keyboardMap.tsholds the key rows of an English and a German keyboard (caps byKeyboardEvent.codewith legend / Shift legend per layout, so Y and Z swap, ß ü ö ä, Strg, Bild) and the bindings per situation (viewer,screening,volume,lists) and modifier layer (plain, Shift, Ctrl / ⌘): a binding is looked up byc:<code>(digits, comma, period, arrows, Space ...) ork:<character shown>(letters, + - = / ?), also by the character a key gives with Shift (the "?" on ß of the German layout, markedviaShift).KeyboardView(layout remembered inexact.kb.layout, default fromnavigator.language; holding Shift / Ctrl / ⌘ while the dialog is open switches the layer; colours by kind). This is a second hand-kept copy next toshortcutTable.ts:keyboardMap.test.tschecks that every viewer key shown is onematchShortcutreacts to (Page Up / Down, help, search, G P and the screening keys are handled elsewhere and exempt). Tests: keyboardMap vitest, smoke.mjs (Undo on Y position in German, Z in English, comma). Not shown: Alt layer (unused), function keys, numeric pad. -
Scissors and glue removed (user, 2026-11-06): of the old polygon operations only the knife stays (
PolyOp = "knife", key D, reshape menu "Split along a line"); the polygon brush (Shift / Alt + drag, menu "Add / Erase area", pen) covers adding and removing area. Keys S and G are free (G then P no longer collides with a tool). Removed fromeditor.ts(finishOp),Toolbox,shortcuts.ts, the help table and keyboard map, docs and the scissors blocks ofannotate.mjs(the knife blocks stay). Not rerun:annotate.mjs(needs a fresh scratch DB). -
A slide that cannot be read spun forever in the viewer (production image 15844, 2026-11-06): 17 of the 19
.vsiimages of one set answered 400 "The slide cannot be read." on/metadata, the DeepZoom descriptor and the thumbnail; the viewer's tile loading waits for the metadata (if (!meta.data) return), so it never started, never set an error and showed the opening spinner for good (plus react-query's three retries first). Fixes:ViewerPageshows the server's reason and a hint as soon as the metadata fails (unreadable; 4xx are not retried; an NRRD still gets its convert dialog);slides.rs::slide_err_atnames the cause when the file system tells it (file gone;.vsiwithout its_<name>_data folder, also in the scanner's spelling;.mrxswithout its folder), the answer still begins "The slide cannot be read". Reproduced locally: a lone.vsiopens in slideio as "invalid m_scene index: 0 from 0 scenes". Production cause not confirmed (no file system access): most likely those VSI files were stored without their data folders (the two readable ones of the set, 15855 and 15963, were probably uploaded as ZIPs). Also odd: 15855's database size is 59578 x 70485 but the server serves 211910 x 133604, the size of 15963 (..._rescan.vsi), so one of them may read the other's data. Tests:an_unreadable_slide_says_what_is_missing(unit), checked in a browser with a lone VSI (error after < 1 s). -
Server log for site admins (user, 2026-11-06):
exact-serveradds atracinglayer (ErrorLogLayer, filter WARN and up, independent ofRUST_LOG, which now filters only the console layer) that feedsexact_api::errorlog(global ring of 2000 entries, a message equal to one of the last 300 is counted and moved to the end instead of listed again, text capped at 2000 chars).GET / DELETE /api/v2/admin/log(v2/admin_log.rs, site admins,level=error,q,limit), Administration tab "Log" (LogAdmin.tsx: filter, errors only, 10 s refresh, copy, download, empty). Slide read failures now log "slide error, image N (path): reason" throughslide_err_at(image, path, e)(metadata, DeepZoom descriptor, thumbnail incl. the remembered failures). In memory only: a restart empties it (the console / journal has the history); a persisted log is the next step if wanted. Tests:errorlogunit test,test_v2_admin_log.py. -
Mouse / trackpad in the shortcut help; Ctrl / Cmd + drag moves the image while drawing (user, 2026-11-06): third tab of the
?dialog (PointerView, data inviewer-core/pointerMap.ts: per navigation setting x situation the gestures, each with the part of the device it uses, highlighted in an SVG mouse or trackpad on hover; starts withlegacy_navigation).editor.ts: with a draw or op tool, a press or click with Ctrl / Cmd returns without a session (navMod), so OpenSeadragon pans (like Shift / Space) and a click with it places nothing; the select tool keeps Ctrl / Cmd = frame. Tests: smoke.mjs (tab, device, highlight), annotate.mjs (Ctrl + drag pans while drawing, no annotation). The gesture text is hand-written next to the code (editor.ts,gestures.ts,MprPage), like the key tables. -
Coexistence with the Django EXACT on the same database and image store (user, 2026-11-05):
scripts/coexistence.shrestores the dump twice (one copy stays pristine), migrates the other withexact-cli, starts the unmodified Django (reference/settings_ref_coexist.py, folders from the environment) on :8001 and the Rust server on :18002 on one database, oneIMAGE_PATHand oneMEDIA_ROOT, and runstests/coexistence/(schema is additive, accounts / passwords / tokens, files and uploads both ways, annotations written by one and changed by the other, parallel writes from both, Django's ownmigrateon top of the Rust migration and back).SERVE=1only starts both.scripts/coexistence-preflight.shis the read-only check for production (ownership, hash schemes, connection room,TIME_ZONE, folders). Found and fixed:POST/PUT/PATCHon/api/v1/annotations/annotations/answered the expanded legacy shape instead of the flat serializer shape (compat/rest_writes.rs,serialize_manyvia the engine). Known differences listed indocs/coexistence.md(no token creation on Rust yet, Django accepts tokens of deactivated users, lenient PUT, no v1 image-set create).