vysotskyi.dev

Constantine Vysotskyi

I design and build medical imaging software.

From system design to the interface, with AI in the loop.

Chicago ·
Book a 30-min call
Case report · (0009,1002) ·

C-FIND/C-MOVE over DICOMweb, streamed end to end

Environment (0008,1010)
Windows Server VMs at hospitals → cloud platform on Kubernetes
Area (0008,1030)
Query/retrieve
Period (0008,0020)
2025 · live in October
My role (0008,1070)
Adapter, transcoding, end-to-end testing
Stack (0018,1030)
Go · DIMSE · QIDO-RS · WADO-RS · Kubernetes
Status (0040,0252)
COMPLETED

Background

Hospitals talk to imaging systems in two DICOM dialects. The classic one is DIMSE: a PACS or modality opens an association over TCP, and inside it runs commands like C-FIND (search), C-MOVE (ask the other side to send studies) and C-STORE (send one image). Before any image moves, both sides agree on presentation contexts: for each kind of object (SOP class), which transfer syntax, meaning which encoding and compression, the receiver accepts. If the sender has the image in a format the receiver didn't accept, it has to transcode first.

The modern dialect is DICOMweb, plain HTTP. QIDO-RS is the search, WADO-RS is the download. A WADO-RS request for a series returns a single multipart response with every instance in it, and the client can ask for a specific transfer syntax in the Accept header, for example multipart/related; type="application/dicom"; transfer-syntax=1.2.840.10008.1.2.1.

Cloud imaging platforms speak DICOMweb. Most hospital PACS and VNAs still speak DIMSE. Something at the edge has to translate, and how it translates decides how fast studies arrive.

Indication

A customer with dozens of small hospitals received studies from the cloud through edge nodes on Windows Server VMs. The translation was a chain: a Mirth Connect channel downloaded each study from DICOMweb to disk, then DCMTK command-line tools sent it to every destination with C-STORE, transcoding first when a destination needed another format.

Every link in that chain cost something. The disk filled up. Each send spawned subprocesses, many at once. When something failed, there were too many moving parts to see which one. And the whole thing ran at the speed of the disk: on the HDDs or network disks a small hospital VM gets, it crawled. Large series of small images were the worst case, because each image meant its own request and its own process: 1–2 images per second, so a 5,000-instance study took roughly 40 to 80 minutes.

Technique

Step 1: join the two streams. DIMSE and DICOMweb are both streams over the network, so there is no reason to put a disk between them. A single adapter in Go replaced the chain. It first queries the study to learn which SOP classes are inside, so it knows which presentation contexts to propose. Then it opens the association to the destination, opens a WADO-RS multipart request to the cloud, and pipes each instance from the HTTP response into C-STORE as it arrives. Nothing touches the disk, and one series is one request instead of thousands.

Step 2: transcode where the CPU is. Streaming exposed a new problem: there was no streaming transcoder, and some destinations rejected what they received. Decoding and re-encoding on a weak hospital VM would have brought back the bottleneck, so transcoding moved to the server. After the association is negotiated, the adapter reads which transfer syntax the destination accepted for each SOP class. If a whole series can use one format, it is requested as a series; if not, it is split into per-instance requests. Each request carries the accepted transfer syntax in the Accept header, and the platform returns the images already in that format.

flowchart TB
  subgraph before["BEFORE · 1–2 images/s"]
    direction LR
    a1["Cloud<br/>DICOMweb"] --> a2["Mirth<br/>download"] --> a3[("Disk<br/>HDD / network")] --> a4["DCMTK CLI ×N<br/>transcode"] -->|C-STORE| a5["PACS / VNA"]
  end
  subgraph after["AFTER · as fast as the destination accepts"]
    direction LR
    b1["Cloud<br/>transcodes on request"] -->|WADO-RS multipart| b2["Go adapter<br/>streams, no disk"] -->|C-STORE| b3["PACS / VNA"]
  end
  before ~~~ after
  classDef warn stroke:#f87171
  classDef on stroke:#38bdf8,color:#eef0f2
  class a3,a4 warn
  class b2 on
Data path before and after. The disk and the per-image CLI processes are gone; transcoding moved to the platform.

Findings

  1. No disk in the path. Instances stream from the WADO-RS multipart response straight into the C-STORE association.
  2. One process instead of many. A single Go service replaced the Mirth channel and the DCMTK subprocesses, so a failure points to one place.
  3. Transfer planned up front. A query before the transfer tells the adapter which presentation contexts to propose and how to group requests.
  4. Transcoding on the server. Requests follow what each destination accepted, and the platform returns that transfer syntax, so edge nodes no longer decode or re-encode.
  5. Smaller edge nodes. Without disk-heavy work and local transcoding, the edge runs on the modest VMs small hospitals can actually provide.
  6. The bottleneck moved out. Transfer speed became limited only by how fast each third-party PACS or VNA accepts images. If a destination takes 10–20 images per second, that's how fast it gets them.
  7. Tested end to end. Every destination and transfer syntax combination was tested before rollout, on test data prepared with the team.

Impression

TagData
(0040,A30A)Large-series speed, before1–2 images/s
(0040,A30A)Large-series speed, afterAs fast as the destination accepts
(0040,A30A)Delay on our sideNone left
(0040,A30A)Disk on the edge nodeRequired → not used
(0040,A30A)Processes per transferMany CLI subprocesses → one service
(0040,A30A)TranscodingEdge node → cloud platform
(0040,A30A)Timeline2 months build + 1 month testing

Lessons

  1. Don't put a disk between two network protocols. WADO-RS and C-STORE are both streams. Writing to disk in between only adds a slow, fragile step.
  2. Many small images is a request-count problem, not a bandwidth problem. One multipart request per series beats thousands of single-image requests.
  3. Query before you associate. Knowing the SOP classes up front lets you propose the right presentation contexts the first time.
  4. Read what the destination accepted, then ask for exactly that. The transfer-syntax parameter in the WADO-RS Accept header lets the server do the transcoding the edge can't afford.
  5. On multi-site projects, requirements take longer than code. Here the build took two months; aligning dozens of facilities took more. Plan the calendar for it.

Related service

(0009,1103)Smart query/retrieve →
(0009,1101)Custom edge integration →