A Rust and WebAssembly medical imaging core for the browser. Named after the three simple eyes a bee carries alongside its compound eyes. Pronounced oh-SELL-eye.
Status: early. The workspace, the workflow and the gates exist, and so now
do the differential oracle's two halves, the golden corpus, every build target,
the runtime tier resolution and the error model. Decision D7 still holds in
the narrow sense: the oracle has no Ocelli frame to judge. See
docs/sprints/CURRENT_SPRINT.md for the sprint and CLAUDE.md for what
exists in the order it matters.
cornerstone3D is the mature open-source imaging engine in this space, it is MIT licensed, and Ocelli owes it a great deal. We read it, we learn from it, and we measure ourselves against it deliberately rather than incidentally.
It is our reference oracle. Every frame Ocelli renders is diffed against the frame cornerstone3D renders from the same study, within a written per-modality tolerance, before it can merge. A library that can serve as a correctness reference for another implementation is a library that got a great many hard details right, and reproducing them is most of the work here.
Ocelli is a different set of engineering trade-offs, not a verdict on that one: a Rust core so the arithmetic is checked by the type system, WebGPU so compute is available, and bounded GPU residency so memory stops being a function of series size. Those trade-offs cost a new API and a migration, which is a real price and one worth being honest about.
The shell is TypeScript on the main thread: DOM, pointer events, the SVG annotation layer, tool interaction state, framework bindings, DICOMweb fetch. The core is Rust in workers: parsing, decode, the LUT chain, geometry, rendering through wgpu.
Between them, a deliberately narrow boundary carrying three things and nothing else: typed commands down, raw bytes into linear memory down, and events up through a ring buffer drained once per animation frame. Pixels never cross it. Decoded frames never become JavaScript objects on the way to the GPU, which is the main architectural gain and the reason the boundary is shaped the way it is.
Ocelli runs on two very different machines, and it is honest about which claims belong to which. GPU-less sessions are a first-class target, not a fallback: virtualised desktops without GPU passthrough, locked-down builds where acceleration is disabled by policy, and hosts whose driver is blocklisted are all common in clinical estates.
On a GPU client, for diagnostic reading and advanced visualisation:
- Bounded memory on unbounded data. GPU residency becomes a configured number rather than a function of series size.
- GPU compute. Essentially nobody in medical imaging is taking WebGPU's compute advantage, and it is not a modest one.
On a session with no GPU, for review, triage and conference, where a CPU rendering tier carries the work:
- Annotations that are DICOM SR natively, so every measurement is interoperable by construction rather than by export.
- Attestable rendering. A published, measured divergence bound and a reproducible output hash. A CPU renderer is the easiest target to make reproducible, because there is no driver stack underneath it.
- Live multi-user sessions, which is what a tumour board or a teaching session actually is.
On both: full parity, MPR, measurement, and real multi-monitor without a browser extension.
Every one of these is measurable, and the measurements are the marketing. Every benchmark we publish names its tier, because a number without the hardware it ran on is not reproducible and, on a mixed estate, is not honest either.
bin/ocelli.sh bench --compare-cornerstone --pseudo <local-root> measures the
local folder viewer against the pinned cornerstone3D page on the same inputs.
A real CT canvas comparison must pass before timings run. The native parser
and CPU canvas on one side and browser decoding and WebGL on the other do
different work. The record names those architectures, defaults, all processes,
inputs by digest, and cold and warm conditions. It makes no cost claim before
an equipped run. See the benchmark instrument.
crates/ 13 Rust crates. wasm-bindgen appears in exactly one
ocelli-core/ types, coordinate spaces, error model. No I/O
ocelli-dicom/ parse, metadata, providers
ocelli-codec/ decoder registry and adapters
ocelli-pixel/ the LUT chain, frame model
ocelli-volume/ volume assembly, reslicing
ocelli-cache/ budgeted LRU across encoded, decoded and GPU tiers
ocelli-compute/ WGSL compute kernels, sharing the renderer's device
ocelli-render/ wgpu device, render graph, shaders, backend tiers
ocelli-viewport/ viewport and scene model, camera, presentation state
ocelli-geom/ hit-testing, projection, measurement mathematics
ocelli-seg/ segmentation state and the three representations
ocelli-wasm/ ** the only wasm-bindgen crate **
ocelli-native/ desktop and server entry points. Phase 2 and 3, stubbed
packages/
core/ @ocelli/core, the TypeScript shell
react/ @ocelli/react
examples/
viewer-react/ the boundary demo, kept under the dev:boundary-demo script
example-server/ loopback helper for the boundary demo's frame-open, series-open and overlay panels
folder-viewer/ the showcase viewer, local series and DICOMweb sources
tools/
oracle/ the differential harness against cornerstone3D
bench/ the benchmark registry and its runners
spikes/ throwaway harnesses for the Appendix A gates
corpus/ manifest only. The data is not in git
docs/hld/ the authoritative Markdown specification
docs/sprints/ backlog, sprint plan, trackers
.claude/ the workflow: commands, skills, plans, reviews
.agents/skills/ generated Codex adapters for the same workflow
.opencode/commands/ generated OpenCode slash commands for the same workflow
git config core.hooksPath .githooks
npm ci
bin/ocelli.sh gate --floordocs/DEVELOPER_SETUP.md has the toolchain, the hooks and the gates.
The showcase is the folder viewer, examples/folder-viewer. It is one
ordinary HTML page with one native backend, served the same way by the npm
dev path and by cargo. From the repository root:
npm ci
npm run devnpm ci builds the viewer's styled dropdowns. Rebuild them with
npm run build -w @ocelli/folder-viewer before running the local viewer
browser gate after editing the browser module.
npm run dev runs bin/folder-viewer-dev.mjs. The launcher builds
@ocelli/core and the viewer's browser module, builds the native backend
with cargo, selects the binary from
cargo's compiler-artifact output rather than a hardcoded target path, and
runs it. A custom CARGO_TARGET_DIR is honoured. The backend prints its
address on stdout, an ephemeral port unless OCELLI_PORT is set, and opening
that address shows the viewer. SIGINT or SIGTERM to the launcher stops
the backend it started. The same page is served by
cargo run -p ocelli-folder-viewer, which is the native path. The two paths
share the choices the browser keeps only when they run on the same
OCELLI_PORT, because the browser scopes them to the address.
The page opens a local folder or the synthetic study, and with
OCELLI_VIEWER_STUDIES_SERVICE_URL and OCELLI_VIEWER_WADO_URI_URL set it
also offers a DICOMweb source, described under Start the local series viewer
below. The viewer draws the file's DICOM overlay planes and display shutter
with one toolbar toggle, described on the More page, on the local route and
on the remote display alike, and a remote frame names a refused mask or an
absent shutter value on screen. Each viewport draws with its own
interpolation mode, chosen per cell in the selector under the image:
Nearest is the default and shows stored texels, Linear blends the display
chain's own values at the drawn size, Reset keeps the mode, and the window
and zoom links never copy the choice. A waveform or a video frame refuses
by name, and a Linear target that would exceed the device pixel cap refuses
with its named sentence before any geometry changes, at the choice, the zoom
gesture, a linked zoom, one to one, a window drag or window choice and a
device pixel ratio change alike, each keeping the committed mode and the
last usable frame: the ratio change keeps the kept frame laid out at the
zoom its label names, a refused window keeps the drawn window the corner
names, and the sentence leaves the status line when the refusal no longer
holds. The canvas lays out at the drawn target's exact device-size extent
so the browser adds no second filter, except while a ratio refusal holds,
when the kept frame keeps the extent it was drawn at and each target pixel
shows as a square of device pixels whose side is the new ratio over the
ratio the kept frame was drawn at, until the refusal clears.
While Linear is
selected the magnify lens refuses with its own sentence, because its
sampling is nearest only, and shows again on the return to Nearest. The
selector hides in an MPR mode, because the volume worker draws the plane,
and Stack shows it again with the cell's committed mode. The Use
book the viewer
serves at /use and the More page at /more
carry the user-facing detail.
The earlier React Vite demo, examples/viewer-react, package
@ocelli/example-viewer, is kept under its own script and is not the
showcase:
npm run dev:boundary-demoThe demo page loads the wasm module, so build it first when it is missing:
bin/ocelli.sh wasmOpen http://localhost:5173. Vite prints that address when the server is ready.
The script is bin/example-dev.sh, which also starts
ocelli-example-server on 127.0.0.1. The helper
prints only its base URL. The Frame open
section posts to it through Vite.
The synthetic button asks the helper to map stored 50 through LINEAR_EXACT
centre 100 and width 200, then shows the display value and the padding count.
The Series section posts three synthetic objects, or a multipart body of files
you choose, and shows each display group, its order, its timing and Loop or
Bounce. The Overlay section posts the synthetic 4 by 4 and shows whether image
pixel (1, 1) is set and whether the shutter hides it. The Interpolation
section posts the 2 by 2 fixture and shows 138.75 for linear and the
nearest corner for nearest. A file you choose is
posted and discarded. It is not written into this
repository. The header reads core not built until the page worker loads
the wasm module.
bin/ocelli.sh wasm writes the module to crates/ocelli-wasm/pkg. That
directory is a build artefact and is not committed, so a clean clone still
opens with the header on core not built. In npm run dev:boundary-demo,
after that build, reload the page. The worker loads the module, and the header reads
core ready only after that load succeeds. The build alone does not flip
the header. The module a
published consumer gets is @ocelli/wasm, which npm pack stages from this
build with the decode module, the two third-party files and a build id
naming the HEAD the modules were built from, the tree of the staged index,
and whether the working tree had unstaged tracked changes. The packages gate
refuses a build id recorded with unstaged tracked changes, or one that does
not name the index it was staged from.
A built dist of the example serves from a static host's document root, and
not from a subpath. vite.config.ts leaves Vite's default base of /, so
the emitted index.html references its assets at absolute /assets/ URLs
and a host serving the dist below its root cannot resolve them.
npm run build -w @ocelli/example-viewer emits examples/viewer-react/dist
and resolves @ocelli/core and @ocelli/react from their built
packages/*/dist. The viewer's own build script is vite build alone, so
those dists come from npm run build, which must run first. A plain static
server over that directory at its root reads
core ready like npm run dev:boundary-demo does. The dist does not pick up a module
built later. vite build reads crates/ocelli-wasm/pkg once, when the
build starts, so the package must exist before that build. A dist built
without it keeps the external /@fs import of the pkg-absent build, and
its header stays core not built on every host until the dist is rebuilt
with the package present.
An embedding page that loads the Ocelli worker and the wasm module needs one header on every response, the worker script included:
Content-Security-Policy: default-src 'none'; script-src 'self' 'wasm-unsafe-eval'; worker-src 'self'; connect-src 'self'
In Chromium the worker's policy comes from its own response and not from the
page's, so a header on the HTML document alone leaves the worker
unrestricted, and a header on the worker alone without 'wasm-unsafe-eval'
breaks the compile. Send the same header on every response. The folder viewer's image page sets connect-src to 'self' plus the studies service origin configured at startup, while Use and More keep the self-only policy, and IPv6 literal hosts are refused at startup because browsers do not match them in connect-src.
worker-src 'self' is an explicit pin rather than a requirement, because
the worker is also allowed through the fallback to script-src 'self': the
pin keeps a later widening of script-src from widening worker construction
with it.
A DICOMweb service on another origin is added to connect-src:
Content-Security-Policy: default-src 'none'; script-src 'self' 'wasm-unsafe-eval'; worker-src 'self'; connect-src 'self' https://pacs.example
No blob:, no data:, no 'unsafe-eval', and no COOP or COEP. Ocelli needs
no SharedArrayBuffer (decision D5 in the decision log) and constructs
workers from URLs only, so an openDecodePool factory should too. A worker
constructed from blob: or data: inherits the page policy and breaks
under it, and loosening the page for it weakens every script on the page.
The probe that measures the header against the built example, and each directive's minimality:
bin/ocelli.sh wasm
npm run build
npm run build -w @ocelli/example-viewer
node examples/viewer-react/csp-probe.mjsThe probe first exercises the unmodified built dist as a genuine positive on
a real plain static HTTP server bound to localhost, then serves the built
example and the built wasm package for the remaining policy cases through
Playwright routes on invented origins, so those cases bind no port and start
no server. The workspace build needs the built @ocelli/core and
@ocelli/react, which npm run build creates, and the dist serves at the
host's document root, as above. The policy exists once in
examples/viewer-react/src/csp-policy.ts. Its test checks marked policy
blocks in this document, docs/lld/typescript-packaging.md and the Use page.
Each block contains exactly one expected header, inside a Markdown text fence
or an HTML pre element.
The local folder viewer serves each of its three pages under a separate hash
policy. It hashes the inline script, import map and style text from its embedded
pages at first use, so rebuilding after a page edit also updates the hashes.
The page needs no 'wasm-unsafe-eval'. Ordinary image decoding runs in the
local process. The video worker loads its own wasm module under its own
response policy.
Run its release-browser probe with node examples/folder-viewer/csp-probe.mjs
after building the library with npm run build.
The page mounts one stack viewport. It is the showcase, so a library behaviour is finished only when this page has a control for it. To open a folder of DICOM files on this machine, use the local series page below.
examples/folder-viewer lists series from a folder you choose and shows them
in up to nine viewports, from 1 by 1 to 3 by 3. Each viewport has its own
series, image, zoom, pan and window, and Link can make the others follow the
outlined one's scroll, window and zoom. The preview registers all six decoder
families of ocelli-codec. It opens the monochrome frames of eighteen of the
nineteen image transfer syntaxes: the seventeen with a registered decoder and
Deflated Explicit VR Little Endian, whose whole data set parse_part10
inflates before the raw decoder reads it. The registry also knows the sixteen
video transfer syntaxes. The folder viewer plays H.264 and supported HEVC
streams in MP4 or MPEG-TS. Frame N is the stream table's sample N. The
macOS viewer can use VideoToolbox hardware decoding, including HEVC Main
10 on supported hardware, and keeps its decoded planes in the local
process. The portable viewer route uses a browser worker's
VideoDecoder to supply I420, NV12 or I420P10 planes. Both routes use
ocelli-pixel for conversion, preview, readout and measurements.
Unsupported decoders, output formats and colour declarations have named
refusals. A local MPEG-2 file, in MP4, MPEG-TS, a program stream, a bare PES
or an elementary stream, plays in the folder viewer through F-242's decoder,
written in Rust from ITU-T H.262 and run in the local process, so no browser
decoder is involved. An MP4 whose container colour box contradicts its
MPEG-2 stream, and a colour MPEG-2 file of odd visible size, are refused by
name. The decoder's own refusals are named too: a profile other than Main,
a level identification above High, 4:2:2 or 4:4:4 chroma, a
sequence_scalable_extension, a size above its level's bound, and a corrupt
slice, which is refused with the last good frame kept. A MONOCHROME2
MPEG-2 file displays in the folder viewer: the page adopts its
one-channel reply and draws the Y plane through the monochrome chain.
@ocelli/core decodes
MPEG-2 through the separate MPEG-2 module, built by bin/ocelli.sh wasm-mpeg2: an MPEG-2 instance or DICOMweb input is opened with that
MPEG-2 build as its moduleUrl, and an extracted MPEG-2 stream is opened
with it as the mpeg2ModuleUrl option. A MONOCHROME2 MPEG-2 instance
plays in @ocelli/core, and its readValue and regionStatistics
queries are refused as unavailable. A raw stream open has no instance
declarations, so it is treated as YBR_PARTIAL_420 and its photometric
reads so. Open a MONOCHROME2 file
as an instance to draw its Y plane. Safari runtime and
video timing and memory acceptance remain unperformed. JPEG XL JPEG Recompression is the
only image one refused for every frame. Supported colour frames draw through the
library colour stage. A JPEG-LS frame whose LSE preset asks for a MAXVAL,
RESET or threshold the decoder does not apply is refused rather than drawn,
and so is a JPEG-LS scan that runs out of data or carries padding beyond its
final byte after its last sample. A damaged scan that reads as a valid scan
of another image cannot be detected by any decoder. Compressed files whose Basic Offset Table is empty open as PS3.5
A.4 requires, single-frame and multi-frame, including multi-frame JPEG,
JPEG-LS and JPEG 2000 files whose frames span several Fragments, which are
split at their codestream start and end markers. The viewer also opens a
waveform file of one of the five admitted ECG storage classes as a drawn ECG
signal, locally and from the DICOMweb source, with its own channel, grid,
amplitude and caliper controls, and a recording over the total-sample bound is
refused by name. It listens on this
machine only.
cargo run --release -p ocelli-folder-viewerDisplaying a fetched DICOMweb instance draws it through the browser decode and render workers, and that remote path needs the two wasm builds and the library build on disk beside the native backend: npm run build -w @ocelli/core builds the leaf modules the workers import, bin/ocelli.sh wasm builds the render module into crates/ocelli-wasm/pkg, and bin/ocelli.sh wasm-decode builds the decode module into crates/ocelli-wasm/pkg-decode. The viewer serves them under /lib/ocelli-core/, /lib/ocelli-wasm/ and /lib/ocelli-wasm-decode/. A module build that is not on disk answers the worker's request with X-Ocelli-Error: wasm and the build command that provides it, and a missing library build answers X-Ocelli-Error: library with npm run build -w @ocelli/core in the message.
With OCELLI_VIEWER_STUDIES_SERVICE_URL and OCELLI_VIEWER_WADO_URI_URL set to absolute http or https URLs, the viewer shows a DICOMweb source that searches studies, series and instances and fetches one selected instance the native backend parses and validates. Display draws the fetched remote instance in the active cell through the browser decode and render workers, and the local study, its marks, documents and checks stay as they are. Choosing a local source cancels a pending remote request and releases a staged body, so a late remote reply cannot claim the local image is unchanged. The remote panel itself returns to its idle line. With neither value set the viewer runs local only, the remote panel stays hidden, and the native DICOMweb POST routes are refused. Setting only one value, or an invalid value, stops startup with a fixed message that does not echo the value.
The debug build is about ten times slower on a window step. Each file is posted once while the process holds it, and posted again after eviction or a restart. OCELLI_CACHE_MIB sets that cache in mebibytes and the default is 256. A multiframe in which any frame's window comes from a per-frame functional group also keeps every frame's inspect reply, so the page can ask for a frame's window list by file id after the posted bytes are dropped. The parts no frame changes are kept once. No other file keeps one. This pool is outside OCELLI_CACHE_MIB, is charged at the bytes it holds, stays under a fixed 16 MiB across every file, and GET /held reports it as kept. Replies that would pass that cap after the files holding nothing are dropped are not kept, and that file's /inspect by id answers 410 once its bytes are gone. A forget drops a file's replies, and so does a file the cache has evicted, when it is next asked for. The folder viewer keeps at most four request bodies at once, which is the coefficient of S_max in the resident set bound, and ordinary image decoding runs on two threads, which is P in that bound. Ordinary image previews decode on those threads, one that carries the file's bytes included, and a decode permit ends with its decode, so a client that stops reading holds no permit. A request body is freed on the thread that allocated it. A decoded frame's sample buffer that leaves the cache is parked on a free list keyed by its exact byte length when cached bytes plus free bytes still fit the budget, and is freed otherwise. That list is inside the same 256 MiB budget, and the cache evicts to make room for a frame or for a free buffer. A decode takes a parked buffer of its length when there is one. When no free buffer has the length and a held file's frame does not fit beside the cached and free bytes, its decode takes the samples of the least recently used cached frame of that length only when no reply is still reading that frame, and allocates otherwise. A preview that carries the file's bytes never evicts and never takes a cached frame's samples, because its frame is not stored. At most two automatic series windows are computed at once, each holding up to 4 MiB outside OCELLI_CACHE_MIB while it runs, and a monochrome image that stores no window computes its own automatic window in one pool of up to 4 MiB on a decode thread, so series rounds and per-image decodes hold at most four pools at once, which is the bound's term 2 * P * 4 MiB, and a third series window waits for one of them to finish. Every grey byte the folder viewer holds counts against one fixed cap of 17,400,000 bytes, which is the bound's grey term P * N_max, with N_max the 3000 by 2900 frame the bound is stated for. A reply's grey counts from the moment its render is admitted until it is written. Each decode thread keeps at most one written grey to render into next, and that grey counts for as long as it is kept. A decode thread frees the grey it kept while any preview waits for room, and before it renders a grey less than half that size. A frame of more than 17,400,000 pixels, whose grey alone is over the cap, draws alone. Its grey is admitted only when no other grey is held, and while it is held no other grey is admitted, so grey bytes stay within the larger of the cap and that one frame. Its decode thread frees that grey after the write and does not keep it. Previews that wait for room are served in the order they first waited. A waiting preview is admitted only when every preview that waited before it has been admitted or has stopped waiting, and only when its grey fits. A preview that fits is admitted at once only when no preview waits, so it cannot pass one that waited first. No frame is refused for its size below the preview library's limit of 67,108,864 pixels. The resident bound is stated for frames within the design size. A frame over the design size can raise resident memory above that bound. Measured on the release binary with a synthetic 4740 by 5928 frame, the preview answered 200 with 28,098,720 grey bytes in 49.8 ms decoded and 25.5 ms cached. A smaller preview waited while that grey was held and was served 3.8 ms after it was released. Two such previews read together peaked at 28,098,720 grey bytes, one frame. With two clients previewing two such frames in a loop and reading every reply, twenty 512 by 512 previews sent among them all answered 200, the slowest in 42.0 ms. A preview whose grey does not fit waits for room for up to the 60 second write timeout, and answers 503 busy if none comes. A whole reply must be written within that timeout. GET /held reports grey, every grey byte under the cap, and grey_replies, the part held by replies not yet written. A page that abandons a request closes its connection, which releases its grey at once, within a millisecond when measured. A client that keeps a connection open without reading holds its grey until the write timeout, measured at 60.0 seconds. When such clients fill the cap, other previews wait up to the write timeout and then answer 503 busy. Measured with twenty such clients, five of six later previews answered 503 busy at 60.0 seconds and one was served at 58.95 seconds, when a stalled write timed out. While body-form previews wait, a file post can wait as long, because each of up to four waiting previews keeps its request body slot. Measured with four waiting, a file post waited 58.99 seconds. The folder viewer binary uses mimalloc as its global allocator. The pin is exact in the workspace manifest. No other crate does.
Opening another folder or the synthetic study tells the process to forget the folder the page left. The page sends that folder's file ids to POST /forget, and the process drops each posted file and every decoded frame of it, so GET /held then counts only the folder now open. A reply for the folder left that arrives late does not post its file again. A decode already running for a forgotten file stores nothing. Its request is still answered, with 410 Gone when its render had to wait for grey room, or 503 if that wait runs out. Each page load sends a random token with every file it posts, and leaving the page sends one short beacon naming that token, so the process forgets every file that page posted and no other page's. A list of ids would not do, because Chromium allows only 64 KiB of beacons in flight at once. A page the browser restores from the back/forward cache posts nothing between that beacon and its return. On the persisted pageshow it re-opens the folder or synthetic study it last began reading, re-posting the File objects it kept from that open, exactly as a fresh open of the same list would, so the largest series is drawn and marks, selection, frame and window start afresh. A file the browser refuses to read after the page was away, such as one rewritten on disk, is counted in the status line among the files that could not be read. The page is served with Cache-Control: no-store, which Chromium may treat as a reason not to keep it, and a real restore was not observed: the browser case dispatches the two events itself. A forget that fails is not retried, and the cache budget, which OCELLI_CACHE_MIB sets, and the 16 MiB reply pool still bound what the process holds.
Choosing the same folder again reads its files again, and every grey the page keeps is keyed by the file object that folder choice gave it, never by the file's name, size or time. The series list's thumbnails are keyed by series and drawn again on every open. A file rewritten on disk after the folder was opened is found when the window regains focus, when the page becomes visible again, when a series is selected or when another viewport becomes active. The page then reads one byte of each file of the active series, one at a time, and a file the browser refuses to read is forgotten by the process and shown as "This file changed or was removed on disk after the folder was opened. Open the folder again to see it." In Four images the sentence is in that file's tile and the other tiles still draw. The window the series was drawn at stays. A changed file never recomputes it and never contributes to it, a reply that would carry its old bytes is thrown away and the window is asked again without it, and the window reflects the files as read during this open, so it may differ from a reopen, where opening the folder again computes it again from the files as they are then. The status line counts such files in the active series. A modification time that moved counts as a change even when the bytes are the same. Three limits hold. A rewrite that keeps the file's modification time is not detected, and the page keeps showing the bytes it already holds until the folder is opened again. A change is noticed at the next focus, return to the page, series selection or change of active viewport, not as it happens. Only Chromium was measured, and other browsers may behave differently.
The process prints one line, the page URL, and nothing else. It has the form
http://127.0.0.1:12345/. The port is chosen at startup unless
OCELLI_PORT names a fixed one. 0 also means chosen at startup. A fixed
port keeps one bookmarkable address, and a second copy then fails to bind
instead of starting beside the first. A value that is not a port number,
including an empty one, stops the process with an error. Open that exact URL in
Chrome or Edge. The Folder control is a directory picker.
OCELLI_PORT=8742 cargo run --release -p ocelli-folder-viewer- Choose Folder and pick a directory. The browser reads the files. Leave them where they are. Do not copy them into this repository.
- The left column has one row per Series Instance UID. A row shows the series number, the modality, the description and the image count. A file with no Series Instance UID keeps its own row.
- Select a row. The outlined viewport shows the first image and keeps it.
The arrow keys move one image in the outlined viewport. A wheel without
Ctrl moves one image in the viewport under the pointer after about 40
pixels of travel, and makes that viewport the outlined one, as a press in
it does. While the Rotate planar tool is chosen, the wheel turns the
viewport under the pointer instead, 10 degrees a step with scroll down
adding 10, after the same travel. The scrubber reads
n / totalfor the outlined viewport. Coming back to a series restores the image you left. With one viewport there is no outline. - Drag a series row onto a viewport to open it there, or click or
double-click a row to open it in the outlined viewport. A click on the
series already open there starts its window and fit again, and a drop of
that series keeps its view. Opening a folder
puts the series with the most images in the first viewport and the next
series in list order into each other viewport. A viewport with no series
reads "Drag a series here." Link opens three switches, Scroll, Window and
Zoom, which are off at load and act on every visible viewport as one set,
with the outlined viewport as the source. Scroll moves each other viewport
to its image nearest the source image's position, when both series share a
Frame of Reference UID and the cosine of the angle between their planes
is above 0.9, which is under about 26 degrees. Window copies the source's
window when a W/L drag ends, on a window row, on a region window and on
Reset. File windows copy the source's centre and width as numbers and
the VOI function as a name, so linked series with different window
lists show the same values.
A copied region window reads
manualin the target, since its region was measured on the source image. Reset copies the source's own file window or its series' automatic window. A source that cannot name a usable window leaves the other viewports as they are. A preset is sent only where the local process offers it, which is CT. Windows copy between images of the same kind, monochrome or colour, and keep each target's inversion. A colour Reset copies its file state. Zoom copies the source's zoom over each viewport's own fit, and pan is not copied. A click on a series row is a new load and copies nothing. Reference lines, on at load, draw a yellow line in each other viewport where the source image's plane cuts it, when both share a Frame of Reference UID and the planes are not parallel. The local process chooses the image and computes the line, throughocelli_viewport::link. Slice intersection and Overlay grid are per-viewport toggles beside Reference lines and act on the outlined viewport: the first draws the plane cut of every other shown viewport's displayed image in it, the second draws where each image of the other shown viewports' series cuts it, both computed by the local process through the same link route, and both refuse by name on a remote frame, on a waveform and in an MPR mode. A parallel pair draws nothing and the reply names the reason beside the toggled viewport's notices, and so does a source the page never sends: a cell a remote frame owns, or a cell in an MPR mode whose plane the volume worker draws. When every candidate source of a request is excluded, the request sends nothing and the exclusions still name themselves beside the toggled viewport's notices. When the overlay grid's source lines would pass the count one link body carries, the count sentence goes to the status line and clears when the grid's lines are no longer left out, including when no further request is built. - Space plays and pauses. Playback loops. Between two frames of one
multi-frame file, Play waits that file's Frame Time
(0018,1063)in milliseconds, PS3.3 C.7.6.5, and the line beside the FPS control gives it, as inFrame Time 40 ms, 25 per second, from the file. The FPS control is disabled then, and Use the slider hands the rate back without stopping play. A step to another file, and any file without a usable Frame Time, uses the FPS control, and the line says why: a Frame Time Vector, which this page does not play, a frame rate with no Frame Time, no Frame Time, cine timing that is not usable, which is a Frame Time, Frame Time Vector, Recommended Display Frame Rate or Cine Rate the local process refuses, or a file whose frames this page could not read. A step that takes longer than the interval is not skipped, so play can run slower than the file asks, and the line says so. The FPS control runs from 1 to 30 and starts at 10 by default. - The toolbar is a row of icons. Point at one to see its name, its key and
what it does. The groups are the navigation tools (Scroll, Pan, Zoom,
W/L, Region window
Y), the drawing tools (Length, AngleQ, CobbJ, BidirectionalB, Rectangle, Ellipse, Freeform, ArrowU, ProbeX, Circle ROI, Height, Spline ROI, Livewire contour, ETDRS grid, Drag probe, Eraser, Sculptor and Text, whose eight new controls have no key yet), the view (Invert, Rotate 90, Rotate planar, Flip horizontal, Flip vertical), the display (Pointer cross, Magnifier, Magnify lens with its factor list, Corners, Orientation letters), the layout (LayoutG, which opens a 3 by 3 picker, Four imagesShift G, which shows four neighbouring images in the outlined viewport, the MPR preset, which has no key, Link, Reference lines, Slice intersection, Overlay grid and Linked cursor, which have no key), and Key image, Headers, Fit, One to one, Reset and Full screen. Rotate planar and Magnify lens take no key. Key image flags the image, and Save marks writes the flags as a Key Object Selection. The view, window, Fit, Reset, Key image and Headers act on the outlined viewport. The MPR preset sets the 3 by 1 layout and shows the outlined cell's series as its three orthogonal planes, axial, sagittal and coronal, three cells over one volume the page stages with a worker. Nothing of that volume module loads until a cell enters an MPR mode. Each cell that holds a series carries a Plane control at its bottom edge with the choices Stack, Acquired, Axial, Sagittal, Coronal and Oblique, where Oblique shows two angle inputs, and choosing a mode there enters or leaves that MPR mode. Beside the Plane control, a Thickness number input in millimetres and a Blend select with Composite, MIP, MinIP and Average, shown in every MPR mode and hidden in Stack. A thickness above 0 draws a slab of that thickness through the slab pass and 0 draws the plane, the blend switches the held slab without recomputing or restaging it, the input's maximum names the largest thickness the cell's next request admits, and a refusal names its reason and restores the whole drawn state: the Thickness input, the Blend select and the still position go back to the drawn slab's values, and to thickness 0 and the shown plane when no slab is held, the drawn picture itself unchanged. A refusal also shows the drawn picture at the planar turn it was displayed at, so a mode switch's reset of the turn is undone and a turn the reader gave the shown picture is kept, even one given while the switch was pending, and in Acquired the stack image the plane showed comes back. A refusal of a request the cell has already replaced with a newer one restores nothing, because the newer request's reply sets the state when it lands. While a slab is drawn the probe refuses by name and the readout names the refusal, at thickness 0 the probe is the plane's, and the linked cursor answers at the plane the slab is centred on. In an MPR mode the cell's picture is the plane the worker draws into that cell's own canvas: Scroll, the scrubber, the arrow keys and the wheel move the plane's still position, the W/L tool windows the plane, Invert inverts it, and the pointer readout names the value and patient position under the pointer from the worker's probe. The Rotate planar tool turns the drawn plane in display, through the cell's transform and without a re-reslice, and while it is chosen the wheel turns the plane 10 degrees a step instead of moving it. Entering an MPR mode starts the plane unturned, whatever rotation the stack view held, a plane change inside a mode starts the new plane unturned the same way, and Stack returns the cell to its acquired-frame view with the stack view's own rotation. The turn is fitted through the turned extents the stack route fits its own turned picture with, so a quarter turn of a non-square plane stays whole in its cell. A window preset from the list applies to the plane, the list's file window rows refuse because a plane has no file window, and the cell's orientation letters and its corner window line are the plane's own, from the worker's facts reply. The other per-frame tools refuse by name and keep the plane: the drawing and measure tools, the region window, the histogram, Key image and marks, the overlay planes and display shutter toggle, Rotate 90 and the flips, slice intersection, the overlay grid and the viewport links. Slice intersection or the overlay grid held before the entry does not follow the cell in: the held toggles clear with their named sentence, "The slice intersection and the overlay grid are not available in an MPR mode, because the volume worker draws the cell's plane." The interpolation selector hides in an MPR mode, because the volume worker draws the plane, and Stack shows it again with the cell's committed mode. Stack returns the cell to its acquired-frame view, where those tools work again. A series a DICOMweb frame owns refuses MPR with "MPR is not available for a DICOMweb series yet.", because the remote route is not available yet. The mouse profile picks the tool that starts active, Scroll or W/L, and choosing a profile also switches the current tool to that one, from a drawing tool too. The right column holds the window list, the marks and the mouse and key lists. The icons at either end of the top bar, or the[and]keys, hide and show the two side columns. On a CT the window list starts with the three presets, Soft tissue, Lung and Bone, and then lists the file's own windows in file order, each named by its Window Center & Width Explanation, orWindow nwhen it has none. On any other image it lists the file's windows only. A monochrome image that stores no window lists one row,Auto window, after the presets on a CT, and it chooses the series' automatic window. The keys1to9choose rows 1 to 9,0stays Fit and\shows one stored pixel on one device pixel, which needs the rotation at a multiple of 90 degrees. Each VOI LUT Sequence item is listed as a row that cannot be chosen, because this preview does not apply one, and while a file has one its other rows cannot be chosen either. A multiframe whose windows change per frame lists the shown frame's own, asked for by file id, which the process answers from the replies it keeps for such a file after the posted bytes are dropped. Until that list arrives the frame is drawn at its own first usable window, then at the chosen one. A file is read as changing per frame when any frame's window comes from its own per-frame group, not only frame 0's. Each tile of Four images follows the same rule. While its frame's list is on its way its label gives the WW and WL it is drawn at, and once the list arrives it is drawn at the chosen window and its label names it. A tile of a file that stores no window gives its numbers and saysAuto window, as the corner does. A file opens at its first window that has both a centre and a width, and a slot missing either is listed as a row that cannot be chosen. A slice keeps its window, and a file window past the next image's list shows that image's first usable one. A series change and Reset return to the first usable file window, or to the automatic window when the monochrome file stores none. The bottom right corner names the window shown: the preset, the file window's name,Auto window,Auto window, this image,regionormanual. A linked copy of a region window readsmanualin the receiving viewport. A window row or a region window that the local process refuses leaves the image and the window as they were and puts the reason in the sentence line. The same rule now holds for a W/L drag, for Reset's window part and for a linked copy: each commits only when its own reply arrives, so a refused window change leaves the state and the shown image alone. Region window is a drag of a rectangle. Wait for a selected image to finish loading before drawing the rectangle. If another image loads during a drag, draw a fresh rectangle after it appears. On monochrome images the window runs from the least to the greatest modality value whose pixel centre is inside it, with padding left out. On colour images it uses Rec. 709 luminance of the display RGB over the rectangle and applies that one window to all three channels. An applied ICC profile is part of that RGB, so profiled colour can differ from cornerstone3D 5.8.2, which applies no profile. The function already shown is kept. The local process finds the two values throughPOST /region, andwindowRegionfrom@ocelli/coremakes the window. The process serves the builtpackages/core/distunder/lib/, so runnpm run build -w @ocelli/corebefore starting the viewer, or the region window reads unavailable and says so. The library's SR modules import dcmjs, whichnpm ciinstalls, and the region window names that when it is the part that is missing. Its centre is the middle of that span. cornerstone3D 5.8.2'sWindowLevelRegionToolcentres on the mean and keeps a width of at least 10, so the two can give different windows. - The left button uses the active tool in every profile. The Profile
control in the MOUSE section of the right column chooses what the other
buttons do. Ocelli, the default, starts on Scroll, with the middle button
zooming from the place you pressed and the right button panning. Scroll on
left starts on Scroll, with the middle button dragging the window and the
right button zooming. Window on left starts on W/L, with the middle button
panning and the right button zooming. Control with the left button pans in
all three. The browser keeps the profile for this address, so a kept
profile returns after a restart only on the same
OCELLI_PORT. What this browser keeps is five validated choices: the mouse profile, the play rate, whether each of the two side columns is hidden and a default window preset. The browser also holds the library's log level setting, which dcmjs writes when the page loads the library, and nothing else. The Default preset control in the WINDOW section starts every newly opened series at that preset when the image is a CT whose preset rows are choosable, once per series load. Reset returns the file's own window and the preset does not come back until the next series load. An MR, a colour image or a file with a VOI LUT Sequence takes no preset, and a stored preset the viewer does not offer is named in the line under the image and skipped. Any other choice the browser did not keep, or a stored choice it could not use, is named in that line too, never applied quietly. A profile change the browser did not keep is named in the MOUSE section. The choices live beside the four keys an older version of the viewer reads, which stay current, so an older binary keeps working beside this one. A choice made in an older binary between two runs of the new one is lost, because the document wins on the next load and the two stores give no order to detect that. A pinch, or Ctrl with the wheel, zooms at the pointer. A sideways swipe does not change the image. Zoom keeps the image aspect ratio. One to one, the\key or its toolbar button, shows one stored pixel on one device pixel for the local images the page draws, with the factor computed in the page from the device pixel ratio and the corner line reading Zoom 1:1, or Zoom 1:1 rows on a frame whose pixels are not square, where the rows are exact and the columns are resampled. In the mode the canvas is a whole CSS pixel box sized up past its cell, the smallest whole multiple of the ratio's whole CSS pixel step that covers the cell plus one step for the alignment shift, so its size times the device pixel ratio is whole, its backing has that many device pixels, and the stored pixels are written into the backing one to one, as cornerstone3D 5.8.2 sizes its backing at the device resolution. The cell's own clipping cuts the box's excess, so no part of the cell inside the frame is left unpainted. On square pixels the mode is verified byte for byte in screenshots under the emulated ratios 1, 1.25, 1.5 and 2 in the pinned Chromium, which is DevTools device scale emulation and not a physical display. Pan keeps the mode, and zooming reaches the scale and leaves it like any other, so on a frame wider than its cell zooming out from one to one goes below it. A stored frame smaller than the device pixel ratio keeps its view, and the corner line shows the reason while that holds. Opening another series and Reset return to fit. The viewport clips an image that is larger than the pane. - Headers shows the data set as stored, in the columns Tag, VR, Name, VM and
Value. A row inside a sequence item carries its path, such as
(0008,1140)[1].(0008,1155)with items counted from 0, and is indented by its depth. VM counts values per PS3.5 6.4, so a sequence, a binary value and an LT are one value and an empty value is none. A private element has no keyword and shows its private creator in Name. Pixel Data and a binary value over 64 bytes show a byte count. A value over 1024 characters ends in[truncated], past 4096 rows a final row says further elements were left out, sequences show in full to the parser's 64 levels, and a declared character set that is not applied gets a notice row. The filter keeps the rows whose tag, VR, name, creator or value holds its text, the counter says which match of how many is highlighted, and Enter, Shift+Enter, Previous and Next move between matches. Over a displayed DICOMweb frame the sheet lists the staged instance's rows, walked by the decode worker from the parse it kept at staging, so nothing is fetched again, Checks says conformance checks run on local files, and the count on the Headers button hides. The sheet names a refusal by its reason. After any other failure, a worker fault or a Show local while the rows are still coming, it says to display again and reopen the sheet. A worker fault returns the cell to its local image. A count on the Headers button is the number of findings in the shown file's conformance report, whether the file is drawn or shows a fault such as a colour or refused frame, and the sheet lists them in Checks above the table, each with its tag, rule and the DICOM section it cites, under the sentence that the report checks only the rules it lists and is not a statement that the file conforms to DICOM. It checks values against PS3.5 Table 6.2-1, value multiplicity for the attributes it lists, and Type 1, 1C, 2 and 2C presence for seven PS3.3 modules on CR, CT, MR and PET Image Storage. A finding names a length, a count or a character position and never a value. A finding never stops an image from showing. The page asks for a file's report 300 ms after that file is first drawn or shows its fault, so scrolling asks for nothing, and keeps it until the next open. Opening the sheet asks for its file at once. The checks neednpm run buildfirst, and without it Checks says so and the count stays hidden. Compare is a collapsed section in the Headers sheet, and its two pickers choose the files. It compares the metadata of two local instances row by row, and four copy controls put the results on the clipboard: Copy tag copies the selected row's tag, Copy A value and Copy B value copy the selected row's value on that side, and Copy comparison copies the whole comparison as tab-separated lines with the columns path, result, A value and B value. A refused comparison offers nothing to copy. Copy deliberately places patient attributes on the system clipboard, readable by other applications, only on user click. A copy from Copy tag, Copy A value or Copy B value is the text the table shows: a long value is clipped at 1024 characters with " [truncated]", and bulk data shows as a byte count, so a copy is not the full stored value, and Copy comparison carries the same shown values. Copy comparison writes a backslash as two backslashes and a tab, carriage return or line feed as\t,\ror\n, so every value keeps its own column. The comparison is refused as incomplete when either side carries a notice row, a row cap or a depth cap, or an out-of-order stream, which holds after a video is prepared as a video source too. File meta is not compared. Pixel Data is never compared, and a remote frame is refused by name. Private creators align by creator, and a creator reserved more than once in one container keys like a creator-less block, so its declarations and data elements pair by raw address and an identical pair reads equal. Trailing padding is not a difference, and a leading space still counts. DS and IS values compare as their stored text, not as numbers. The corners show the current image's labels, with a person name in family, given order and a date as year-month-day. They also show the birth date, sex, age, study time, institution, slice location and thickness, kVp, mAs, TR and TE when the file has them. On an enhanced multiframe CT or MR the thickness, kVp, mAs, TR and TE lines show the shown frame's own values from its functional groups, with mAs from Exposure in mAs and TE on an enhanced MR from Effective Echo Time, and a field the file does not carry leaves its line out. A Multi-energy CT whose CT X-Ray Details Sequence carries several items leaves the kVp line out by design, and one whose CT Exposure Sequence carries several items leaves the mAs line out. Where a classic top-level attribute and a group value both exist, the top-level attribute wins when it has a value the viewer can use. With no Patient's Age, the age is worked out from the birth date at the study date. Edge letters show the patient direction from Image Orientation (Patient), or from Patient Orientation on an image without it, such as a projection radiograph, and hide while the picture is flipped or rotated. An image whose Anatomical Orientation Type isQUADRUPEDshows no letters. A scale bar shows above the window line when the file gives a spacing a length can use, from that same spacing, and saysat the detectorwhen that spacing is at the detector: Imager Pixel Spacing with no magnification factor, alone or with a Pixel Spacing equal to it. It hides with the corners and in Four images. The pointer cross shows the column, the row and the modality value of the pixel under it with its unit: HU on a CT whose Rescale Type is HU, or is absent on a CT that is not multi-energy,unspecifiedfor Rescale TypeUS, the Units attribute on a PET,paddingfor a padded sample, andnot heldfor a file the process could not hold. A pixel hidden by the display shutter still reports its image value, because masking hides presentation and is not redaction. The cross, its readout and the magnifier hide when the picture moves under a still pointer, after a zoom, a fit, a turn or flip, Four images, a layout change, a side panel, full screen or a window resize, and come back with the next pointer move. In Four images only the magnifier comes back, because the cross is drawn in the single view only. During a pan or zoom drag they stay with the pointer. When the image under a still pointer changes, by a key, the wheel or Play, the magnifier shows the new image, or hides. - Every number on a mark comes from the local process, and the page prints
its text. Probe asks
POST /value, and every other mark asksPOST /measure. Length, Angle, Cobb and Bidirectional are in millimetres from Pixel Spacing, or from Imager Pixel Spacing divided by the Estimated Radiographic Magnification Factor, in millimetres at the detector from Imager Pixel Spacing alone, and in pixels when the file gives no spacing. PS3.3 10.7.1.1 says a Pixel Spacing that has not been corrected for magnification has the same values as the Imager Pixel Spacing, so a Pixel Spacing equal to it takes the imager path: it is divided by the factor when the file has one and is millimetres at the detector when it has none. On that path, and on Imager Pixel Spacing alone, a factor that is present but cannot be used is not measured. Beside a Pixel Spacing that differs from the Imager Pixel Spacing, the factor is not read and the Pixel Spacing decides. An angle without spacing says square pixels are assumed. A Pixel Spacing that is present but not usable is not measured. Angle is a drag along the first arm to the vertex and a click at the end of the second arm. Cobb is two drags, one per line, and reports the acute angle between them. Bidirectional is a drag along the long axis, with a short axis placed across its middle at half its length, and reports both lengths as drawn. Rectangle, Ellipse and Freeform report the area of the drawn shape and the mean, SD, minimum and maximum of the modality values whose pixel centres are inside it. Padding pixels are left out. A freeform that crosses or touches itself is not measured, and neither is one of more than 4000 points. Freeform keeps an outline of three or more points. Probe is a click and reports the modality value of that pixel. Arrow is a drag from the tail to the head with an optional note. Text places a note. Click, type, and press Enter to keep it. Escape drops the draft. Leaving the field keeps the note. Size and colour can be changed after the note exists. The marks list shows each mark with its numbers,measuringwhile the reply is on its way, or the reason it was not measured. Click a mark to select it. A selected mark shows a handle on each of its points. Drag a handle to move that point, and the mark is measured again on release. While a drawing tool is active, drag moves the whole mark. Press Delete, Backspace or Remove to remove it. A moved mark stays inside its image. The circle reports the radius, the area and the statistics of the index-space ellipse the spacing gives. The height reports the row span between its two points, in millimetres or pixels, not the distance. The spline evaluates the closed ring through three or more control points over the Catmull-Rom, Linear, B-spline and Cardinal types. Shift click adds a control point. To delete a control point, use Ctrl-click on Linux or Cmd-click on macOS. The deletion chord works on the control point itself. The livewire searches the cheapest path between anchors over the window the viewport shows and closes on a double click, Enter, or a click within ten canvas pixels of the first anchor. The ETDRS grid needs isotropic Pixel Spacing or Imager Pixel Spacing, and its pointer readout names the region, with the nasal or temporal side when the image's Image Laterality, or else its Laterality, names one. The drag probe shows the column, row and modality value while held and keeps nothing. The eraser removes every mark on the image whose drawn geometry comes within ten screen pixels of the click, in one undo step, and Undo brings it back. The sculptor pushes a freehand or spline mark to the edge of the cursor circle, the circle sized from the view and the distance to the contour, and the mark is measured again. A sculpt drag that starts with no freehand or spline mark within the cursor circle does nothing, a deliberate difference from cornerstone3D 5.8.2, whose sculptor takes the nearest freehand mark at any distance, so a stray drag across empty image would reshape a distant contour, the quietly wrong edit this project avoids. Every pushed point is clamped to the image extent, so a push cannot move a freehand contour outside the picture and the label measures the image for a freehand contour, while for a spline the pushed control points stay inside the picture and the curve between them may leave it. The eraser, the sculptor, Undo and Redo need the builtpackages/core/distlike the region window, and say so when it is missing. Undo and Redo sit on buttons beside Save marks and ride Ctrl+Z and Ctrl+Shift+Z, Cmd+Z and Cmd+Shift+Z on a Mac, walking the mark history of the open folder fifty entries deep, and each button is disabled while its stack is empty. Opening another folder clears the history with the marks. Save marks downloads one DICOM SR TID 1500 file per study for the Freeform, Rectangle, Ellipse, Length, Text, Circle, Height, Cobb, Bidirectional, Arrow, Probe, Spline and Livewire marks, and one Key Object Selection file per study for the key images. Nothing is written into the opened folder. Put the downloaded files in the folder and open it again to see the marks on their images, or read them into the open study with Load marks. A length or height is saved with its number in mm when its spacing is a patient spacing, and without one at the detector or in pixels. The same gate withholds the circle's perimeter, area and radius, and a bidirectional whose axes it withholds is not saved, while the circle's statistics are modality values and save regardless. A spline or livewire saves its evaluated ring, closed, and comes back as a freeform. The angle is not saved, because no cited plain angle measurement code exists, and the status line names that. The ETDRS grid and the drag probe are not saved either. Colour and text size are not saved. One study's SR holds fewer than 4000 content items, about 700 marks, and a larger save writes nothing and says so. Deleting every mark of a study is saved too, as an SR with no marks. A folder's marks are saved from that folder. Opening another folder clears the marks and every remembered document, replacement and identifier. Load marks adds documents to the open folder. A save replaces reports placed whole in that folder, including those read through Load marks, and reports skipped because a later document replaces them. A Save writes nothing for a study, and says so, when no mark or key image changed since the folder was opened or its last save, unless an earlier read into this folder hid a report. An SR is placed only in part when one of its marks is not placed or a group of it cannot be read, most often because the folder lacks an image a mark is on. Such an SR is not replaced by a save from this page, so its marks come back even after they were deleted, and the status line says so. A later SR that names it as replaced does replace it. Unflagging the last key image of a study is not saved, because a Key Object Selection must name at least one image, so the earlier file still flags its images, and the status line says so. Save marks and Load marks neednpm run buildfirst. - The tools panel has a HISTOGRAM section. It shows the current frame's distribution of modality values, PS3.3 C.11.1 stage 1, over 256 fixed bins, drawn as bars, with the active window drawn over them as a band. The caption names the shape, the image position the page already shows, the unit, the least and greatest value, the bin width, the count and, when pixels were left out, the padding tally. The graph follows the scrubber, the active cell, the series selection and a selected Rectangle, Ellipse or Freeform mark, whose distribution runs over that mark's own samples. A window change moves the band. Nothing but a frame or mark change moves the bars. A colour image, a frame or region where every sample is a padding value, an image above the 4096 by 4096 sample walk limit, a local waveform, and a remote frame each refuse by name in the note line, and a remote frame sends no request at all. A local waveform also clears the panel, and its note reads "Not available on a waveform." The panel asks once the frame has settled, after scrubbing, and never asks twice for the same frame and mark.
The top of the page offers Synthetic study or Folder. Synthetic study is a generated CT and it is not a patient. More names library behaviour this image does not draw. Use explains the JavaScript, React and Rust calls.
A file that is not a Part 10 DICOM object is skipped and counted. An Enhanced SR, Comprehensive SR, Comprehensive 3D SR or Key Object Selection file is read as a document and is not listed as a series. Any other SR, such as an X-Ray Radiation Dose SR, still shows as a series. Each mark in a document goes on the image whose SOP Instance UID and frame it names, and the status line counts what was not placed. Supported colour frames draw in the image, thumbnails and tiles. Their window starts at width 256 and centre 128. Window drag and invert act on each channel. Colour has no presets or file windows. The pointer readout shows R, G and B before the window, and a region reports area and separate R, G and B statistics. A matrix or tone-curve ICC profile is applied before the colour window. Other profile kinds keep device RGB and carry a sentence naming the profile not applied. A colour shape this build cannot draw names its reason. A Modality LUT Sequence, or a VOI LUT Sequence without both a window center and a window width, stays on a fixed error sentence on monochrome frames. The local process refuses a window preset on an image whose Modality is not CT, whatever the page sends. A series of more than 65536 images is not linked: it does not scroll with the others and has no reference line.
A series whose images store no window is drawn at one automatic window for
the whole series, from the 1st to the 99th percentile of modality values over
up to 16 images spread through it, each through its own rescale, with stored
zero and the Pixel Padding Value left out, and the corner says Auto window.
Opening such a series decodes those images before its first image is drawn,
so scrolling keeps the same window and the same relative brightness. A window
in the file is always used as it is. A thumbnail, and a series whose window
the local process refuses, use each image's own automatic window, and the
corner then says Auto window, this image. A file found changed after the
folder was opened never recomputes the window the series was drawn at and
never contributes to it, a reply that would carry its old bytes is thrown
away and the window is asked again without it, and the window reflects the
files as read during this open, so it may differ from a reopen, where
opening the folder again computes it again from the files as they are then. The percentiles are nearest rank,
the function is LINEAR_EXACT, and ocelli_pixel::AutoWindowPool computes
them. cornerstone3D 5.8.2 takes each image's own minimum and maximum instead,
so this is not a parity row.
The page HTML is compiled into the binary. After a change under
examples/folder-viewer, build again and start that new process.
cargo build --release -p ocelli-folder-viewerRust crates own parsing and pixel arithmetic. Image codecs decode in Rust,
H.264 and HEVC video use the browser's VideoDecoder in a worker, and
MPEG-2 decodes in Rust, in @ocelli/core inside the separate MPEG-2
module. The TypeScript
packages are the shell a page embeds. Nothing here is published yet. Depend on
the crates by path inside this workspace.
[dependencies]
ocelli-core = { path = "crates/ocelli-core" }
ocelli-dicom = { path = "crates/ocelli-dicom" }
ocelli-codec = { path = "crates/ocelli-codec" }
ocelli-pixel = { path = "crates/ocelli-pixel" }ocelli_dicom::parse_part10 reads one Part 10 byte string. Encapsulated frame
bytes go to the decoder registry in ocelli-codec. Stored samples go through
ocelli_pixel::LutChain only. That type runs the modality stage, the VOI
stage and the presentation stage, in DICOM PS3.3 C.11 order. A second window
formula is a defect.
The sixteen video transfer syntaxes of PS3.6 Table A-1 are known to the
registry and report Capability::Stream. No frame of a video decodes alone,
so ocelli_codec::Registry::decode refuses a video syntax with
CodecError::StreamSyntax. ocelli_dicom::video_stream takes the projected
metadata, the Pixel Data element and the transfer syntax UID, refuses a
non-video syntax by name, and extracts one video's stream as the concatenation
of the encapsulated Pixel Data fragments after the Basic Offset Table,
truncated to (7FE0,0003) when it is present with a value, an empty value
being the absent element, PS3.5 8.2, A.4 and 7.4.5.
ocelli_pixel::ColorTransform::map_video_planes converts the decoded 4:2:0
planes of a YBR_PARTIAL_420 object once, with the matrix and range the
stream's own colour description selects, PS3.5 8.2.8, and refuses a frame
whose Bits Stored disagrees with the planes' depth. The F-241 candidate's
loadVideo API loads a separate video wasm module into a worker. It accepts
an extracted stream, Part 10 instance bytes or a bounded WADO-URI/WADO-RS
instance retrieval. An MPEG-2 stream starts the worker with the separate
MPEG-2 module named by the mpeg2ModuleUrl option, and refuses by name when
that option is absent. That module is built by bin/ocelli.sh wasm-mpeg2
into pkg-mpeg2, beside the video module, and carries the Rust MPEG-2
decoder. The worker decodes by sample index, converts through
ocelli-pixel and publishes to its transferred canvas. VideoSource exposes
play, pause, rate, loop, frame range, exact frame selection, presentation,
raw RGB readout and region statistics. Its browser decoder and format limits
also apply to this library route. These source APIs do not close the remaining
browser and measurement acceptance work.
The ? below belongs in a function whose error type accepts both
ocelli_dicom::ParseError and ocelli_pixel::PixelError.
use ocelli_core::{Display, Stored};
use ocelli_dicom::parse_part10;
use ocelli_pixel::{
LutChain, ModalityTransform, PhotometricInterpretation, PresentationLutEvidence,
VoiFunction, VoiTransform,
};
let parsed = parse_part10(bytes)?;
let chain = LutChain::new(
ModalityTransform::new(None, Some(1.0), Some(0.0))?,
VoiTransform::new(
None,
&[100.0],
&[200.0],
0,
VoiFunction::LinearExact,
0.0,
255.0,
)?,
PhotometricInterpretation::Monochrome2,
PresentationLutEvidence::Absent,
)?;
let mut grey = [Display(0.0)];
chain.map_into(&[Stored(50.0)], &mut grey)?;
let _keep = parsed;wasm-bindgen appears only in ocelli-wasm. Pixels stay on the worker side of
that boundary. The shell sends typed commands down and drains one event ring
per animation frame.
The wasm session keeps committed frames in a cache whose budget the caller
sets, and the default is zero, which is off. setFrameBudget(wasm, bytes)
moves it. A commit that carries a content id with its stackIndex and
stackEpoch fills the cache, and a commit that carries a content id
without both is refused with InvalidValue and commits nothing.
frameResident and showResident read it back without the bytes crossing
the boundary again. Under a wrong epoch showResident returns false at any
index. Under the current epoch it answers only for the slice the viewport has
selected, another index throws the coded CommitRefused, and at the selected
index a miss or a stale entry returns false.
releaseSeries and releaseStudy release the named series, one
cache.released event per series that held frames, a series with nothing
cached emits no event, and a release that crosses a pressure band pushes
cache.pressure after cache.released. The displayed frame is outside the
cache and stays on screen through a release.
In a browser, use the workspace packages @ocelli/core, @ocelli/wasm and
@ocelli/react.
@ocelli/wasm is the module loadCore initialises, built by wasm-pack
from crates/ocelli-wasm. @ocelli/core peer-depends on it at the same
version, so install both at once. Load the module in a worker and pass the
initialiser to loadCore:
import init, * as wasm from "@ocelli/wasm";
import { loadCore } from "@ocelli/core";
await loadCore(async () => {
await init(); // fetches the .wasm beside the glue in a browser
wasm.install_panic_hook();
});@ocelli/wasm/decode is the module built without the renderer. The
@ocelli/wasm tarball carries a build id that records the git SHA of the
HEAD the modules were built from, the tree of the staged index, whether the
working tree had unstaged tracked changes when they were built, and the
digest of each module. The packages gate refuses a build id recorded with
unstaged tracked changes, or one that does not name the index it was staged
from.
@ocelli/core depends on dcmjs 0.52.2, which declares adm-zip 0.5.17 as a
runtime dependency. Nothing in @ocelli/core or in dcmjs's published files
loads adm-zip. gate packages checks that on every run. The check installs
the published tarballs outside the workspace, imports @ocelli/core, and
requires dcmjs, under a resolve hook that records ESM and CommonJS
resolutions on the main thread. It refuses a trace that does not record
dcmjs/build/dcmjs.es.js and dcmjs/build/dcmjs.js, a trace that records a
URL under the excepted package, and any other installed .js, .mjs or
.cjs file that names that package as a module specifier in any quote, with
or without a subpath, including a relative ../ or ../../ path. A load
whose specifier is built at run time in code the smoke run does not execute
on its main thread (for example a Worker or a child process, or a function
the import never calls) is outside the check. A consumer's own npm audit
also lists @ocelli/core and @ocelli/react as high, because they depend
on dcmjs. A project that needs a clean audit can add
"overrides": { "adm-zip": "0.6.1" } to its own root package.json, which
is safe because nothing calls it.
OcelliViewport renders a host div. Pass session={null} when you have no
wasm session. The frame pump starts only after the session's memory is the
built module. examples/viewer-react/src/App.tsx is the boundary demo's
mount, served by npm run dev:boundary-demo.
import { viewportId } from "@ocelli/core";
import { OcelliViewport } from "@ocelli/react";
import type { OcelliSession } from "@ocelli/react";
const session: OcelliSession | null = null;
export function Viewer() {
return (
<OcelliViewport id="stack-1" viewport={viewportId(1)} session={session} />
);
}DicomwebClient in @ocelli/core is the QIDO-RS, WADO-RS and WADO-URI client.
Construct it with a studies service URL, a WADO-URI URL, fetch, wasm memory
and a response sink. Every request is sent with the fetch cache mode from the
optional cache option. The default is "no-cache", which revalidates a
stored response with the server before using it, so a re-processed object is
never served from the browser's HTTP cache without asking. "no-store",
"reload" and "default" are accepted. "force-cache" and
"only-if-cached" can serve a stored response that is stale, and are refused
at construction with DicomwebError code InvalidRequest. A proxy or a
service worker between the browser and the server is outside what a cache
mode controls. A transport failure keeps a status code. It does not keep
the URL, the headers or the body. An option the client does not know is refused
with OcelliError code UnknownOption, which names it.
The dangerous defect here is not the crash, it is the pixel that is quietly wrong. Quietly wrong code is produced by reasonable people making locally reasonable choices.
The worked example, from the specification: at the centre of a soft-tissue CT
window, the two DICOM VOI LUT functions LINEAR and LINEAR_EXACT differ by
0.32 of 255. Invisible to a human comparing screenshots. Immediate to a pixel
diff.
That is why the differential oracle is built before the code it validates, why every function doing pixel arithmetic needs a fixture with hand-computed values citing its DICOM section, and why the tolerance policy is written once and held rather than tuned per failure.
One workflow, three hosts. Claude Code reads .claude/commands/, Codex reads
the generated adapters in .agents/skills/, and OpenCode reads those as skills
and its slash commands from the generated .opencode/commands/. They are the
same instructions and a gate refuses them when they drift.
/design F-XXX -> /start-feature -> /implement-feature
-> /microscope -> /verify -> /complete-feature
/run-sprint drives a whole sprint. /close-sprint ends one. /release is
the only command that publishes anything. .claude/WORKFLOW.md is the law of
the project.
CONTRIBUTING.md, and please read it before writing code. Two rules there are
absolute rather than careful: no patient data ever enters this repository, and
the source-provenance policy governs which third-party projects may be read at
all, not merely depended on.
Security issues, including a wrong pixel value or wrong geometry, go through
SECURITY.md.
Dual-licensed under MIT or Apache-2.0 at your option, texts in
LICENSE-MIT and LICENSE-APACHE. The copyright holder is Tensorbee Limited.
NOTICE carries that line. Third-party notices are in THIRD_PARTY_NOTICES.
THIRD_PARTY_LICENSES carries the full licence texts of the Rust crates and
the Rust standard library compiled into the wasm modules the @ocelli/wasm
package ships and the native binaries, and python3 scripts/licence_check.py --write binaries regenerates
it after a change to Cargo.lock or the channel in rust-toolchain.toml.
The @ocelli/wasm tarball carries both third-party files beside the module,
so a consumer of the published package receives them without this repository.
The native build that ships is Metal-free, deviation D-33, so the objc2
crates generated from Apple SDK headers are not compiled into it and
bin/ocelli.sh gate native refuses any that reach the shipped graph.
Permissive on purpose: integrators embed an engine like this inside closed products, and a disclosure obligation ends that conversation before it starts.