WADO-RS — Retrieve Instances
The Retrieve transaction (PS3.18 §10.4) retrieves stored studies, series, instances, frames, metadata, rendered images, and thumbnails by reference.
| Method | Path | Description |
|---|---|---|
| GET | QUERY | /studies/{study} |
Retrieve all instances within a study |
| GET | QUERY | /studies/{study}/metadata |
Retrieve metadata for all instances within a study |
| GET | QUERY | /studies/{study}/series/{series} |
Retrieve all instances within a series |
| GET | QUERY | /studies/{study}/series/{series}/metadata |
Retrieve metadata for all instances within a series |
| GET | QUERY | /studies/{study}/series/{series}/instances/{instance} |
Retrieve a single instance |
| GET | QUERY | /studies/{study}/series/{series}/instances/{instance}/metadata |
Retrieve metadata for a single instance |
| GET | QUERY | /studies/{study}/series/{series}/instances/{instance}/frames/{frames} |
Retrieve one or many frames from a single instance (comma-separated frame numbers, 1-indexed) |
| GET | QUERY | /studies/{study}/series/{series}/instances/{instance}/rendered |
Retrieve an instance rendered into an image format (renders frame 0) |
| GET | QUERY | /studies/{study}/series/{series}/instances/{instance}/frames/{frames}/rendered |
Retrieve frame(s) rendered into an image format |
| GET | QUERY | /studies/{study}/series/{series}/instances/{instance}/thumbnail |
Retrieve a thumbnail of an instance (renders frame 0) |
| GET | QUERY | /studies/{study}/series/{series}/instances/{instance}/frames/{frames}/thumbnail |
Retrieve thumbnail(s) of frame(s) |
Every retrieve transaction on this interface answers on both HTTP GET and
the HTTP QUERY method — the safe HTTP method whose request parameters
travel in the request body rather than in the URL query string. The same
handler serves both. See The QUERY method below.
Authorization
When viewer-JWT verification is enabled for the deployment, every request to
this interface must carry Authorization: Bearer <jwt>, and the study named
in the path must be included in the token's scope. See
JWT Authorization for the token format, scope
semantics, and status codes.
The QUERY method
Every endpoint listed above answers on both GET and the HTTP QUERY
method. The handler is the same; only the location of any request parameters
changes.
| Method | Parameters live in | Example |
|---|---|---|
GET |
The URL query string | GET /studies/…/rendered?viewport=512,512 |
QUERY |
The request body (application/x-www-form-urlencoded or application/json) |
QUERY /studies/…/rendered with body viewport=512,512 |
Most retrieve paths name the resource purely in the URL and take no
parameters, so on those routes QUERY is behaviourally identical to GET
and exists mainly so a client that has standardised on QUERY can use it
end-to-end. The endpoints that do take parameters — viewport, window,
quality on the /rendered and /thumbnail transactions — accept them
either way. Everything else about the request (the Accept header, the
response payload and headers, the status codes on this page) is unchanged.
An empty body is the same as a GET with no query string.
A QUERY request whose parameters cannot be read is refused, rather than
answered as if it had none:
| Request | Response |
|---|---|
Non-empty body of any other Content-Type, or with no Content-Type |
415 (Unsupported Media Type) with Accept-Query: application/x-www-form-urlencoded, application/json |
| Parameters on the URL query string | 400 (Bad Request); for a QUERY request only the body is read, so move the parameters there or use GET |
| A JSON array body | 400 (Bad Request) |
A body with no usable parameter names (typically a JSON document sent as application/x-www-form-urlencoded) |
400 (Bad Request) |
Why it exists. On a GET, the URL — including any query string — is
recorded by every hop between the client and this service (reverse proxy,
CDN, browser history). On a QUERY, the parameters ride in the request body
and none of that machinery sees them. Retrieve paths carry UIDs rather than
free-text identifiers, so the case is weaker than for QIDO-RS search, but
deployment policy is uniform across the read interface: a deployment that
disables GET for QIDO-RS disables it for WADO-RS too, and every WADO-RS
route therefore has a QUERY mirror so it never becomes a dead end.
Deployment option: QUERY-only. A deployment can disable GET and HEAD
across the whole read interface (q.v.,
kastoria-health image page). When
GET is disabled, a GET or HEAD request to any endpoint on this
interface is answered:
HTTP/1.1 405 Method Not Allowed
Allow: QUERY
Content-Type: application/json
{ "error": "Method Not Allowed",
"message": "GET is disabled on this server; use the QUERY method instead" }
The 405 is returned only after the request has been authenticated when
viewer-JWT verification is enabled, so it does not disclose the
configuration to unauthenticated callers.
Retrieve instances within a study, series, or a single instance
The following Accept headers are supported:
multipart/related; type="application/dicom"application/dicomapplication/**/*(defaults tomultipart/related; type="application/dicom")
Transfer syntax negotiation
The transfer-syntax Accept-header parameter
(PS3.18 §8.7.3.5.2) is supported. When a specific transfer syntax is requested
and differs from the stored one, each instance is transcoded on the fly before
being returned. transfer-syntax=* (or omitting the parameter) returns
instances in their stored transfer syntax — which may be the result of
ingest-time transcoding.
Each part's Content-Type carries a transfer-syntax parameter identifying
the actual returned syntax (PS3.18 §8.7.9).
Transcoding is available between any pair of
supported transfer syntaxes. A requested
transfer syntax that is unsupported, or for which no codec is available,
results in 406 (Not Acceptable).
Part 10 preamble
The 128-byte Part 10 preamble of every returned instance is zero-filled, because the preamble is replaced with zeros at store time.
Retrieve frames
Frame numbers are 1-indexed and comma-separated in the path.
The following Accept headers are supported:
multipart/related— returnsmultipart/related; type="<frame media type>"with the appropriate media type based on the instance's transfer syntaxapplication/octet-streamapplication/**/*
The frame media type is derived from the returned transfer syntax:
| Media type | Transfer syntax |
|---|---|
application/octet-stream |
Uncompressed |
image/dicom-rle |
RLE Lossless |
image/jpeg |
JPEG Baseline or JPEG Lossless |
image/jls |
JPEG-LS |
image/jp2 |
JPEG 2000 |
image/jxl |
JPEG XL |
image/jphc |
High-Throughput JPEG 2000 |
Notes:
- A single-part response carries the frame media type, not
application/octet-stream. A request for one frame underAccept: */*against a JPEG-encoded instance is answeredContent-Type: image/jpeg; only an instance in an uncompressed transfer syntax is answeredapplication/octet-stream. The bytes are the stored frame, and the header names what they actually are. - A request naming more than one frame is always answered as
multipart/related, whatever theAcceptheader allows, because separate frames need separate body parts (PS3.18 §10.4.3). - The
Acceptheader is checked against every frame media type this service can produce, not against the one this instance will produce. A request withAccept: application/octet-streamfor a JPEG-encoded frame is therefore answered200withContent-Type: image/jpegrather than406. A client that can only decode one encoding should name the transfer syntax it wants with thetransfer-syntaxAccept-header parameter, which does govern what comes back. That parameter is read from amultipart/related,application/dicom,application/*or*/*media range only — carried on a concrete image media type such asimage/jpeg, it is ignored.
Transfer syntax negotiation
The transfer-syntax Accept-header parameter
(PS3.18 §8.7.3.5.2) is supported. When a specific transfer syntax is requested
and differs from the stored one, each frame is transcoded on the fly before
being returned, and the frame media type reflects the target syntax.
transfer-syntax=* (or omitting the parameter) returns frames in their stored
transfer syntax — which may be the result of
ingest-time transcoding.
Transcoding is available between any pair of
supported transfer syntaxes. A requested
transfer syntax that is unsupported, or for which no codec is available,
results in 406 (Not Acceptable).
Retrieve metadata (for study, series, or instance)
The Accept header must allow application/dicom+json — application/*,
*/*, or no Accept header at all are accepted.
Metadata is returned in DICOM JSON format as defined in PS3.18 Annex F.
- Compression: Metadata responses are served gzip-compressed when the
client sends
Accept-Encoding: gzip. - Bulk pixel data (
PixelData, 7FE0,0010) is never included in metadata responses; retrieve it via the frames or instance endpoints. - ETag / cache validation is not supported for metadata endpoints.
Retrieve rendered images (for instance or frame)
The following Accept headers are supported:
image/pngimage/jpegimage/bmpimage/*(defaults to PNG)*/*(defaults to PNG)multipart/relatedorapplication/octet-stream(defaults to PNG) — accepted so a client that names only a container gets a rendered image rather than a406
The service renders the specified instance or frame(s) into the requested
image format. For instance endpoints, frame 0 is rendered. Multiple frames are
returned as multipart/related with individual image parts.
| Parameter | Format | Description |
|---|---|---|
viewport |
vw,vh[,sx,sy,sw,sh] |
Scaling dimensions (width and height are required positive integers). Crop parameters (sx, sy, sw, sh) are accepted but currently ignored |
window |
center,width,function |
Windowing parameters. center and width must be numbers; function must be linear or sigmoid |
quality |
1-100 |
JPEG quality (integer 1–100, applies only to JPEG output) |
Image formats are selected in priority order: PNG > JPEG > BMP.
Retrieve thumbnails (for instance or frame)
The following Accept headers are supported:
image/jpeg(default per the DICOM spec)image/pngimage/bmpimage/*(defaults to JPEG)*/*(defaults to JPEG)multipart/relatedorapplication/octet-stream(defaults to JPEG) — accepted so a client that names only a container gets a thumbnail rather than a406
The service generates a thumbnail of the specified instance or frame(s). For
instance endpoints, frame 0 is rendered. Multiple frames are returned as
multipart/related with individual image parts.
| Parameter | Format | Description |
|---|---|---|
viewport |
vw,vh |
Thumbnail dimensions (width and height are required positive integers). Defaults to 128,128 |
Image formats are selected in priority order: JPEG > PNG > BMP.
Status codes
| Code | Description |
|---|---|
200 (OK) |
All requested data was retrieved successfully |
400 (Bad Request) |
Invalid query parameters (e.g. malformed viewport, window, or quality value, a parameter given more than once, or a frame number that is not a positive integer written in decimal digits, such as 0, 1.0, 1e1 or 0x1), a /rendered or /thumbnail request naming more frames than the service is configured to render at once, a request body that cannot be parsed, or a QUERY request refused under The QUERY method |
401* (Unauthorized) |
Viewer-JWT verification is enabled and the request carries no valid bearer token |
403* (Forbidden) |
A valid token that does not grant the requested study (the study is not in the token's scope) |
404 (Not Found) |
The specified DICOM resource could not be found, or the instance does not contain pixel data for rendered/thumbnail requests |
405 (Method Not Allowed) |
Deployment option: GET/HEAD are disabled on this server; use QUERY — see The QUERY method. The response carries Allow: QUERY |
406 (Not Acceptable) |
The specified Accept header is not supported, or a requested transfer-syntax cannot be transcoded to |
413 (Content Too Large) |
The request body is too large |
415 (Unsupported Media Type) |
A QUERY request body is neither application/x-www-form-urlencoded nor application/json; the response carries Accept-Query — see The QUERY method |
500 (Internal Server Error) |
The server encountered an unexpected error (if a mid-stream error occurs after headers are sent, the connection is torn down instead) |
* See above for an explanation of how to authorize
using Viewer-JWT verification.
Examples
Retrieve all instances in a study
curl "http://localhost:3000/studies/1.2.840.113619.2.55.3.604688119.868.1234567890.1" \
[-H 'Authorization: Bearer <jwt-token>' \ ]
-H 'Accept: multipart/related; type="application/dicom"'
Response: multipart/related with one application/dicom part per instance.
Retrieve a single instance in a specific transfer syntax
curl "http://localhost:3000/studies/1.2.840.../series/1.2.840.../instances/1.2.840..." \
[-H 'Authorization: Bearer <jwt-token>' \ ]
-H 'Accept: multipart/related; type="application/dicom"; transfer-syntax=1.2.840.10008.1.2.4.202'
Each part's Content-Type names the transfer syntax actually returned:
Content-Type: multipart/related; type="application/dicom"; boundary=...;
--...
Content-Type: application/dicom; transfer-syntax=1.2.840.10008.1.2.4.202
Retrieve metadata for a study
curl "http://localhost:3000/studies/1.2.840.../metadata" \
[-H 'Authorization: Bearer <jwt-token>' \ ]
-H "Accept: application/dicom+json" \
-H "Accept-Encoding: gzip"
Response: DICOM JSON, one dataset per instance, without bulk pixel data (truncated to one dataset):
[
{
"00080016": {
"vr": "UI",
"Value": ["1.2.840.10008.5.1.4.1.1.2"]
},
"00080018": {
"vr": "UI",
"Value": ["1.2.840.113619.2.55.3.12345.1"]
},
"00100010": {
"vr": "PN",
"Value": [{ "Alphabetic": "DOE^JOHN" }]
},
"00080060": {
"vr": "CS",
"Value": ["CT"]
},
"00280010": {
"vr": "US",
"Value": [512]
},
"00280011": {
"vr": "US",
"Value": [512]
}
}
]
Retrieve frames
Retrieve frames 1 and 2 of a multiframe instance:
curl "http://localhost:3000/studies/1.2.840.../series/1.2.840.../instances/1.2.840.../frames/1,2" \
[-H 'Authorization: Bearer <jwt-token>' \ ]
-H "Accept: multipart/related"
A request naming more than one frame is answered as multipart/related, with
each part carrying the frame's media type. A request for a single frame
against a JPEG-encoded instance is answered as a single part:
HTTP/1.1 200 OK
Content-Type: image/jpeg
Retrieve a rendered image
Render frame 0 as PNG, scaled to 512×512, with windowing applied:
curl "http://localhost:3000/studies/1.2.840.../series/1.2.840.../instances/1.2.840.../rendered?viewport=512,512&window=40,400,linear" \
[-H 'Authorization: Bearer <jwt-token>' \ ]
-H "Accept: image/png" \
--output rendered.png
The same rendered request over QUERY
Parameters in the body instead of the URL; the response is identical:
curl -X QUERY "http://localhost:3000/studies/1.2.840.../series/1.2.840.../instances/1.2.840.../rendered" \
[-H 'Authorization: Bearer <jwt-token>' \ ]
-H "Accept: image/png" \
-H "Content-Type: application/x-www-form-urlencoded" \
--data-urlencode "viewport=512,512" \
--data-urlencode "window=40,400,linear" \
--output rendered.png
Retrieve a rendered frame as JPEG with quality control
curl "http://localhost:3000/studies/1.2.840.../series/1.2.840.../instances/1.2.840.../frames/1/rendered?viewport=256,256&quality=85" \
[-H 'Authorization: Bearer <jwt-token>' \ ]
-H "Accept: image/jpeg" \
--output frame1.jpg
Retrieve a thumbnail
curl "http://localhost:3000/studies/1.2.840.../series/1.2.840.../instances/1.2.840.../thumbnail?viewport=128,128" \
[-H 'Authorization: Bearer <jwt-token>' \ ]
-H "Accept: image/jpeg" \
--output thumbnail.jpg
See also
- JWT Authorization — bearer-token authentication and study scoping of this interface
- STOW-RS — Store Instances — transfer syntax support, including the ingest-time transcoding rules that determine the stored syntax
- QIDO-RS — Search for Instances — find the study, series, and instance UIDs to use in these paths