dicom_transfer_syntax_registry/
entries.rs

1//! A list of compiled transfer syntax specifiers.
2//!
3//! The constants exported here refer to the library's built-in support
4//! for DICOM transfer syntaxes.
5//!
6//! - **Fully implemented** means that the default transfer syntax registry
7//!   provides built-in support for reading and writing data sets,
8//!   as well as for encoding and decoding encapsulated pixel data,
9//!   if applicable.
10//! - When specified as **Implemented**,
11//!   the transfer syntax is supported to some extent
12//!   (usually decoding is supported but not encoding).
13//! - **Stub descriptors** serve to provide information about
14//!   the transfer syntax,
15//!   and may provide partial support.
16//!   In most cases it will be possible to read and write data sets,
17//!   but not encode or decode encapsulated pixel data.
18//!
19//! With the `inventory-registry` feature,
20//! stubs can be replaced by independently developed crates,
21//! hence expanding support for those transfer syntaxes
22//! to the registry.
23
24use crate::{adapters::uncompressed::UncompressedAdapter, create_ts_stub};
25use byteordered::Endianness;
26use dicom_encoding::transfer_syntax::{AdapterFreeTransferSyntax as Ts, Codec};
27
28use dicom_encoding::transfer_syntax::{NeverAdapter, TransferSyntax};
29
30#[cfg(any(feature = "rle", feature = "openjp2", feature = "openjpeg-sys"))]
31use dicom_encoding::NeverPixelAdapter;
32
33#[cfg(feature = "jpeg")]
34use crate::adapters::jpeg::JpegAdapter;
35#[cfg(any(feature = "openjp2", feature = "openjpeg-sys"))]
36use crate::adapters::jpeg2k::Jpeg2000Adapter;
37#[cfg(feature = "rle")]
38use crate::adapters::rle_lossless::RleLosslessAdapter;
39
40// -- the three base transfer syntaxes, fully supported --
41
42/// **Fully implemented:** Implicit VR Little Endian: Default Transfer Syntax for DICOM
43pub const IMPLICIT_VR_LITTLE_ENDIAN: Ts = Ts::new(
44    "1.2.840.10008.1.2",
45    "Implicit VR Little Endian",
46    Endianness::Little,
47    false,
48    Codec::None,
49);
50
51/// **Fully implemented:** Explicit VR Little Endian
52pub const EXPLICIT_VR_LITTLE_ENDIAN: Ts = Ts::new_ele(
53    "1.2.840.10008.1.2.1",
54    "Explicit VR Little Endian",
55    Codec::None,
56);
57
58/// **Fully implemented:** Explicit VR Big Endian
59pub const EXPLICIT_VR_BIG_ENDIAN: Ts = Ts::new(
60    "1.2.840.10008.1.2.2",
61    "Explicit VR Big Endian",
62    Endianness::Big,
63    true,
64    Codec::None,
65);
66
67/// **Fully implemented:** Encapsulated Uncompressed Explicit VR Little Endian
68pub const ENCAPSULATED_UNCOMPRESSED_EXPLICIT_VR_LITTLE_ENDIAN: TransferSyntax<
69    NeverAdapter,
70    UncompressedAdapter,
71    UncompressedAdapter,
72> = TransferSyntax::new_ele(
73    "1.2.840.10008.1.2.1.98",
74    "Encapsulated Uncompressed Explicit VR Little Endian",
75    Codec::EncapsulatedPixelData(Some(UncompressedAdapter), Some(UncompressedAdapter)),
76);
77
78// -- transfer syntaxes with pixel data adapters, fully supported --
79
80/// **Implemented:** RLE Lossless
81#[cfg(feature = "rle")]
82pub const RLE_LOSSLESS: TransferSyntax<NeverAdapter, RleLosslessAdapter, NeverPixelAdapter> =
83    TransferSyntax::new_ele(
84        "1.2.840.10008.1.2.5",
85        "RLE Lossless",
86        Codec::EncapsulatedPixelData(Some(RleLosslessAdapter), None),
87    );
88/// **Stub:** RLE Lossless
89///
90/// A native implementation is available
91/// by enabling the `rle` Cargo feature.
92#[cfg(not(feature = "rle"))]
93pub const RLE_LOSSLESS: Ts = create_ts_stub("1.2.840.10008.1.2.5", "RLE Lossless");
94
95// JPEG encoded pixel data
96
97/// An alias for a transfer syntax specifier with [`JpegAdapter`]
98/// (supports decoding and encoding to JPEG baseline,
99/// support for JPEG extended and JPEG lossless may vary).
100#[cfg(feature = "jpeg")]
101type JpegTs<R = JpegAdapter, W = JpegAdapter> = TransferSyntax<NeverAdapter, R, W>;
102
103/// Create a transfer syntax with JPEG encapsulated pixel data
104#[cfg(feature = "jpeg")]
105const fn create_ts_jpeg(uid: &'static str, name: &'static str, encoder: bool) -> JpegTs {
106    TransferSyntax::new_ele(
107        uid,
108        name,
109        Codec::EncapsulatedPixelData(
110            Some(JpegAdapter),
111            if encoder { Some(JpegAdapter) } else { None },
112        ),
113    )
114}
115
116/// **Implemented:** JPEG Baseline (Process 1): Default Transfer Syntax for Lossy JPEG 8 Bit Image Compression
117#[cfg(feature = "jpeg")]
118pub const JPEG_BASELINE: JpegTs =
119    create_ts_jpeg("1.2.840.10008.1.2.4.50", "JPEG Baseline (Process 1)", true);
120/// **Implemented:** JPEG Baseline (Process 1): Default Transfer Syntax for Lossy JPEG 8 Bit Image Compression
121///
122/// A native implementation is available
123/// by enabling the `jpeg` Cargo feature.
124#[cfg(not(feature = "jpeg"))]
125pub const JPEG_BASELINE: Ts = create_ts_stub("1.2.840.10008.1.2.4.50", "JPEG Baseline (Process 1)");
126
127/// **Implemented:** JPEG Extended (Process 2 & 4): Default Transfer Syntax for Lossy JPEG 12 Bit Image Compression (Process 4 only)
128#[cfg(feature = "jpeg")]
129pub const JPEG_EXTENDED: JpegTs = create_ts_jpeg(
130    "1.2.840.10008.1.2.4.51",
131    "JPEG Extended (Process 2 & 4)",
132    false,
133);
134/// **Stub descriptor:** JPEG Extended (Process 2 & 4): Default Transfer Syntax for Lossy JPEG 12 Bit Image Compression (Process 4 only)
135///
136/// A native implementation is available
137/// by enabling the `jpeg` Cargo feature.
138#[cfg(not(feature = "jpeg"))]
139pub const JPEG_EXTENDED: Ts =
140    create_ts_stub("1.2.840.10008.1.2.4.51", "JPEG Extended (Process 2 & 4)");
141
142/// **Implemented:** JPEG Lossless, Non-Hierarchical (Process 14)
143#[cfg(feature = "jpeg")]
144pub const JPEG_LOSSLESS_NON_HIERARCHICAL: JpegTs = create_ts_jpeg(
145    "1.2.840.10008.1.2.4.57",
146    "JPEG Lossless, Non-Hierarchical (Process 14)",
147    false,
148);
149/// **Stub descriptor:** JPEG Lossless, Non-Hierarchical (Process 14)
150///
151/// A native implementation is available
152/// by enabling the `jpeg` Cargo feature.
153#[cfg(not(feature = "jpeg"))]
154pub const JPEG_LOSSLESS_NON_HIERARCHICAL: Ts = create_ts_stub(
155    "1.2.840.10008.1.2.4.57",
156    "JPEG Lossless, Non-Hierarchical (Process 14)",
157);
158
159/// **Implemented:** JPEG Lossless, Non-Hierarchical, First-Order Prediction
160/// (Process 14 [Selection Value 1]):
161/// Default Transfer Syntax for Lossless JPEG Image Compression
162#[cfg(feature = "jpeg")]
163pub const JPEG_LOSSLESS_NON_HIERARCHICAL_FIRST_ORDER_PREDICTION: JpegTs = create_ts_jpeg(
164    "1.2.840.10008.1.2.4.70",
165    "JPEG Lossless, Non-Hierarchical, First-Order Prediction",
166    false,
167);
168/// **Stub descriptor:** JPEG Lossless, Non-Hierarchical, First-Order Prediction
169/// (Process 14 [Selection Value 1]):
170/// Default Transfer Syntax for Lossless JPEG Image Compression
171///
172/// A native implementation is available
173/// by enabling the `jpeg` Cargo feature.
174#[cfg(not(feature = "jpeg"))]
175pub const JPEG_LOSSLESS_NON_HIERARCHICAL_FIRST_ORDER_PREDICTION: Ts = create_ts_stub(
176    "1.2.840.10008.1.2.4.70",
177    "JPEG Lossless, Non-Hierarchical, First-Order Prediction",
178);
179
180// --- stub transfer syntaxes, known but not supported ---
181
182/// **Stub descriptor:** Deflated Explicit VR Little Endian
183pub const DEFLATED_EXPLICIT_VR_LITTLE_ENDIAN: Ts = Ts::new_ele(
184    "1.2.840.10008.1.2.1.99",
185    "Deflated Explicit VR Little Endian",
186    Codec::Dataset(None),
187);
188
189/// **Stub descriptor:** JPIP Referenced Deflate
190pub const JPIP_REFERENCED_DEFLATE: Ts = Ts::new_ele(
191    "1.2.840.10008.1.2.4.95",
192    "JPIP Referenced Deflate",
193    Codec::Dataset(None),
194);
195
196// --- JPEG 2000 support ---
197
198/// An alias for a transfer syntax specifier with [`Jpeg2000Adapter`]
199/// (supports decoding and encoding to JPEG baseline,
200/// support for JPEG extended and JPEG lossless may vary).
201#[cfg(any(feature = "openjp2", feature = "openjpeg-sys"))]
202type Jpeg2000Ts<R = Jpeg2000Adapter, W = NeverPixelAdapter> = TransferSyntax<NeverAdapter, R, W>;
203
204/// Create a transfer syntax with JPEG 2000 encapsulated pixel data
205#[cfg(any(feature = "openjp2", feature = "openjpeg-sys"))]
206const fn create_ts_jpeg2k(uid: &'static str, name: &'static str) -> Jpeg2000Ts {
207    TransferSyntax::new_ele(
208        uid,
209        name,
210        Codec::EncapsulatedPixelData(Some(Jpeg2000Adapter), None),
211    )
212}
213
214/// **Decoder implementation:** JPEG 2000 Image Compression (Lossless Only)
215#[cfg(any(feature = "openjp2", feature = "openjpeg-sys"))]
216pub const JPEG_2000_IMAGE_COMPRESSION_LOSSLESS_ONLY: Jpeg2000Ts = create_ts_jpeg2k(
217    "1.2.840.10008.1.2.4.90",
218    "JPEG 2000 Image Compression (Lossless Only)",
219);
220/// **Stub descriptor:** JPEG 2000 Image Compression (Lossless Only)
221#[cfg(not(any(feature = "openjp2", feature = "openjpeg-sys")))]
222pub const JPEG_2000_IMAGE_COMPRESSION_LOSSLESS_ONLY: Ts = create_ts_stub(
223    "1.2.840.10008.1.2.4.90",
224    "JPEG 2000 Image Compression (Lossless Only)",
225);
226
227/// **Decoder implementation:** JPEG 2000 Image Compression
228#[cfg(any(feature = "openjp2", feature = "openjpeg-sys"))]
229pub const JPEG_2000_IMAGE_COMPRESSION: Jpeg2000Ts =
230    create_ts_jpeg2k("1.2.840.10008.1.2.4.91", "JPEG 2000 Image Compression");
231/// **Stub descriptor:** JPEG 2000 Image Compression
232#[cfg(not(any(feature = "openjp2", feature = "openjpeg-sys")))]
233pub const JPEG_2000_IMAGE_COMPRESSION: Ts =
234    create_ts_stub("1.2.840.10008.1.2.4.91", "JPEG 2000 Image Compression");
235
236/// **Decoder implementation:** JPEG 2000 Part 2 Multi-component Image Compression (Lossless Only)
237#[cfg(any(feature = "openjp2", feature = "openjpeg-sys"))]
238pub const JPEG_2000_PART2_MULTI_COMPONENT_IMAGE_COMPRESSION_LOSSLESS_ONLY: Jpeg2000Ts =
239    create_ts_jpeg2k(
240        "1.2.840.10008.1.2.4.92",
241        "JPEG 2000 Part 2 Multi-component Image Compression (Lossless Only)",
242    );
243/// **Stub descriptor:** JPEG 2000 Part 2 Multi-component Image Compression (Lossless Only)
244#[cfg(not(any(feature = "openjp2", feature = "openjpeg-sys")))]
245pub const JPEG_2000_PART2_MULTI_COMPONENT_IMAGE_COMPRESSION_LOSSLESS_ONLY: Ts = create_ts_stub(
246    "1.2.840.10008.1.2.4.92",
247    "JPEG 2000 Part 2 Multi-component Image Compression (Lossless Only)",
248);
249
250/// **Decoder implementation:** JPEG 2000 Part 2 Multi-component Image Compression
251#[cfg(any(feature = "openjp2", feature = "openjpeg-sys"))]
252pub const JPEG_2000_PART2_MULTI_COMPONENT_IMAGE_COMPRESSION: Jpeg2000Ts = create_ts_jpeg2k(
253    "1.2.840.10008.1.2.4.93",
254    "JPEG 2000 Part 2 Multi-component Image Compression",
255);
256/// **Stub descriptor:** JPEG 2000 Part 2 Multi-component Image Compression
257#[cfg(not(any(feature = "openjp2", feature = "openjpeg-sys")))]
258pub const JPEG_2000_PART2_MULTI_COMPONENT_IMAGE_COMPRESSION: Ts = create_ts_stub(
259    "1.2.840.10008.1.2.4.93",
260    "JPEG 2000 Part 2 Multi-component Image Compression",
261);
262
263// --- partially supported transfer syntaxes, pixel data encapsulation not supported ---
264
265/// **Stub descriptor:** JPEG-LS Lossless Image Compression
266pub const JPEG_LS_LOSSLESS_IMAGE_COMPRESSION: Ts = create_ts_stub(
267    "1.2.840.10008.1.2.4.80",
268    "JPEG-LS Lossless Image Compression",
269);
270/// **Stub descriptor:** JPEG-LS Lossy (Near-Lossless) Image Compression
271pub const JPEG_LS_LOSSY_IMAGE_COMPRESSION: Ts = create_ts_stub(
272    "1.2.840.10008.1.2.4.81",
273    "JPEG-LS Lossy (Near-Lossless) Image Compression",
274);
275
276/// **Stub descriptor:** JPIP Referenced
277pub const JPIP_REFERENCED: Ts = create_ts_stub("1.2.840.10008.1.2.4.94", "JPIP Referenced");
278
279/// **Stub descriptor:** MPEG2 Main Profile / Main Level
280pub const MPEG2_MAIN_PROFILE_MAIN_LEVEL: Ts =
281    create_ts_stub("1.2.840.10008.1.2.4.100", "MPEG2 Main Profile / Main Level");
282/// **Stub descriptor:** Fragmentable MPEG2 Main Profile / Main Level
283pub const FRAGMENTABLE_MPEG2_MAIN_PROFILE_MAIN_LEVEL: Ts = create_ts_stub(
284    "1.2.840.10008.1.2.4.100.1",
285    "Fragmentable MPEG2 Main Profile / Main Level",
286);
287/// **Stub descriptor:** MPEG2 Main Profile / High Level
288pub const MPEG2_MAIN_PROFILE_HIGH_LEVEL: Ts =
289    create_ts_stub("1.2.840.10008.1.2.4.101", "MPEG2 Main Profile / High Level");
290/// **Stub descriptor:** Fragmentable MPEG2 Main Profile / High Level
291pub const FRAGMENTABLE_MPEG2_MAIN_PROFILE_HIGH_LEVEL: Ts = create_ts_stub(
292    "1.2.840.10008.1.2.4.101.1",
293    "Fragmentable MPEG2 Main Profile / High Level",
294);
295/// **Stub descriptor:** MPEG-4 AVC/H.264 High Profile / Level 4.1
296pub const MPEG4_AVC_H264_HIGH_PROFILE: Ts = create_ts_stub(
297    "1.2.840.10008.1.2.4.102",
298    "MPEG-4 AVC/H.264 High Profile / Level 4.1",
299);
300/// **Stub descriptor:** Fragmentable MPEG-4 AVC/H.264 High Profile / Level 4.1
301pub const FRAGMENTABLE_MPEG4_AVC_H264_HIGH_PROFILE: Ts = create_ts_stub(
302    "1.2.840.10008.1.2.4.102.1",
303    "Fragmentable MPEG-4 AVC/H.264 High Profile / Level 4.1",
304);
305/// **Stub descriptor:** MPEG-4 AVC/H.264 BD-Compatible High Profile / Level 4.1
306pub const MPEG4_AVC_H264_BD_COMPATIBLE_HIGH_PROFILE: Ts = create_ts_stub(
307    "1.2.840.10008.1.2.4.103",
308    "MPEG-4 AVC/H.264 BD-Compatible High Profile / Level 4.1",
309);
310/// **Stub descriptor:** Fragmentable MPEG-4 AVC/H.264 BD-Compatible High Profile / Level 4.1
311pub const FRAGMENTABLE_MPEG4_AVC_H264_BD_COMPATIBLE_HIGH_PROFILE: Ts = create_ts_stub(
312    "1.2.840.10008.1.2.4.103.1",
313    "Fragmentable MPEG-4 AVC/H.264 BD-Compatible High Profile / Level 4.1",
314);
315/// **Stub descriptor:** MPEG-4 AVC/H.264 High Profile / Level 4.2 For 2D Video
316pub const MPEG4_AVC_H264_HIGH_PROFILE_FOR_2D_VIDEO: Ts = create_ts_stub(
317    "1.2.840.10008.1.2.4.104",
318    "MPEG-4 AVC/H.264 High Profile / Level 4.2 For 2D Video",
319);
320/// **Stub descriptor:** Fragmentable MPEG-4 AVC/H.264 High Profile / Level 4.2 For 2D Video
321pub const FRAGMENTABLE_MPEG4_AVC_H264_HIGH_PROFILE_FOR_2D_VIDEO: Ts = create_ts_stub(
322    "1.2.840.10008.1.2.4.104.1",
323    "Fragmentable MPEG-4 AVC/H.264 High Profile / Level 4.2 For 2D Video",
324);
325/// **Stub descriptor:** MPEG-4 AVC/H.264 High Profile / Level 4.2 For 3D Video
326pub const MPEG4_AVC_H264_HIGH_PROFILE_FOR_3D_VIDEO: Ts = create_ts_stub(
327    "1.2.840.10008.1.2.4.105",
328    "MPEG-4 AVC/H.264 High Profile / Level 4.2 For 3D Video",
329);
330/// **Stub descriptor:** Fragmentable MPEG-4 AVC/H.264 High Profile / Level 4.2 For 3D Video
331pub const FRAGMENTABLE_MPEG4_AVC_H264_HIGH_PROFILE_FOR_3D_VIDEO: Ts = create_ts_stub(
332    "1.2.840.10008.1.2.4.105.1",
333    "Fragmentable MPEG-4 AVC/H.264 High Profile / Level 4.2 For 3D Video",
334);
335/// **Stub descriptor:** MPEG-4 AVC/H.264 High Profile / Level 4.2
336pub const MPEG4_AVC_H264_STEREO_HIGH_PROFILE: Ts = create_ts_stub(
337    "1.2.840.10008.1.2.4.106",
338    "MPEG-4 AVC/H.264 Stereo High Profile / Level 4.2",
339);
340/// **Stub descriptor:** Fragmentable MPEG-4 AVC/H.264 Stereo High Profile / Level 4.2
341pub const FRAGMENTABLE_MPEG4_AVC_H264_STEREO_HIGH_PROFILE: Ts = create_ts_stub(
342    "1.2.840.10008.1.2.4.106.1",
343    "Fragmentable MPEG-4 AVC/H.264 Stereo High Profile / Level 4.2",
344);
345/// **Stub descriptor:** HEVC/H.265 Main Profile / Level 5.1
346pub const HEVC_H265_MAIN_PROFILE: Ts = create_ts_stub(
347    "1.2.840.10008.1.2.4.107",
348    "HEVC/H.265 Main Profile / Level 5.1",
349);
350/// **Stub descriptor:** HEVC/H.265 Main 10 Profile / Level 5.1
351pub const HEVC_H265_MAIN_10_PROFILE: Ts = create_ts_stub(
352    "1.2.840.10008.1.2.4.108",
353    "HEVC/H.265 Main 10 Profile / Level 5.1",
354);
355/// **Stub descriptor:** SMPTE ST 2110-20 Uncompressed Progressive Active Video
356pub const SMPTE_ST_2110_20_UNCOMPRESSED_PROGRESSIVE: Ts = create_ts_stub(
357    "1.2.840.10008.1.2.7.1",
358    "SMPTE ST 2110-20 Uncompressed Progressive Active Video",
359);
360/// **Stub descriptor:** SMPTE ST 2110-20 Uncompressed Interlaced Active Video
361pub const SMPTE_ST_2110_20_UNCOMPRESSED_INTERLACED: Ts = create_ts_stub(
362    "1.2.840.10008.1.2.7.2",
363    "SMPTE ST 2110-20 Uncompressed Interlaced Active Video",
364);
365/// **Stub descriptor:** SMPTE ST 2110-30 PCM Digital Audio
366pub const SMPTE_ST_2110_30_PCM: Ts = create_ts_stub(
367    "1.2.840.10008.1.2.7.3",
368    "SMPTE ST 2110-30 PCM Digital Audio",
369);