## Overview

Medplum stores medical imaging alongside the rest of the patient record. A modality or PACS sends studies in over the DICOM network protocol or over DICOMweb, Medplum files them into [`DicomStudy`](/content/docs/api/fhir/medplum/dicomstudy/index.html), [`DicomSeries`](/content/docs/api/fhir/medplum/dicomseries/index.html), and [`DicomInstance`](/content/docs/api/fhir/medplum/dicominstance/index.html) resources, and a DICOMweb viewer such as [OHIF](https://ohif.org/) reads them back out — all under the same authentication, access policies, and audit trail as every other resource in the project.

## How it fits together

DIMSE C-STORE

HTTPS STOW-RS

HTTPS STOW-RS

QIDO-RS / WADO-RS

**In, over the network protocol.** Imaging equipment overwhelmingly speaks DIMSE — the DICOM upper layer protocol over raw TCP — not HTTPS, and it speaks it on a hospital network that has no route to the public internet. The [Medplum Agent](/content/docs/dicom/agent-dimse/index.html) runs inside that network, presents itself as a DICOM Storage SCP, accepts `C-STORE` from the modality, and forwards each instance to Medplum over an outbound HTTPS connection. This is the same Agent that handles HL7 v2 and ASTM traffic, so a site that already runs one gets imaging by adding a channel.

**In, over HTTPS.** Anything that can speak DICOMweb — a cloud PACS, a research pipeline, an integration engine, or the [Medplum CLI](/content/docs/dicom/cli/index.html) — can `POST` directly to the [STOW-RS endpoint](/content/docs/dicom/dicomweb-api#stow-rs-store-instances/index.html). No Agent required.

**Out, over HTTPS.** [QIDO-RS and WADO-RS](/content/docs/dicom/dicomweb-api/index.html) serve the study list, series metadata, and pixel frames that a DICOMweb viewer needs. Medplum's implementation targets the request sequence the [OHIF Viewer](/content/docs/dicom/ohif-viewer/index.html) makes.

## What gets stored

A single DICOM instance arriving at Medplum produces four things:

| Resource | Holds |
| --- | --- |
| [`DicomStudy`](/content/docs/api/fhir/medplum/dicomstudy/index.html) | Study-level attributes — study UID, accession number, patient name and ID, study date |
| [`DicomSeries`](/content/docs/api/fhir/medplum/dicomseries/index.html) | Series-level attributes — series UID, modality, series description |
| [`DicomInstance`](/content/docs/api/fhir/medplum/dicominstance/index.html) | Instance-level attributes, plus the full DICOM JSON metadata and references to binaries |
| [`Binary`](/content/docs/api/fhir/resources/binary/index.html) | The original, unmodified `.dcm` file |

Studies and series are created conditionally on their DICOM UIDs, so the second instance of a series attaches to the study and series the first one created rather than duplicating them.

A background worker then reads the raw file and extracts pixel data into one additional `Binary` per frame, which is what [WADO-RS frame retrieval](/content/docs/dicom/dicomweb-api#wado-rs-retrieve-frames/index.html) serves. See the [Data Model](/content/docs/dicom/data-model/index.html) for the full mapping from DICOM attributes to resource fields.

Because these are ordinary Medplum resources, they are searchable with the standard FHIR search API, readable through the [TypeScript SDK](/content/docs/sdk/index.html), subject to [access policies](/content/docs/access/access-policies/index.html), and able to trigger [Bots](/content/docs/bots/index.html) on create or update.

## Getting started

1. **Store a file from your laptop.** `medplum dicomweb stow MRBRAIN.DCM` uploads a DICOM file — or a whole directory of them — through STOW-RS with no infrastructure to set up. See the [CLI](/content/docs/dicom/cli/index.html).
2. **Look at it.** Medplum's hosted cloud is preconfigured with an [OHIF Viewer](/content/docs/dicom/ohif-viewer/index.html) at [viewer.medplum.com](https://viewer.medplum.com/) — sign in and the study is there.
3. **Connect a modality.** Add a DICOM channel to a [Medplum Agent](/content/docs/dicom/agent-dimse/index.html) and send a `C-ECHO`, then a `C-STORE`, from the device.

## Reference

- [Data Model](/content/docs/dicom/data-model/index.html) — resource types, search parameters, and DICOM attribute mapping
- [DICOMweb API](/content/docs/dicom/dicomweb-api/index.html) — the implemented HTTP endpoints
- [Medplum Agent](/content/docs/dicom/agent-dimse/index.html) — DIMSE `C-STORE` and `C-ECHO` from inside the firewall
- [Medplum CLI](/content/docs/dicom/cli/index.html) — `medplum dicomweb stow`
- [OHIF Viewer](/content/docs/dicom/ohif-viewer/index.html) — viewer configuration
- [DICOM Standard Part 18: Web Services](https://dicom.nema.org/medical/dicom/current/output/html/part18.html)
