1use 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 = "charls")]
38use crate::adapters::jpegls::{JpegLsAdapter, JpegLsLosslessWriter};
39#[cfg(feature = "jpegxl")]
40use crate::adapters::jpegxl::{JpegXlAdapter, JpegXlLosslessEncoder};
41#[cfg(feature = "rle")]
42use crate::adapters::rle_lossless::RleLosslessAdapter;
43#[cfg(feature = "deflate")]
44use crate::adapters::deflated::DeflatedImageFrameAdapter;
45#[cfg(feature = "deflate")]
46use crate::deflate::FlateAdapter;
47
48pub const IMPLICIT_VR_LITTLE_ENDIAN: Ts = Ts::new(
52 "1.2.840.10008.1.2",
53 "Implicit VR Little Endian",
54 Endianness::Little,
55 false,
56 Codec::None,
57);
58
59pub const EXPLICIT_VR_LITTLE_ENDIAN: Ts = Ts::new_ele(
61 "1.2.840.10008.1.2.1",
62 "Explicit VR Little Endian",
63 Codec::None,
64);
65
66pub const EXPLICIT_VR_BIG_ENDIAN: Ts = Ts::new(
68 "1.2.840.10008.1.2.2",
69 "Explicit VR Big Endian",
70 Endianness::Big,
71 true,
72 Codec::None,
73);
74
75pub const ENCAPSULATED_UNCOMPRESSED_EXPLICIT_VR_LITTLE_ENDIAN: TransferSyntax<
77 NeverAdapter,
78 UncompressedAdapter,
79 UncompressedAdapter,
80> = TransferSyntax::new_ele(
81 "1.2.840.10008.1.2.1.98",
82 "Encapsulated Uncompressed Explicit VR Little Endian",
83 Codec::EncapsulatedPixelData(Some(UncompressedAdapter), Some(UncompressedAdapter)),
84);
85
86#[cfg(feature = "rle")]
90pub const RLE_LOSSLESS: TransferSyntax<NeverAdapter, RleLosslessAdapter, NeverPixelAdapter> =
91 TransferSyntax::new_ele(
92 "1.2.840.10008.1.2.5",
93 "RLE Lossless",
94 Codec::EncapsulatedPixelData(Some(RleLosslessAdapter), None),
95 );
96#[cfg(not(feature = "rle"))]
101pub const RLE_LOSSLESS: Ts = create_ts_stub("1.2.840.10008.1.2.5", "RLE Lossless");
102
103#[cfg(feature = "jpeg")]
109type JpegTs<R = JpegAdapter, W = JpegAdapter> = TransferSyntax<NeverAdapter, R, W>;
110
111#[cfg(feature = "jpeg")]
113const fn create_ts_jpeg(uid: &'static str, name: &'static str, encoder: bool) -> JpegTs {
114 TransferSyntax::new_ele(
115 uid,
116 name,
117 Codec::EncapsulatedPixelData(
118 Some(JpegAdapter),
119 if encoder { Some(JpegAdapter) } else { None },
120 ),
121 )
122}
123
124#[cfg(feature = "jpeg")]
126pub const JPEG_BASELINE: JpegTs =
127 create_ts_jpeg("1.2.840.10008.1.2.4.50", "JPEG Baseline (Process 1)", true);
128#[cfg(not(feature = "jpeg"))]
133pub const JPEG_BASELINE: Ts = create_ts_stub("1.2.840.10008.1.2.4.50", "JPEG Baseline (Process 1)");
134
135#[cfg(feature = "jpeg")]
137pub const JPEG_EXTENDED: JpegTs = create_ts_jpeg(
138 "1.2.840.10008.1.2.4.51",
139 "JPEG Extended (Process 2 & 4)",
140 false,
141);
142#[cfg(not(feature = "jpeg"))]
147pub const JPEG_EXTENDED: Ts =
148 create_ts_stub("1.2.840.10008.1.2.4.51", "JPEG Extended (Process 2 & 4)");
149
150#[cfg(feature = "jpeg")]
152pub const JPEG_LOSSLESS_NON_HIERARCHICAL: JpegTs = create_ts_jpeg(
153 "1.2.840.10008.1.2.4.57",
154 "JPEG Lossless, Non-Hierarchical (Process 14)",
155 false,
156);
157#[cfg(not(feature = "jpeg"))]
162pub const JPEG_LOSSLESS_NON_HIERARCHICAL: Ts = create_ts_stub(
163 "1.2.840.10008.1.2.4.57",
164 "JPEG Lossless, Non-Hierarchical (Process 14)",
165);
166
167#[cfg(feature = "jpeg")]
171pub const JPEG_LOSSLESS_NON_HIERARCHICAL_FIRST_ORDER_PREDICTION: JpegTs = create_ts_jpeg(
172 "1.2.840.10008.1.2.4.70",
173 "JPEG Lossless, Non-Hierarchical, First-Order Prediction",
174 false,
175);
176#[cfg(not(feature = "jpeg"))]
183pub const JPEG_LOSSLESS_NON_HIERARCHICAL_FIRST_ORDER_PREDICTION: Ts = create_ts_stub(
184 "1.2.840.10008.1.2.4.70",
185 "JPEG Lossless, Non-Hierarchical, First-Order Prediction",
186);
187
188#[cfg(feature = "deflate")]
189pub const DEFLATED_EXPLICIT_VR_LITTLE_ENDIAN: TransferSyntax<
191 FlateAdapter,
192 NeverAdapter,
193 NeverAdapter,
194> = TransferSyntax::new(
195 "1.2.840.10008.1.2.1.99",
196 "Deflated Explicit VR Little Endian",
197 Endianness::Little,
198 true,
199 Codec::Dataset(Some(FlateAdapter)),
200);
201
202#[cfg(not(feature = "deflate"))]
203pub const DEFLATED_EXPLICIT_VR_LITTLE_ENDIAN: Ts = Ts::new_ele(
208 "1.2.840.10008.1.2.1.99",
209 "Deflated Explicit VR Little Endian",
210 Codec::Dataset(None),
211);
212
213#[cfg(feature = "deflate")]
217pub const JPIP_REFERENCED_DEFLATE: TransferSyntax<FlateAdapter, NeverAdapter, NeverAdapter> =
218 TransferSyntax::new(
219 "1.2.840.10008.1.2.4.95",
220 "JPIP Referenced Deflate",
221 Endianness::Little,
222 true,
223 Codec::Dataset(Some(FlateAdapter)),
224 );
225
226#[cfg(not(feature = "deflate"))]
231pub const JPIP_REFERENCED_DEFLATE: Ts = Ts::new_ele(
232 "1.2.840.10008.1.2.4.95",
233 "JPIP Referenced Deflate",
234 Codec::Dataset(None),
235);
236
237#[cfg(feature = "deflate")]
239pub const JPIP_HTJ2K_REFERENCED_DEFLATE: TransferSyntax<FlateAdapter, NeverAdapter, NeverAdapter> =
240 TransferSyntax::new(
241 "1.2.840.10008.1.2.4.205",
242 "JPIP HT2JK Referenced Deflate",
243 Endianness::Little,
244 true,
245 Codec::Dataset(Some(FlateAdapter)),
246 );
247
248#[cfg(not(feature = "deflate"))]
253pub const JPIP_HTJ2K_REFERENCED_DEFLATE: Ts = Ts::new_ele(
254 "1.2.840.10008.1.2.4.205",
255 "JPIP HTJ2K Referenced Deflate",
256 Codec::Dataset(None),
257);
258
259#[cfg(any(feature = "openjp2", feature = "openjpeg-sys"))]
265type Jpeg2000Ts<R = Jpeg2000Adapter, W = NeverPixelAdapter> = TransferSyntax<NeverAdapter, R, W>;
266
267#[cfg(any(feature = "openjp2", feature = "openjpeg-sys"))]
269const fn create_ts_jpeg2k(uid: &'static str, name: &'static str) -> Jpeg2000Ts {
270 TransferSyntax::new_ele(
271 uid,
272 name,
273 Codec::EncapsulatedPixelData(Some(Jpeg2000Adapter), None),
274 )
275}
276
277#[cfg(any(feature = "openjp2", feature = "openjpeg-sys"))]
279pub const JPEG_2000_IMAGE_COMPRESSION_LOSSLESS_ONLY: Jpeg2000Ts = create_ts_jpeg2k(
280 "1.2.840.10008.1.2.4.90",
281 "JPEG 2000 Image Compression (Lossless Only)",
282);
283#[cfg(not(any(feature = "openjp2", feature = "openjpeg-sys")))]
285pub const JPEG_2000_IMAGE_COMPRESSION_LOSSLESS_ONLY: Ts = create_ts_stub(
286 "1.2.840.10008.1.2.4.90",
287 "JPEG 2000 Image Compression (Lossless Only)",
288);
289
290#[cfg(any(feature = "openjp2", feature = "openjpeg-sys"))]
292pub const JPEG_2000_IMAGE_COMPRESSION: Jpeg2000Ts =
293 create_ts_jpeg2k("1.2.840.10008.1.2.4.91", "JPEG 2000 Image Compression");
294#[cfg(not(any(feature = "openjp2", feature = "openjpeg-sys")))]
296pub const JPEG_2000_IMAGE_COMPRESSION: Ts =
297 create_ts_stub("1.2.840.10008.1.2.4.91", "JPEG 2000 Image Compression");
298
299#[cfg(any(feature = "openjp2", feature = "openjpeg-sys"))]
301pub const JPEG_2000_PART2_MULTI_COMPONENT_IMAGE_COMPRESSION_LOSSLESS_ONLY: Jpeg2000Ts =
302 create_ts_jpeg2k(
303 "1.2.840.10008.1.2.4.92",
304 "JPEG 2000 Part 2 Multi-component Image Compression (Lossless Only)",
305 );
306#[cfg(not(any(feature = "openjp2", feature = "openjpeg-sys")))]
308pub const JPEG_2000_PART2_MULTI_COMPONENT_IMAGE_COMPRESSION_LOSSLESS_ONLY: Ts = create_ts_stub(
309 "1.2.840.10008.1.2.4.92",
310 "JPEG 2000 Part 2 Multi-component Image Compression (Lossless Only)",
311);
312
313#[cfg(any(feature = "openjp2", feature = "openjpeg-sys"))]
315pub const JPEG_2000_PART2_MULTI_COMPONENT_IMAGE_COMPRESSION: Jpeg2000Ts = create_ts_jpeg2k(
316 "1.2.840.10008.1.2.4.93",
317 "JPEG 2000 Part 2 Multi-component Image Compression",
318);
319#[cfg(not(any(feature = "openjp2", feature = "openjpeg-sys")))]
321pub const JPEG_2000_PART2_MULTI_COMPONENT_IMAGE_COMPRESSION: Ts = create_ts_stub(
322 "1.2.840.10008.1.2.4.93",
323 "JPEG 2000 Part 2 Multi-component Image Compression",
324);
325
326#[cfg(any(feature = "openjp2", feature = "openjpeg-sys"))]
330pub const HIGH_THROUGHPUT_JPEG_2000_IMAGE_COMPRESSION_LOSSLESS_ONLY: Jpeg2000Ts = create_ts_jpeg2k(
331 "1.2.840.10008.1.2.4.201",
332 "High-Throughput JPEG 2000 Image Compression (Lossless Only)",
333);
334#[cfg(not(any(feature = "openjp2", feature = "openjpeg-sys")))]
336pub const HIGH_THROUGHPUT_JPEG_2000_IMAGE_COMPRESSION_LOSSLESS_ONLY: Ts = create_ts_stub(
337 "1.2.840.10008.1.2.4.201",
338 "High-Throughput JPEG 2000 Image Compression (Lossless Only)",
339);
340
341#[cfg(any(feature = "openjp2", feature = "openjpeg-sys"))]
343pub const HIGH_THROUGHPUT_JPEG_2000_WITH_RPCL_OPTIONS_IMAGE_COMPRESSION_LOSSLESS_ONLY: Jpeg2000Ts =
344 create_ts_jpeg2k(
345 "1.2.840.10008.1.2.4.202",
346 "High-Throughput JPEG 2000 with RPCL Options Image Compression (Lossless Only)",
347 );
348#[cfg(not(any(feature = "openjp2", feature = "openjpeg-sys")))]
350pub const HIGH_THROUGHPUT_JPEG_2000_WITH_RPCL_OPTIONS_IMAGE_COMPRESSION_LOSSLESS_ONLY: Ts =
351 create_ts_stub(
352 "1.2.840.10008.1.2.4.202",
353 "High-Throughput JPEG 2000 with RPCL Options Image Compression (Lossless Only)",
354 );
355
356#[cfg(any(feature = "openjp2", feature = "openjpeg-sys"))]
358pub const HIGH_THROUGHPUT_JPEG_2000_IMAGE_COMPRESSION: Jpeg2000Ts = create_ts_jpeg2k(
359 "1.2.840.10008.1.2.4.203",
360 "High-Throughput JPEG 2000 Image Compression",
361);
362#[cfg(not(any(feature = "openjp2", feature = "openjpeg-sys")))]
364pub const HIGH_THROUGHPUT_JPEG_2000_IMAGE_COMPRESSION: Ts = create_ts_stub(
365 "1.2.840.10008.1.2.4.203",
366 "High-Throughput JPEG 2000 Image Compression",
367);
368
369#[cfg(feature = "charls")]
374type JpegLSTs<W> = TransferSyntax<NeverAdapter, JpegLsAdapter, W>;
375
376#[cfg(feature = "charls")]
378pub const JPEG_LS_LOSSLESS_IMAGE_COMPRESSION: JpegLSTs<JpegLsLosslessWriter> =
379 TransferSyntax::new_ele(
380 "1.2.840.10008.1.2.4.80",
381 "JPEG-LS Lossless Image Compression",
382 Codec::EncapsulatedPixelData(Some(JpegLsAdapter), Some(JpegLsLosslessWriter)),
383 );
384
385#[cfg(not(feature = "charls"))]
387pub const JPEG_LS_LOSSLESS_IMAGE_COMPRESSION: Ts = create_ts_stub(
388 "1.2.840.10008.1.2.4.80",
389 "JPEG-LS Lossless Image Compression",
390);
391
392#[cfg(feature = "charls")]
394pub const JPEG_LS_LOSSY_IMAGE_COMPRESSION: JpegLSTs<JpegLsAdapter> = TransferSyntax::new_ele(
395 "1.2.840.10008.1.2.4.81",
396 "JPEG-LS Lossy (Near-Lossless) Image Compression",
397 Codec::EncapsulatedPixelData(Some(JpegLsAdapter), Some(JpegLsAdapter)),
398);
399
400#[cfg(feature = "jpegxl")]
404type JpegXlTs<R = JpegXlAdapter, W = JpegXlAdapter> = TransferSyntax<NeverAdapter, R, W>;
405
406#[cfg(feature = "jpegxl")]
408pub const JPEG_XL_LOSSLESS: JpegXlTs<JpegXlAdapter, JpegXlLosslessEncoder> =
409 TransferSyntax::new_ele(
410 "1.2.840.10008.1.2.4.110",
411 "JPEG XL Lossless",
412 Codec::EncapsulatedPixelData(Some(JpegXlAdapter), Some(JpegXlLosslessEncoder)),
413 );
414
415#[cfg(not(feature = "jpegxl"))]
417pub const JPEG_XL_LOSSLESS: Ts = create_ts_stub("1.2.840.10008.1.2.4.110", "JPEG XL Lossless");
418
419#[cfg(feature = "jpegxl")]
421pub const JPEG_XL_RECOMPRESSION: JpegXlTs = TransferSyntax::new_ele(
422 "1.2.840.10008.1.2.4.111",
423 "JPEG XL Recompression",
424 Codec::EncapsulatedPixelData(Some(JpegXlAdapter), None),
425);
426
427#[cfg(not(feature = "jpegxl"))]
429pub const JPEG_XL_RECOMPRESSION: Ts =
430 create_ts_stub("1.2.840.10008.1.2.4.111", "JPEG XL Recompression");
431
432#[cfg(feature = "jpegxl")]
434pub const JPEG_XL: JpegXlTs = TransferSyntax::new_ele(
435 "1.2.840.10008.1.2.4.112",
436 "JPEG XL",
437 Codec::EncapsulatedPixelData(Some(JpegXlAdapter), Some(JpegXlAdapter)),
438);
439
440#[cfg(not(feature = "jpegxl"))]
442pub const JPEG_XL: Ts = create_ts_stub("1.2.840.10008.1.2.4.112", "JPEG XL");
443
444#[cfg(not(feature = "charls"))]
446pub const JPEG_LS_LOSSY_IMAGE_COMPRESSION: Ts = create_ts_stub(
447 "1.2.840.10008.1.2.4.81",
448 "JPEG-LS Lossy (Near-Lossless) Image Compression",
449);
450
451#[cfg(not(feature = "deflate"))]
453pub const DEFLATED_IMAGE_FRAME_COMPRESSION: Ts = create_ts_stub(
454 "1.2.840.10008.1.2.8.1",
455 "Deflated Image Frame Compression",
456);
457
458#[cfg(feature = "deflate")]
460pub const DEFLATED_IMAGE_FRAME_COMPRESSION: TransferSyntax<NeverAdapter, DeflatedImageFrameAdapter, DeflatedImageFrameAdapter> = TransferSyntax::new_ele(
461 "1.2.840.10008.1.2.8.1",
462 "Deflated Image Frame Compression",
463 Codec::EncapsulatedPixelData(Some(DeflatedImageFrameAdapter), Some(DeflatedImageFrameAdapter)),
464);
465
466pub const JPIP_REFERENCED: Ts = create_ts_stub("1.2.840.10008.1.2.4.94", "JPIP Referenced");
468
469pub const JPIP_HTJ2K_REFERENCED: Ts =
471 create_ts_stub("1.2.840.10008.1.2.4.204", "JPIP HTJ2K Referenced");
472
473pub const MPEG2_MAIN_PROFILE_MAIN_LEVEL: Ts =
475 create_ts_stub("1.2.840.10008.1.2.4.100", "MPEG2 Main Profile / Main Level");
476pub const FRAGMENTABLE_MPEG2_MAIN_PROFILE_MAIN_LEVEL: Ts = create_ts_stub(
478 "1.2.840.10008.1.2.4.100.1",
479 "Fragmentable MPEG2 Main Profile / Main Level",
480);
481pub const MPEG2_MAIN_PROFILE_HIGH_LEVEL: Ts =
483 create_ts_stub("1.2.840.10008.1.2.4.101", "MPEG2 Main Profile / High Level");
484pub const FRAGMENTABLE_MPEG2_MAIN_PROFILE_HIGH_LEVEL: Ts = create_ts_stub(
486 "1.2.840.10008.1.2.4.101.1",
487 "Fragmentable MPEG2 Main Profile / High Level",
488);
489pub const MPEG4_AVC_H264_HIGH_PROFILE: Ts = create_ts_stub(
491 "1.2.840.10008.1.2.4.102",
492 "MPEG-4 AVC/H.264 High Profile / Level 4.1",
493);
494pub const FRAGMENTABLE_MPEG4_AVC_H264_HIGH_PROFILE: Ts = create_ts_stub(
496 "1.2.840.10008.1.2.4.102.1",
497 "Fragmentable MPEG-4 AVC/H.264 High Profile / Level 4.1",
498);
499pub const MPEG4_AVC_H264_BD_COMPATIBLE_HIGH_PROFILE: Ts = create_ts_stub(
501 "1.2.840.10008.1.2.4.103",
502 "MPEG-4 AVC/H.264 BD-Compatible High Profile / Level 4.1",
503);
504pub const FRAGMENTABLE_MPEG4_AVC_H264_BD_COMPATIBLE_HIGH_PROFILE: Ts = create_ts_stub(
506 "1.2.840.10008.1.2.4.103.1",
507 "Fragmentable MPEG-4 AVC/H.264 BD-Compatible High Profile / Level 4.1",
508);
509pub const MPEG4_AVC_H264_HIGH_PROFILE_FOR_2D_VIDEO: Ts = create_ts_stub(
511 "1.2.840.10008.1.2.4.104",
512 "MPEG-4 AVC/H.264 High Profile / Level 4.2 For 2D Video",
513);
514pub const FRAGMENTABLE_MPEG4_AVC_H264_HIGH_PROFILE_FOR_2D_VIDEO: Ts = create_ts_stub(
516 "1.2.840.10008.1.2.4.104.1",
517 "Fragmentable MPEG-4 AVC/H.264 High Profile / Level 4.2 For 2D Video",
518);
519pub const MPEG4_AVC_H264_HIGH_PROFILE_FOR_3D_VIDEO: Ts = create_ts_stub(
521 "1.2.840.10008.1.2.4.105",
522 "MPEG-4 AVC/H.264 High Profile / Level 4.2 For 3D Video",
523);
524pub const FRAGMENTABLE_MPEG4_AVC_H264_HIGH_PROFILE_FOR_3D_VIDEO: Ts = create_ts_stub(
526 "1.2.840.10008.1.2.4.105.1",
527 "Fragmentable MPEG-4 AVC/H.264 High Profile / Level 4.2 For 3D Video",
528);
529pub const MPEG4_AVC_H264_STEREO_HIGH_PROFILE: Ts = create_ts_stub(
531 "1.2.840.10008.1.2.4.106",
532 "MPEG-4 AVC/H.264 Stereo High Profile / Level 4.2",
533);
534pub const FRAGMENTABLE_MPEG4_AVC_H264_STEREO_HIGH_PROFILE: Ts = create_ts_stub(
536 "1.2.840.10008.1.2.4.106.1",
537 "Fragmentable MPEG-4 AVC/H.264 Stereo High Profile / Level 4.2",
538);
539pub const HEVC_H265_MAIN_PROFILE: Ts = create_ts_stub(
541 "1.2.840.10008.1.2.4.107",
542 "HEVC/H.265 Main Profile / Level 5.1",
543);
544pub const HEVC_H265_MAIN_10_PROFILE: Ts = create_ts_stub(
546 "1.2.840.10008.1.2.4.108",
547 "HEVC/H.265 Main 10 Profile / Level 5.1",
548);
549pub const SMPTE_ST_2110_20_UNCOMPRESSED_PROGRESSIVE: Ts = create_ts_stub(
551 "1.2.840.10008.1.2.7.1",
552 "SMPTE ST 2110-20 Uncompressed Progressive Active Video",
553);
554pub const SMPTE_ST_2110_20_UNCOMPRESSED_INTERLACED: Ts = create_ts_stub(
556 "1.2.840.10008.1.2.7.2",
557 "SMPTE ST 2110-20 Uncompressed Interlaced Active Video",
558);
559pub const SMPTE_ST_2110_30_PCM: Ts = create_ts_stub(
561 "1.2.840.10008.1.2.7.3",
562 "SMPTE ST 2110-30 PCM Digital Audio",
563);