11 unstable releases

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

#1608 in Parser implementations

Download history 448/week @ 2023-12-05 666/week @ 2023-12-12 641/week @ 2023-12-19 52/week @ 2023-12-26 685/week @ 2024-01-02 912/week @ 2024-01-09 713/week @ 2024-01-16 887/week @ 2024-01-23 776/week @ 2024-01-30 738/week @ 2024-02-06 761/week @ 2024-02-13 1003/week @ 2024-02-20 702/week @ 2024-02-27 1235/week @ 2024-03-05 1242/week @ 2024-03-12 735/week @ 2024-03-19

4,047 downloads per month
Used in 22 crates (9 directly)

MIT/Apache

740KB
14K 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).


lib.rs:

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.

Dependencies

~6.5–9.5MB
~158K SLoC