11 unstable releases

new 0.6.2 Nov 21, 2023
0.6.0 Jul 23, 2023
0.5.1 Oct 23, 2022
0.5.0 Apr 28, 2022
0.1.0 Aug 31, 2019

#48 in Video

Download history 392/week @ 2023-08-06 404/week @ 2023-08-13 410/week @ 2023-08-20 616/week @ 2023-08-27 541/week @ 2023-09-03 594/week @ 2023-09-10 523/week @ 2023-09-17 674/week @ 2023-09-24 468/week @ 2023-10-01 901/week @ 2023-10-08 1085/week @ 2023-10-15 1116/week @ 2023-10-22 945/week @ 2023-10-29 1065/week @ 2023-11-05 946/week @ 2023-11-12 995/week @ 2023-11-19

3,992 downloads per month
Used in 21 crates (9 directly)


15K SLoC

DICOM-rs transfer-syntax-registry

CratesIO Documentation

This sub-project implements a registry of DICOM transfer syntaxes, which can be optionally extended.

An implementation based on inventory can be used through the Cargo feature inventory-registry. inventory allows for users to register new transfer syntax implementations in a compile time plugin-like fashion, but not all environments support it (such as WebAssembly).


This crate contains the DICOM transfer syntax registry.

The transfer syntax registry maps a DICOM UID of a transfer syntax (TS) into the respective transfer syntax specifier. This specifier defines:

  1. how to read and write DICOM data sets;
  2. how to decode and encode pixel data.

Support may be partial, in which case the data set can be retrieved but the pixel data may not be decoded through the DICOM-rs ecosystem. By default, adapters for encapsulated pixel data need to be explicitly added by dependent projects, such as dicom-pixeldata. When adding dicom-transfer-syntax-registry yourself, to include support for some transfer syntaxes with encapsulated pixel data, add the native Cargo feature or one of the other image encoding features available.

By default, a fixed known set of transfer syntaxes are provided as built in. Moreover, support for more TSes can be extended by other crates through the inventory pattern, in which the registry is automatically populated before main. This is done by enabling the Cargo feature inventory-registry. The feature can be left disabled for environments which do not support inventory, with the downside of only providing the built-in transfer syntaxes.

All registered TSes will be readily available through the TransferSyntaxRegistry type.

This registry is intended to be used in the development of higher level APIs, which should learn to negotiate and resolve the expected transfer syntax automatically.

Transfer Syntaxes

This crate encompasses basic DICOM level of conformance, plus support for some transfer syntaxes with compressed pixel data. Implicit VR Little Endian, Explicit VR Little Endian, and Explicit VR Big Endian are fully supported. Support may vary for transfer syntaxes which rely on encapsulated pixel data.

transfer syntax decoding support encoding support
JPEG Baseline (Process 1) Cargo feature jpeg
JPEG Extended (Process 2 & 4) Cargo feature jpeg x
JPEG Lossless, Non-Hierarchical (Process 14) Cargo feature jpeg x
JPEG Lossless, Non-Hierarchical, First-Order Prediction (Process 14 [Selection Value 1]) Cargo feature jpeg x
JPEG 2000 (Lossless Only) Cargo feature openjp2 or openjpeg-sys x
JPEG 2000 Cargo feature openjp2 or openjpeg-sys x
JPEG 2000 Part 2 Multi-component Image Compression (Lossless Only) Cargo feature openjp2 or openjpeg-sys x
JPEG 2000 Part 2 Multi-component Image Compression Cargo feature openjp2 or openjpeg-sys x
RLE Lossless Cargo feature rle x

Cargo features behind native (jpeg, rle, openjp2) provide implementations that are written in pure Rust, and so they are easier to build and may be available in all platforms supported by Rust. However, a native implementation might not always be available, or alternative implementations may be preferred:

  • openjpeg-sys provides a binding to the OpenJPEG reference implementation, which is written in C and is statically linked. It may offer better performance than the pure Rust implementation, but cannot be used in WebAssembly. Include openjpeg-sys-threads to build OpenJPEG with multithreading.

Transfer syntaxes which are not supported, either due to being unable to read the data set or decode encapsulated pixel data, are listed as stubs for partial support. The full list is available in the entries module. These stubs may also be replaced by separate libraries if using the inventory-based registry.


~155K SLoC