Repository navigation
Releases
v0.3.4-beta
[0.3.4-beta] — 2026-11-26
Added
- clinfer serves a FHIR R4 capability document at
/processors/Questionnaire. AsearchsetBundle holds one Questionnaire
per enabled model. The output is R4-conformant: extension URLs are absolute
canonical URLs, the provider is a complex extension (name/vendor/version),
Coding.systemis a URI (urn:clarus:scheme:<designator>) rather than a
bare private scheme designator, andBundle.link.url/entry.fullUrlare
absolute URLs built from the request's Host header. fhir.extension_baseis configurable (default: the public repository).
The extension StructureDefinitions ship underclinfer/fhir/StructureDefinition/
and the listener mirrors them at/fhir/StructureDefinition/*.json(the
bytes are compiled in), so offline validators can dereference the canonical
URLs without reaching the public copy.- The model procedure code selects the model. The derived rule carries the
procedure_codeCode Value as its workitem-code key;clahe.yamluses the
local99CLARUScodeIMG-CLAHEinstead of a SNOMED procedure. - clinfer runs out of the box with a license-free CLAHE task. The default
configuration enables a built-in CLAHE filter (99CLARUSIMG-CLAHE) that
needs no model weights, carries no license encumbrance, and runs on modest
hardware, so a fresh install exercises the full UPS-RS AI loop immediately.
The result is stored as a DERIVED series - a second, contrast-enhanced copy
beside the source, which is never modified. To clinfer, CLAHE and a
heavyweight inference model are the same contract: swap the model file to
plug in a detector or segmentation model.
Fixed
- clinfer reads the UPS input study from Referenced Request Sequence
(0040,A370). A conformant Unified Procedure Step carries the study it
relates to in Referenced Request Sequence (PS3.4 CC.2.5-3, Type 1); clinfer
previously read only Input Information Sequence (0040,4021), so workitems
whose study rode in (0040,A370) were cancelled with "no rule matched". The
input study is now read from (0040,A370) first, with (0040,4021) as a
fallback. - clinfer reads LongCodeValue (0008,0119) as a CodeValue fallback. A code
sequence item that carries the long form instead of (0008,0100) now resolves
its code correctly.
Conformance
- Series-level QIDO returns the Study Instance UID. The JSON and XML
series writers now inject (0020,000D) from the study context on both the
scoped (/studies/{study}/series) and global (/series) routes, and an
explicitincludefield=0020000Dis no longer silently ignored. The Study
UID is not a Table 10.6.3-4 Series return key, so it is emitted as an
always-on serving attribute rather than consuming an includefield slot.
Clients that read it unguarded (dwv) no longer crash on a conformant server.
Server robustness
- Worklist, UPS-RS and Storage Commitment conformance hardened across
request handling, readiness state and the XML/JSON renderers. - STOW conformance: malformed or conflicting instances are rejected before
the batch is committed, and the commitment remainder paths are closed. - Data-movement workers publish only after verify-before-publish: a
partially written object is never exposed as stored. - PHI masking, the I/O fault seam, lock scoping and the FFI boundary
tightened. - Log durability, shutdown ordering and validation conformance aligned
with the standard.
DIMSE bridge
- C-MOVE retrieves PDF and Segmentation instances again. The C-MOVE
pre-flight misread the query result and failed, so the association proposal
overflowed its presentation-context limit and dropped these SOP classes;
the pre-flight now consumes the query page as produced, and all negotiated
classes are proposed. - C-STORE conflict handling: the bridge answers a store association only
after the origin has decided the STOW, and the server rejects a second
patient stored under the same study within a single request, not only
across requests. - The conformance statement now documents the bridge SCP transfer-syntax
list, duplicate-stored semantics, and the server media types.
v0.3.3-beta
UPS-RS / Task Manager interoperability
- Wildcard-prefix label filters now deliver notifications. A filtered
Worklist Subscription carryingfilter=00741204=PREFIX*(Procedure Step
Label) previously accepted the request but delivered no N-EVENT; it now
matches wildcard prefixes per PS3.4 C.2.2.2, while exact-label filters stay
exact (PREFIXnever matchesPREFIX_MORE). Reported by OctoFHIR. - Scheduled Procedure Step Start DateTime (0040,4005) matching now honours
the full DT grammar: UTC offsets after truncated values, fractional seconds,
day/month/hour/minute period semantics, negative offsets at every precision,
and a configurable deployment offset ([ups] local_utc_offset) for
offset-free values compared in the local frame.
Durability
- Uniform crash-safety discipline across the manifest, workitem (UPS),
commitment, and MWL/MPPS stores: file data and directory entries are
persisted before an operation reports success, deletion fsyncs its parent
directory, and encoded bytes are validated before the atomic rename replaces
a good manifest.
Conformance
- QIDO DA/TM range matching (StudyTime, PPS Start Date/Time) with inclusive
open bounds. - QIDO study/instance emission now includes Patient ID Issuer (0010,0021) and
Number Of Frames (0028,0008); series answers carry the captured PPS and
Request attributes in both JSON and XML. - MPPS performed-series references are nested under Referenced Image Sequence
(0008,1140) and carry the Series Instance UID. - Native DICOM Model XML uses the schema element names
NamePrefix/
NameSuffix; XML-1.0-forbidden control characters are dropped. - UID-list matching for SOPClassUID;
2.25UIDs derive from the full 128-bit
UUID.
Memory safety
- Manifest reads no longer mmap a file whose immutability the server cannot
guarantee: the mmap entry points areunsafebehind a typed
TrustedManifestDir, and arbitrary paths use a copy-based read.
Correctness and robustness
- Manifest cache abort/reader-block invalidation, retention sweep TOCTOU fixed
with a UID stripe lock, HTTPConnectionheader flag accumulation, head
terminator checked before the read deadline, prefetch byte order, torn-tail
boundaries in the modality index and recovery, manifest attribute merge
order, and encode size bounds. - IOCM hide-only rejections (113037/113038) can no longer be re-accepted by a
later STOW.
Testing
- Allocation-measurement tests isolated from parallel test interference.
v0.3.2-beta
STOW-RS ingest is up to ~28% faster on HDD-backed storage: the body write now goes through a 1 MiB buffered writer instead of 64 KiB chunks (A/B median 5.26 s -> 3.78 s for an 824 MiB instance on a VMware virtual HDD). Durability contract unchanged.
Full changelog: CHANGELOG.md
v0.3.1-beta
release: sync source v0.3.1-beta
v0.3.0-beta
release: sync source v0.3.0-beta
OHIF UPS-RS demo study v0.1 (chest + knee)
Two de-identified demo studies (PatientID XRV^DEMO) for the OHIF UPS-RS docker demo (docker-compose.ohif-demo.yml): chest Mass_62109.png.dcm (SC, LUNG - filter applies) and knee Knee_62109.png.dcm (DX, JPEG-LS, no body part - negative control). NOT FOR DIAGNOSTIC USE. File SHA-256: Mass ab4509bb58486ce7686a479ead52d89ac0436bdc8890be7488134933dbd27ad2, Knee fb4637fec699ed24a8fc2c2edd56af84cf3256b1905ff8239c952d349eea406e.
totalseg-demo v0.4
Clarus totalseg demo pack — run guide
A self-contained demo of an AI pipeline over DICOMweb: clarus (a tiny
DICOMweb PACS), clinfer (an inference sidecar), the ABI producer
scripts, and clmcp (a demo Task Requester).
NOT FOR DIAGNOSTIC USE. This is transport plus research models; no clinical
claim is made or implied.
What's new in v0.4
- DICOMweb MWL + MPPS (PS3.18 §14/§15):
/modality-scheduled-procedure-steps
(search-only worklist) and/modality-performed-procedure-steps/{uid}
(N-CREATE / N-SET / N-GET), behind[workflow] enabled = true, with
fuzzymatchingon the Person Name search keys. - Conformance improved. Clarus and clinfer conformance statements were
tightened during the Weasis UPS-RS interop work (AIW-I Task Requestor +
Watcher, dcm4chee-arc symmetry); UPS-RS search keys and wire behaviour now
match PS3.18 more precisely.
Before you start: these demo binaries are built with the
transcode
codec feature (JPEG-LS, JPEG Baseline/Lossless, JPEG 2000, RLE), so
compressed CT is decoded by the server on retrieve instead of passing
through still-compressed. Uncompressed CT (Explicit VR Little Endian) works
as before. See Requirements.
What you get
clarus(.exe)— one-file DICOMweb server (QIDO/WADO/STOW/UPS-RS)clinfer(.exe)— inference sidecar (claims workitems, runs producers,
writes results)clarus.conf— default server config (Clarus is Task Manager only)task_producer.conf— server config where Clarus also mints workitemsclinfer_demo.conf— sidecar config for the totalseg rule (minimal)clinfer.conf.example.en— the full annotated sidecar config (every option)abi/— the example producers (below)ABI-README.md— the producer contract (frames + manifest.json in,
result.json out)clmcp/— the demo Task Requester (agent/MCP REPL)https://github.com/clicker71/clarus-pacs/raw/main/images/totalseg_demo.png— the RTSTRUCT result in Weasishttps://github.com/clicker71/clarus-pacs/raw/main/images/screenshot-clmcp.png— the clmcp REPL in action
The two modes (pick one)
UPS-RS has three roles — the IHE AIW-I (AI Workflow for Imaging) actors:
Task Manager (always clarus), Task Performer (always clinfer), and
Task Requester — the role that can be anyone. The wire is standard
DICOMweb UPS-RS (PS3.18 §11). The pack ships two server configs that differ
in exactly one knob, task_producer:
| Config | task_producer |
Who creates workitems |
|---|---|---|
clarus.conf |
false |
external — clmcp, a modality, a RIS |
task_producer.conf |
true |
Clarus itself (auto-mint on STOW) |
Mode A — Clarus as Task Producer (no requester needed)
./clarus --config task_producer.conf
./clinfer --config clinfer_demo.conf
curl -X POST http://127.0.0.1:8024/dicomweb/studies \
-H "Content-Type: application/dicom" --data-binary @slice.dcm
STOW → Clarus mints a CT workitem → clinfer claims it → totalseg runs →
RTSTRUCT back. Open in Weasis.
Mode B — external Task Requester via clmcp
./clarus # clarus.conf is the default config
./clinfer --config clinfer_demo.conf
python clmcp/clmcp.py --chat
Push your own CT study first (STOW-RS, see Mode A), then in the REPL:
run totalsegmentator for <your patient>. clmcp creates the workitem over
standard UPS-RS (POST /workitems), exactly as a modality or a RIS would.
The configs are the guide
clarus.conf is deliberately self-documenting: every knob carries a comment
that says what it does, why the default is what it is, and when you would
change it. Read it top-to-bottom as the deployment/operation manual. The knobs
that matter for this demo are task_producer (above) and the workitem catalog
(the AI task vocabulary, read only when task_producer is on).
clinfer_demo.conf is the minimal totalseg wiring: models: entry, the rule
table, interpreter path, timeout. clinfer.conf.example.en documents every
option the sidecar accepts.
The ABI producer scripts (abi/)
Each script is an ordinary program: clinfer hands it a workdir
(manifest.json + frames/*.raw), it writes back one result.json, and
clinfer writes the DICOM object. A producer never sees DICOM — the contract
is ABI-README.md.
PR-openvino-detect.py— OpenVINO detector; boxes over every frame → PR
(presentation state).SR-llm.py— calls an OpenAI-compatible endpoint; returnssr.text→
SR (structured report).RTSTRUCT-CT-totalseg.py— TotalSegmentator (craniofacial structures) → RTSTRUCT.STL-mesh.py— the reference STL mesh producer (seg/stl bridge).SR-DX-SCOORD-torchxrayvision.py— chest X-ray classifier; 18 pathology probabilities → TID 1500
Enhanced SR measurements.
Also shipped: SEG-threshold.py (segmentation), RTSTRUCT-contours.py
(license-clean RTSTRUCT contours), DERIVED-clahe.py / DERIVED-upscale.py /
SR-opacity.py (image filters), SEG-DX-torchxrayvision.py / SR-DX-torchxrayvision-regions.py (X-ray
anatomy), manifest.example.json (input shape), requirements.txt.
TID 1500 in Weasis — known upstream bug. The SR measurement viewer
(Enhanced SR SCOORD) has two upstream display bugs we filed —
nroduit/Weasis #922 and
#923 — which the maintainer
took upstream and fixed as
#931 ("Refactor SR
rendering…", milestone 4.8.0). Until 4.8.0 ships, render TID 1500 results
with that caveat. TheRTSTRUCT-CT-totalseg.py→ RTSTRUCT contour path is unaffected
(verified in Weasis 4.7.2, RT tool).
Observing a run
Everything in the chain is observable without a debugger:
- Server log (
clarus.log+ stderr):UPS_EVENTlines name every state
transition (created → SCHEDULED → IN PROGRESS → COMPLETED);WADO_SERIES
shows the study fetch as one line per series (slices=626 of=626 failed=0);STOW_STUDYrecords the result stored back. - clinfer terminal: the claim, the producer launch, and the producer's
own stderr in real time (the sidecar forcesPYTHONUNBUFFERED=1, so a hung
or slow model is visible while it happens). /metrics(Prometheus text format on the server port): HTTP requests
labelled by handler, STOW duplicates/parse errors, and UPS push
delivered/retried/dropped counters.
The server log reads (one line per event; UIDs and numbers are illustrative):
2026/09/30 14:12:05 [INFO] UPS_EVENT workitem_uid=1.2.840.113619.6.412.1.20260930.1 previous_state=created new_state=SCHEDULED event_id=1
2026/09/30 14:12:06 [INFO] UPS_EVENT workitem_uid=1.2.840.113619.6.412.1.20260930.1 previous_state=SCHEDULED new_state=IN PROGRESS event_id=2
2026/09/30 14:13:11 [INFO] WADO_SERIES loaded study=1.2.840.113619.6.412.1.20260930 series=1.2.840.113619.6.412.1.20260930.2 slices=626 of=626 bytes=418600128 us=71204012 failed=0 user=clinfer ip=127.0.0.1
2026/09/30 14:17:48 [INFO] STOW_STUDY completed study=1.2.840.113619.6.412.1.20260930 slices=1 stored=1 idempotent=0 failed=0 conflicts=0 bytes=48216 us=1182407 user=clinfer ip=127.0.0.1
clmcp is a demo, not a product
clmcp exists to show one thing: the UPS Task Requester can be anything —
an agent/MCP front-end, a modality console, a RIS, or a viewer dropdown. clmcp
speaks only standard DICOMweb (Search → Create → wait over SSE). Replace it
with your own requester and nothing else changes; the wire is the same.
clmcp REPL — the MCP/agent Task Requester for Clarus. Five commands in one
window: an unknown task fails honestly with the known-task list; an unknown
patient is refused; an already-processed study answers "already done"
(idempotent, no re-run); a one-edit typo Салгалов resolves to patient
Солгалов via PS3.18 Levenshtein-1 fuzzymatching (not a wildcard) and
runs the full UPS-RS cycle — TotalSegmentator → RTSTRUCT → "Done"; a
modality check refuses chestai on a CT study and suggests the right task.
(Солгалов = the owner's own name, test data — no PHI leakage.)
The result in Weasis
Weasis 4.7.2 — the stored RTSTRUCT renders as contours under the RT tool:
MANDIBLE, TEETH_LOWER, TEETH_UPPER (structure set "totalseg-1", Jaw CT
Segmentation).
Requirements
- Compressed or uncompressed CT. The demo binaries are built with the
transcodecodec feature (JPEG-LS, JPEG Baseline/Lossless, JPEG 2000, RLE);
compressed input is decoded by the server on retrieve, so the producer
receives raw frames. Explicit VR Little Endian input works as before. - Windows x64 or Linux x64.
- Python 3.10+ with TotalSegmentator (
pip install TotalSegmentator);
weights ~2 GB into~/.totalsegmentator, pre-download once. - Weasis 4.7.2+ for RTSTRUCT contours; 4.7.3+ for large STOW exports (earlier
builds abort on the 15 sUrlReadTimeout). - The producers are operator-trusted programs (same trust domain as the
API key) — seeABI-README.md§1.
Your own model
Read ABI-README.md. A producer is any program reading the workdir and
writing result.json; add a models: entry and a rule in clinfer_demo.conf.
Done.
Weasis UPS-RS demo pack v0.1
Weasis UPS-RS demo pack
A reproducible demo of standard DICOMweb UPS-RS (PS3.18 11) end to end:
Weasis is the Task Requester, clinfer the Task Performer, and the
origin is either Clarus or dcm4chee-arc - the two are interchangeable,
and the same commands run against both. Two license-clean image filters are
shown:
- CLAHE - contrast-limited adaptive histogram equalisation (
abi/DERIVED-clahe.py). - Upscale - bicubic upscale x2, model-free (
abi/DERIVED-upscale.py).
NOT FOR DIAGNOSTIC USE. Transport plus demo filters; no clinical claim.
Where this demo is driven from
Three roles, and the driver is Weasis itself:
- Task Requester = Weasis, via the new
weasis-dicom-aiwmodule (the
UPS-RS Task Requester / Watcher candidate PR, Discussion #925; the module
name is the maintainer's, not-ai). It registers aupsGogo scope, so
the demo is started from a Weasis console command, not from a script. - Task Performer = clinfer, the engine this pack configures. It
subscribes to the origin, claims the workitem Weasis created, runs the
abi/DERIVED-*.pyscript, and stores the derived series back to the same
origin. - Task Manager (origin) = Clarus or dcm4chee-arc. It hosts the worklist
and stores the images. The two are interchangeable: the same commands run
against either.
The ups: verbs
--url is the DICOMweb root of the origin (Clarus or dcm4chee); --auth
names a saved authentication method in Weasis's user preferences by UID
(omit it for an open origin).
ups:search --url URL [--ae AE] [--auth UID] [--patient ID] [--accession ACC] STUDY_UID
ups:run --url URL --code SH --scheme DS [--meaning TEXT] [--patient ID]
[--accession ACC] [--instance SERIES/SOPCLASS/SOPINST]... STUDY_UID
ups:cancel --url URL [--ae AE] [--auth UID] [--reason TEXT] WORKITEM_UID
ups:watch --url URL [--ae AE] [--auth UID] [--timeout SEC] [--poll SEC] STUDY_UID
ups:outputs --url URL [--auth UID] WORKITEM_UID
ups:run creates the workitem unless the study already has a pending one
for the same code; --code and --scheme are both required, because a code
is identified by its value AND its designator. --instance is a
SERIES_UID/SOP_CLASS_UID/SOP_INSTANCE_UID triple, repeatable. ups:watch
follows the study's events over the origin's WebSocket notification channel
(--timeout in seconds, default 60, 0 waits forever). When the origin does
not service that channel, ups:watch falls back to polling the worklist with
UPS-RS Search every --poll seconds (default 2, 0 disables) and reports the
workitems whose state changed. Every verb prints a JSON body, so the caller
reads the result from the console rather than the screen.
For this pack (scheme 99CLARUS, code CXR-CLAHE / CXR-UPSCALE):
# Clarus
ups:run --url http://127.0.0.1:8024/dicomweb --code CXR-CLAHE --scheme 99CLARUS --meaning "CLAHE filter" <STUDY_UID>
ups:watch --url http://127.0.0.1:8024/dicomweb --timeout 0 <STUDY_UID>
ups:outputs --url http://127.0.0.1:8024/dicomweb <WORKITEM_UID>
# dcm4chee-arc (no notification channel; ups:watch falls back to polling)
ups:run --url http://127.0.0.1:8080/dcm4chee-arc/aets/DCM4CHEE/rs --code CXR-CLAHE --scheme 99CLARUS --meaning "CLAHE filter" <STUDY_UID>
ups:watch --url http://127.0.0.1:8080/dcm4chee-arc/aets/DCM4CHEE/rs --poll 2 --timeout 30 <STUDY_UID>
ups:outputs --url http://127.0.0.1:8080/dcm4chee-arc/aets/DCM4CHEE/rs <WORKITEM_UID>
Search is filtered server-side with the keys the maintainer set (PS3.4
Table CC.2.5-3): PatientID + ReferencedRequestSequence.AccessionNumber,
else ReferencedRequestSequence.StudyInstanceUID. ups:run fills the
Referenced Request Sequence on Create, so both filter paths work:
# Clarus
ups:search --url http://127.0.0.1:8024/dicomweb --patient XRV-DEMO7 <STUDY_UID>
# dcm4chee-arc
ups:search --url http://127.0.0.1:8080/dcm4chee-arc/aets/DCM4CHEE/rs --patient XRV-DEMO7 <STUDY_UID>
Both origins (Clarus and dcm4chee-arc) filter server-side by these keys.
Running it
Weasis 4.8.0-SNAPSHOT runs on Java 25. The whole ups: command is passed
to the launcher as ONE quoted argument (the $ prefix is part of the Gogo
command):
java -cp "weasis-launcher-4.8.0-SNAPSHOT.jar;org.apache.felix.framework-7.0.5.jar" \
org.weasis.launcher.AppLauncher '$ups:run ...'
--code and --scheme name the task in this pack's deployment vocabulary:
scheme 99CLARUS, codes CXR-CLAHE and CXR-UPSCALE (see Workitem codes
below). They are site configuration, not something read off the study. To
inspect what a study already has, ups:search lists its workitems:
# Clarus
$ups:search --url http://127.0.0.1:8024/dicomweb --patient XRV-DEMO7 1.2.826.0.1.3680043.8.498.42952727672363954171947692870286891467
# dcm4chee-arc
$ups:search --url http://127.0.0.1:8080/dcm4chee-arc/aets/DCM4CHEE/rs --patient XRV-DEMO7 1.2.826.0.1.3680043.8.498.42952727672363954171947692870286891467
With the vocabulary in hand, the two commands that validate the pack
against the CXR demo study (PatientID XRV-DEMO7):
# Clarus (http://127.0.0.1:8024/dicomweb)
$ups:run --url http://127.0.0.1:8024/dicomweb --code CXR-CLAHE --scheme 99CLARUS --patient XRV-DEMO7 --instance 1.2.826.0.1.3680043.8.498.69385494595456511554901688275423054042/1.2.840.10008.5.1.4.1.1.7/1.2.826.0.1.3680043.8.498.55435949330265076746764338796935859748 1.2.826.0.1.3680043.8.498.42952727672363954171947692870286891467
# dcm4chee-arc (http://127.0.0.1:8080/dcm4chee-arc/aets/DCM4CHEE/rs)
$ups:run --url http://127.0.0.1:8080/dcm4chee-arc/aets/DCM4CHEE/rs --code CXR-CLAHE --scheme 99CLARUS --patient XRV-DEMO7 --instance 1.2.826.0.1.3680043.8.498.69385494595456511554901688275423054042/1.2.840.10008.5.1.4.1.1.7/1.2.826.0.1.3680043.8.498.55435949330265076746764338796935859748 1.2.826.0.1.3680043.8.498.42952727672363954171947692870286891467
The demo study
demo-study/ ships three de-identified chest radiographs (Secondary
Capture, Modality DX) taken from the cxr10 training set - no PHI. STOW them
into a fresh Clarus to reproduce the loop:
curl -X POST http://127.0.0.1:8024/dicomweb/studies \
-H "Content-Type: application/dicom" \
--data-binary @demo-study/Mass_62109.png.dcm
curl -X POST http://127.0.0.1:8024/dicomweb/studies \
-H "Content-Type: application/dicom" \
--data-binary @demo-study/Pneumothorax_48950.png.dcm
curl -X POST http://127.0.0.1:8024/dicomweb/studies \
-H "Content-Type: application/dicom" \
--data-binary @demo-study/Nodule_36331.png.dcm
Quick check that the derived series landed: after ups:watch reports
COMPLETED, open http://localhost:8024/ (Clarus's mini-viewer) - the study
now shows the derived series ("CLAHE", "Upscaled x2") next to the source -
or list them with QIDO-RS:
http://127.0.0.1:8024/dicomweb/studies/<STUDY_UID>/series
ups:watch is a standard Watcher
ups:watch is a CLI verb of the weasis-dicom-aiw module - a Weasis
surface, not a wire format. Under the hood it performs standard UPS-RS
transactions only:
- Subscribe (PS3.18 11.10, RAD-86) - a Filtered Global Subscription on
the study's workitems. The Watcher subscribes but does not own the
workitems. - Workitem Event Reports over WebSocket (PS3.18 11.13 + 8.10.4/8.10.5,
RAD-109) - the origin pushes state changes (SCHEDULED -> IN PROGRESS ->
COMPLETED) to the subscriber. Transport is standard RFC 6455 WebSocket.
Together they are the standard IHE AIW-I Watcher role - the third UPS-RS
role alongside Requestor and Performer. There is no non-standard wire
format.
What differs is the origin, not the standard: dcm4chee-arc 5.35.2 in our
deployment answers 403 to Subscribe and 404 to the WebSocket channel - it
does not service the notification channel. The transactions are standard;
this is a limitation of that implementation. Clarus services the channel,
so ups:watch watches live events against Clarus; against dcm4chee-arc it
falls back to polling the worklist (PS3.18 11.9 Search) on the --poll
interval.
UPS-RS behaviour, side by side
Both origins run the full loop - Weasis creates, clinfer claims, the model
runs, the derived series is stored back, and the workitem reaches COMPLETED.
| Operation | Clarus (8024) | dcm4chee-arc (8080) |
|---|---|---|
| DICOMweb root | /dicomweb |
/dcm4chee-arc/aets/DCM4CHEE/rs |
ups:search (PatientID + StudyInstanceUID) |
OK | OK |
ups:run create |
OK | OK |
| Claim by clinfer | OK | OK |
| Model run + derived series stored | OK | OK |
| COMPLETED | OK | OK |
| Work discovery by clinfer | notification channel | next worklist search |
Two things to know when aiming at dcm4chee-arc:
- STOW must be
multipart/related; clinfer already sends multipart, so the
loop works unchanged. - dcm4chee-arc exposes no notification channel, so clinfer claims the
workitem at its next worklist search: start clinfer afterups:run.
Where the origins diverge
A vendor-neutral pack also runs the SAME request against two origins and
lets the standard judge. Two probes show the split:
| Probe | Clarus | dcm4chee-arc 5.35.2 | Follows the standard |
|-------------------------------------|---------------------|----------------------------------|...
Clarus totalseg demo pack - run guide
Whole-slide imaging (WSI) support
This build is compiled with the transcode codec feature (JPEG-LS, JPEG
Baseline/Lossless, JPEG 2000, RLE) and ships max_instance_size_mb = 16384
in clarus.conf, so a 13 GB whole-slide pyramid base ingests out of the box.
How a 13 GB slide broke our server and how we fixed it - read the story:
wsi-oom-story.md.
Clarus totalseg demo pack — run guide
A self-contained demo of an AI pipeline over DICOMweb: clarus (a tiny
DICOMweb PACS), clinfer (an inference sidecar), the ABI producer
scripts, and clmcp (a demo Task Requester).
NOT FOR DIAGNOSTIC USE. This is transport plus research models; no clinical
claim is made or implied.
Before you start: these demo binaries are built with the
transcode
codec feature (JPEG-LS, JPEG Baseline/Lossless, JPEG 2000, RLE), so
compressed CT is decoded by the server on retrieve instead of passing
through still-compressed. Uncompressed CT (Explicit VR Little Endian) works
as before. See Requirements.
What you get
clarus(.exe)— one-file DICOMweb server (QIDO/WADO/STOW/UPS-RS)clinfer(.exe)— inference sidecar (claims workitems, runs producers,
writes results)clarus.conf— default server config (Clarus is Task Manager only)task_producer.conf— server config where Clarus also mints workitemsclinfer_demo.conf— sidecar config for the totalseg rule (minimal)clinfer.conf.example.en— the full annotated sidecar config (every option)abi/— the example producers (below)ABI-README.md— the producer contract (frames + manifest.json in,
result.json out)clmcp/— the demo Task Requester (agent/MCP REPL)https://github.com/clicker71/clarus-pacs/raw/main/images/totalseg_demo.png— the RTSTRUCT result in Weasishttps://github.com/clicker71/clarus-pacs/raw/main/images/screenshot-clmcp.png— the clmcp REPL in action
The two modes (pick one)
UPS-RS has three roles — the IHE AIW-I (AI Workflow for Imaging) actors:
Task Manager (always clarus), Task Performer (always clinfer), and
Task Requester — the role that can be anyone. The wire is standard
DICOMweb UPS-RS (PS3.18 §11). The pack ships two server configs that differ
in exactly one knob, task_producer:
| Config | task_producer |
Who creates workitems |
|---|---|---|
clarus.conf |
false |
external — clmcp, a modality, a RIS |
task_producer.conf |
true |
Clarus itself (auto-mint on STOW) |
Mode A — Clarus as Task Producer (no requester needed)
./clarus --config task_producer.conf
./clinfer --config clinfer_demo.conf
curl -X POST http://127.0.0.1:8024/dicomweb/studies \
-H "Content-Type: application/dicom" --data-binary @slice.dcm
STOW → Clarus mints a CT workitem → clinfer claims it → totalseg runs →
RTSTRUCT back. Open in Weasis.
Mode B — external Task Requester via clmcp
./clarus # clarus.conf is the default config
./clinfer --config clinfer_demo.conf
python clmcp/clmcp.py --chat
Push your own CT study first (STOW-RS, see Mode A), then in the REPL:
run totalsegmentator for <your patient>. clmcp creates the workitem over
standard UPS-RS (POST /workitems), exactly as a modality or a RIS would.
The configs are the guide
clarus.conf is deliberately self-documenting: every knob carries a comment
that says what it does, why the default is what it is, and when you would
change it. Read it top-to-bottom as the deployment/operation manual. The knobs
that matter for this demo are task_producer (above) and the workitem catalog
(the AI task vocabulary, read only when task_producer is on).
clinfer_demo.conf is the minimal totalseg wiring: models: entry, the rule
table, interpreter path, timeout. clinfer.conf.example.en documents every
option the sidecar accepts.
The ABI producer scripts (abi/)
Each script is an ordinary program: clinfer hands it a workdir
(manifest.json + frames/*.raw), it writes back one result.json, and
clinfer writes the DICOM object. A producer never sees DICOM — the contract
is ABI-README.md.
PR-openvino-detect.py— OpenVINO detector; boxes over every frame → PR
(presentation state).SR-llm.py— calls an OpenAI-compatible endpoint; returnssr.text→
SR (structured report).RTSTRUCT-CT-totalseg.py— TotalSegmentator (craniofacial structures) → RTSTRUCT.STL-mesh.py— the reference STL mesh producer (seg/stl bridge).SR-DX-SCOORD-torchxrayvision.py— chest X-ray classifier; 18 pathology probabilities → TID 1500
Enhanced SR measurements.
Also shipped: SEG-threshold.py (segmentation), RTSTRUCT-contours.py
(license-clean RTSTRUCT contours), DERIVED-clahe.py / DERIVED-upscale.py /
SR-opacity.py (image filters), SEG-DX-torchxrayvision.py / SR-DX-torchxrayvision-regions.py (X-ray
anatomy), manifest.example.json (input shape), requirements.txt.
TID 1500 in Weasis — known upstream bug. The SR measurement viewer
(Enhanced SR SCOORD) has two upstream display bugs we filed —
nroduit/Weasis #922 and
#923 — which the maintainer
took upstream and fixed as
#931 ("Refactor SR
rendering…", milestone 4.8.0). Until 4.8.0 ships, render TID 1500 results
with that caveat. TheRTSTRUCT-CT-totalseg.py→ RTSTRUCT contour path is unaffected
(verified in Weasis 4.7.2, RT tool).
Observing a run
Everything in the chain is observable without a debugger:
- Server log (
clarus.log+ stderr):UPS_EVENTlines name every state
transition (created → SCHEDULED → IN PROGRESS → COMPLETED);WADO_SERIES
shows the study fetch as one line per series (slices=626 of=626 failed=0);STOW_STUDYrecords the result stored back. - clinfer terminal: the claim, the producer launch, and the producer's
own stderr in real time (the sidecar forcesPYTHONUNBUFFERED=1, so a hung
or slow model is visible while it happens). /metrics(Prometheus text format on the server port): HTTP requests
labelled by handler, STOW duplicates/parse errors, and UPS push
delivered/retried/dropped counters.
The server log reads (one line per event; UIDs and numbers are illustrative):
2026/09/30 14:12:05 [INFO] UPS_EVENT workitem_uid=1.2.840.113619.6.412.1.20260930.1 previous_state=created new_state=SCHEDULED event_id=1
2026/09/30 14:12:06 [INFO] UPS_EVENT workitem_uid=1.2.840.113619.6.412.1.20260930.1 previous_state=SCHEDULED new_state=IN PROGRESS event_id=2
2026/09/30 14:13:11 [INFO] WADO_SERIES loaded study=1.2.840.113619.6.412.1.20260930 series=1.2.840.113619.6.412.1.20260930.2 slices=626 of=626 bytes=418600128 us=71204012 failed=0 user=clinfer ip=127.0.0.1
2026/09/30 14:17:48 [INFO] STOW_STUDY completed study=1.2.840.113619.6.412.1.20260930 slices=1 stored=1 idempotent=0 failed=0 conflicts=0 bytes=48216 us=1182407 user=clinfer ip=127.0.0.1
clmcp is a demo, not a product
clmcp exists to show one thing: the UPS Task Requester can be anything —
an agent/MCP front-end, a modality console, a RIS, or a viewer dropdown. clmcp
speaks only standard DICOMweb (Search → Create → wait over SSE). Replace it
with your own requester and nothing else changes; the wire is the same.
clmcp REPL — the MCP/agent Task Requester for Clarus. Five commands in one
window: an unknown task fails honestly with the known-task list; an unknown
patient is refused; an already-processed study answers "already done"
(idempotent, no re-run); a one-edit typo Салгалов resolves to patient
Солгалов via PS3.18 Levenshtein-1 fuzzymatching (not a wildcard) and
runs the full UPS-RS cycle — TotalSegmentator → RTSTRUCT → "Done"; a
modality check refuses chestai on a CT study and suggests the right task.
(Солгалов = the owner's own name, test data — no PHI leakage.)
The result in Weasis
Weasis 4.7.2 — the stored RTSTRUCT renders as contours under the RT tool:
MANDIBLE, TEETH_LOWER, TEETH_UPPER (structure set "totalseg-1", Jaw CT
Segmentation).
Requirements
- Compressed or uncompressed CT. The demo binaries are built with the
transcodecodec feature (JPEG-LS, JPEG Baseline/Lossless, JPEG 2000, RLE);
compressed input is decoded by the server on retrieve, so the producer
receives raw frames. Explicit VR Little Endian input works as before. - Windows x64 or Linux x64.
- Python 3.10+ with TotalSegmentator (
pip install TotalSegmentator);
weights ~2 GB into~/.totalsegmentator, pre-download once. - Weasis 4.7.2+ for RTSTRUCT contours; 4.7.3+ for large STOW exports (earlier
builds abort on the 15 sUrlReadTimeout). - The producers are operator-trusted programs (same trust domain as the
API key) — seeABI-README.md§1.
Your own model
Read ABI-README.md. A producer is any program reading the workdir and
writing result.json; add a models: entry and a rule in clinfer_demo.conf.
Done.
TotalSegmentator demo pack v0.2
Clarus totalseg demo pack — run guide
A self-contained demo of an AI pipeline over DICOMweb: clarus (a tiny
DICOMweb PACS), clinfer (an inference sidecar), the ABI producer
scripts, and clmcp (a demo Task Requester).
NOT FOR DIAGNOSTIC USE. This is transport plus research models; no clinical
claim is made or implied.
Before you start: input must be uncompressed CT (Explicit VR Little
Endian) — these demo binaries are built without thetranscodecodec
feature. Compressed (JPEG/JPEG2000) input is stored as-is and reaches the
producer still compressed. See Requirements.
What you get
clarus(.exe)— one-file DICOMweb server (QIDO/WADO/STOW/UPS-RS)clinfer(.exe)— inference sidecar (claims workitems, runs producers,
writes results)clarus.conf— default server config (Clarus is Task Manager only)task_producer.conf— server config where Clarus also mints workitemsclinfer_demo.conf— sidecar config for the totalseg rule (minimal)clinfer.conf.example.en— the full annotated sidecar config (every option)abi/— the example producers (below)ABI-README.md— the producer contract (frames + manifest.json in,
result.json out)clmcp/— the demo Task Requester (agent/MCP REPL)https://github.com/clicker71/clarus-pacs/raw/main/images/totalseg_demo.png— the RTSTRUCT result in Weasishttps://github.com/clicker71/clarus-pacs/raw/main/images/screenshot-clmcp.png— the clmcp REPL in action
The two modes (pick one)
UPS-RS has three roles — the IHE AIW-I (AI Workflow for Imaging) actors:
Task Manager (always clarus), Task Performer (always clinfer), and
Task Requester — the role that can be anyone. The wire is standard
DICOMweb UPS-RS (PS3.18 §11). The pack ships two server configs that differ
in exactly one knob, task_producer:
| Config | task_producer |
Who creates workitems |
|---|---|---|
clarus.conf |
false |
external — clmcp, a modality, a RIS |
task_producer.conf |
true |
Clarus itself (auto-mint on STOW) |
Mode A — Clarus as Task Producer (no requester needed)
./clarus --config task_producer.conf
./clinfer --config clinfer_demo.conf
curl -X POST http://127.0.0.1:8024/dicomweb/studies \
-H "Content-Type: application/dicom" --data-binary @slice.dcm
STOW → Clarus mints a CT workitem → clinfer claims it → totalseg runs →
RTSTRUCT back. Open in Weasis.
Mode B — external Task Requester via clmcp
./clarus # clarus.conf is the default config
./clinfer --config clinfer_demo.conf
python clmcp/clmcp.py --chat
Push your own CT study first (STOW-RS, see Mode A), then in the REPL:
run totalsegmentator for <your patient>. clmcp creates the workitem over
standard UPS-RS (POST /workitems), exactly as a modality or a RIS would.
The configs are the guide
clarus.conf is deliberately self-documenting: every knob carries a comment
that says what it does, why the default is what it is, and when you would
change it. Read it top-to-bottom as the deployment/operation manual. The knobs
that matter for this demo are task_producer (above) and the workitem catalog
(the AI task vocabulary, read only when task_producer is on).
clinfer_demo.conf is the minimal totalseg wiring: models: entry, the rule
table, interpreter path, timeout. clinfer.conf.example.en documents every
option the sidecar accepts.
The ABI producer scripts (abi/)
Each script is an ordinary program: clinfer hands it a workdir
(manifest.json + frames/*.raw), it writes back one result.json, and
clinfer writes the DICOM object. A producer never sees DICOM — the contract
is ABI-README.md.
openvino_detect.py— OpenVINO detector; boxes over every frame → PR
(presentation state).sr_llm.py— calls an OpenAI-compatible endpoint; returnssr.text→
SR (structured report).totalseg.py— TotalSegmentator (craniofacial structures) → RTSTRUCT.stl_mesh.py— the reference STL mesh producer (seg/stl bridge).xrv.py— chest X-ray classifier; 18 pathology probabilities → TID 1500
Enhanced SR measurements.
Also shipped: threshold_seg.py (segmentation), rtstruct_contours.py
(license-clean RTSTRUCT contours), clahe.py / upscale.py /
opacity_patch.py (image filters), xrv_seg.py / xrv_regions.py (X-ray
anatomy), manifest.example.json (input shape), requirements.txt.
TID 1500 in Weasis — known upstream bug. The SR measurement viewer
(Enhanced SR SCOORD) has two upstream display bugs we filed —
nroduit/Weasis #922 and
#923 — which the maintainer
took upstream and fixed as
#931 ("Refactor SR
rendering…", milestone 4.8.0). Until 4.8.0 ships, render TID 1500 results
with that caveat. Thetotalseg.py→ RTSTRUCT contour path is unaffected
(verified in Weasis 4.7.2, RT tool).
Observing a run
Everything in the chain is observable without a debugger:
- Server log (
clarus.log+ stderr):UPS_EVENTlines name every state
transition (created → SCHEDULED → IN PROGRESS → COMPLETED);WADO_SERIES
shows the study fetch as one line per series (slices=626 of=626 failed=0);STOW_STUDYrecords the result stored back. - clinfer terminal: the claim, the producer launch, and the producer's
own stderr in real time (the sidecar forcesPYTHONUNBUFFERED=1, so a hung
or slow model is visible while it happens). /metrics(Prometheus text format on the server port): HTTP requests
labelled by handler, STOW duplicates/parse errors, and UPS push
delivered/retried/dropped counters.
The server log reads (one line per event; UIDs and numbers are illustrative):
2026/09/30 14:12:05 [INFO] UPS_EVENT workitem_uid=1.2.840.113619.6.412.1.20260930.1 previous_state=created new_state=SCHEDULED event_id=1
2026/09/30 14:12:06 [INFO] UPS_EVENT workitem_uid=1.2.840.113619.6.412.1.20260930.1 previous_state=SCHEDULED new_state=IN PROGRESS event_id=2
2026/09/30 14:13:11 [INFO] WADO_SERIES loaded study=1.2.840.113619.6.412.1.20260930 series=1.2.840.113619.6.412.1.20260930.2 slices=626 of=626 bytes=418600128 us=71204012 failed=0 user=clinfer ip=127.0.0.1
2026/09/30 14:17:48 [INFO] STOW_STUDY completed study=1.2.840.113619.6.412.1.20260930 slices=1 stored=1 idempotent=0 failed=0 conflicts=0 bytes=48216 us=1182407 user=clinfer ip=127.0.0.1
clmcp is a demo, not a product
clmcp exists to show one thing: the UPS Task Requester can be anything —
an agent/MCP front-end, a modality console, a RIS, or a viewer dropdown. clmcp
speaks only standard DICOMweb (Search → Create → wait over SSE). Replace it
with your own requester and nothing else changes; the wire is the same.
clmcp REPL — the MCP/agent Task Requester for Clarus. Five commands in one
window: an unknown task fails honestly with the known-task list; an unknown
patient is refused; an already-processed study answers "already done"
(idempotent, no re-run); a one-edit typo Салгалов resolves to patient
Солгалов via PS3.18 Levenshtein-1 fuzzymatching (not a wildcard) and
runs the full UPS-RS cycle — TotalSegmentator → RTSTRUCT → "Done"; a
modality check refuses chestai on a CT study and suggests the right task.
(Солгалов = the owner's own name, test data — no PHI leakage.)
The result in Weasis
Weasis 4.7.2 — the stored RTSTRUCT renders as contours under the RT tool:
MANDIBLE, TEETH_LOWER, TEETH_UPPER (structure set "totalseg-1", Jaw CT
Segmentation).
Requirements
- Uncompressed input only. The demo binaries are built without the
transcodecodec feature; use Explicit VR Little Endian CT images.
Compressed (JPEG/JPEG2000) input is stored as-is and would reach the
producer still compressed. - Windows x64 or Linux x64.
- Python 3.10+ with TotalSegmentator (
pip install TotalSegmentator);
weights ~2 GB into~/.totalsegmentator, pre-download once. - Weasis 4.7.2+ for RTSTRUCT contours; 4.7.3+ for large STOW exports (earlier
builds abort on the 15 sUrlReadTimeout). - The producers are operator-trusted programs (same trust domain as the
API key) — seeABI-README.md§1.
Your own model
Read ABI-README.md. A producer is any program reading the workdir and
writing result.json; add a models: entry and a rule in clinfer_demo.conf.
Done.

