use crate::{adapters::uncompressed::UncompressedAdapter, create_ts_stub};
use byteordered::Endianness;
use dcmnorm_encoding::transfer_syntax::{AdapterFreeTransferSyntax as Ts, Codec};
use dcmnorm_encoding::transfer_syntax::{NeverAdapter, TransferSyntax};
#[cfg(any(feature = "rle", feature = "jpeg2000"))]
use dcmnorm_encoding::NeverPixelAdapter;
#[cfg(feature = "deflate")]
use crate::adapters::deflated::DeflatedImageFrameAdapter;
#[cfg(feature = "jpeg")]
use crate::adapters::jpeg::JpegAdapter;
#[cfg(feature = "jpeg2000")]
use crate::adapters::jpeg2k::{Htj2kAdapter, Jpeg2000Adapter};
#[cfg(feature = "rle")]
use crate::adapters::rle_lossless::RleLosslessAdapter;
#[cfg(feature = "deflate")]
use crate::deflate::FlateAdapter;
pub const IMPLICIT_VR_LITTLE_ENDIAN: Ts = Ts::new(
"1.2.840.10008.1.2",
"Implicit VR Little Endian",
Endianness::Little,
false,
Codec::None,
);
pub const EXPLICIT_VR_LITTLE_ENDIAN: Ts = Ts::new_ele(
"1.2.840.10008.1.2.1",
"Explicit VR Little Endian",
Codec::None,
);
pub const EXPLICIT_VR_BIG_ENDIAN: Ts = Ts::new(
"1.2.840.10008.1.2.2",
"Explicit VR Big Endian",
Endianness::Big,
true,
Codec::None,
);
pub const ENCAPSULATED_UNCOMPRESSED_EXPLICIT_VR_LITTLE_ENDIAN: TransferSyntax<
NeverAdapter,
UncompressedAdapter,
UncompressedAdapter,
> = TransferSyntax::new_ele(
"1.2.840.10008.1.2.1.98",
"Encapsulated Uncompressed Explicit VR Little Endian",
Codec::EncapsulatedPixelData(Some(UncompressedAdapter), Some(UncompressedAdapter)),
);
#[cfg(feature = "rle")]
pub const RLE_LOSSLESS: TransferSyntax<NeverAdapter, RleLosslessAdapter, NeverPixelAdapter> =
TransferSyntax::new_ele(
"1.2.840.10008.1.2.5",
"RLE Lossless",
Codec::EncapsulatedPixelData(Some(RleLosslessAdapter), None),
);
#[cfg(not(feature = "rle"))]
pub const RLE_LOSSLESS: Ts = create_ts_stub("1.2.840.10008.1.2.5", "RLE Lossless");
#[cfg(feature = "jpeg")]
type JpegTs<R = JpegAdapter, W = JpegAdapter> = TransferSyntax<NeverAdapter, R, W>;
#[cfg(feature = "jpeg")]
const fn create_ts_jpeg(uid: &'static str, name: &'static str, encoder: bool) -> JpegTs {
TransferSyntax::new_ele(
uid,
name,
Codec::EncapsulatedPixelData(
Some(JpegAdapter),
if encoder { Some(JpegAdapter) } else { None },
),
)
}
#[cfg(feature = "jpeg")]
pub const JPEG_BASELINE: JpegTs =
create_ts_jpeg("1.2.840.10008.1.2.4.50", "JPEG Baseline (Process 1)", true);
#[cfg(not(feature = "jpeg"))]
pub const JPEG_BASELINE: Ts = create_ts_stub("1.2.840.10008.1.2.4.50", "JPEG Baseline (Process 1)");
#[cfg(feature = "jpeg")]
pub const JPEG_EXTENDED: JpegTs = create_ts_jpeg(
"1.2.840.10008.1.2.4.51",
"JPEG Extended (Process 2 & 4)",
false,
);
#[cfg(not(feature = "jpeg"))]
pub const JPEG_EXTENDED: Ts =
create_ts_stub("1.2.840.10008.1.2.4.51", "JPEG Extended (Process 2 & 4)");
#[cfg(feature = "jpeg")]
pub const JPEG_LOSSLESS_NON_HIERARCHICAL: JpegTs = create_ts_jpeg(
"1.2.840.10008.1.2.4.57",
"JPEG Lossless, Non-Hierarchical (Process 14)",
false,
);
#[cfg(not(feature = "jpeg"))]
pub const JPEG_LOSSLESS_NON_HIERARCHICAL: Ts = create_ts_stub(
"1.2.840.10008.1.2.4.57",
"JPEG Lossless, Non-Hierarchical (Process 14)",
);
#[cfg(feature = "jpeg")]
pub const JPEG_LOSSLESS_NON_HIERARCHICAL_FIRST_ORDER_PREDICTION: JpegTs = create_ts_jpeg(
"1.2.840.10008.1.2.4.70",
"JPEG Lossless, Non-Hierarchical, First-Order Prediction",
false,
);
#[cfg(not(feature = "jpeg"))]
pub const JPEG_LOSSLESS_NON_HIERARCHICAL_FIRST_ORDER_PREDICTION: Ts = create_ts_stub(
"1.2.840.10008.1.2.4.70",
"JPEG Lossless, Non-Hierarchical, First-Order Prediction",
);
#[cfg(feature = "deflate")]
pub const DEFLATED_EXPLICIT_VR_LITTLE_ENDIAN: TransferSyntax<
FlateAdapter,
NeverAdapter,
NeverAdapter,
> = TransferSyntax::new(
"1.2.840.10008.1.2.1.99",
"Deflated Explicit VR Little Endian",
Endianness::Little,
true,
Codec::Dataset(Some(FlateAdapter)),
);
#[cfg(not(feature = "deflate"))]
pub const DEFLATED_EXPLICIT_VR_LITTLE_ENDIAN: Ts = Ts::new_ele(
"1.2.840.10008.1.2.1.99",
"Deflated Explicit VR Little Endian",
Codec::Dataset(None),
);
#[cfg(feature = "deflate")]
pub const JPIP_REFERENCED_DEFLATE: TransferSyntax<FlateAdapter, NeverAdapter, NeverAdapter> =
TransferSyntax::new(
"1.2.840.10008.1.2.4.95",
"JPIP Referenced Deflate",
Endianness::Little,
true,
Codec::Dataset(Some(FlateAdapter)),
);
#[cfg(not(feature = "deflate"))]
pub const JPIP_REFERENCED_DEFLATE: Ts = Ts::new_ele(
"1.2.840.10008.1.2.4.95",
"JPIP Referenced Deflate",
Codec::Dataset(None),
);
#[cfg(feature = "deflate")]
pub const JPIP_HTJ2K_REFERENCED_DEFLATE: TransferSyntax<FlateAdapter, NeverAdapter, NeverAdapter> =
TransferSyntax::new(
"1.2.840.10008.1.2.4.205",
"JPIP HT2JK Referenced Deflate",
Endianness::Little,
true,
Codec::Dataset(Some(FlateAdapter)),
);
#[cfg(not(feature = "deflate"))]
pub const JPIP_HTJ2K_REFERENCED_DEFLATE: Ts = Ts::new_ele(
"1.2.840.10008.1.2.4.205",
"JPIP HTJ2K Referenced Deflate",
Codec::Dataset(None),
);
#[cfg(feature = "jpeg2000")]
type Jpeg2000Ts<R = Jpeg2000Adapter, W = NeverPixelAdapter> = TransferSyntax<NeverAdapter, R, W>;
#[cfg(feature = "jpeg2000")]
const fn create_ts_jpeg2k(uid: &'static str, name: &'static str) -> Jpeg2000Ts {
TransferSyntax::new_ele(
uid,
name,
Codec::EncapsulatedPixelData(Some(Jpeg2000Adapter), None),
)
}
#[cfg(feature = "jpeg2000")]
pub const JPEG_2000_IMAGE_COMPRESSION_LOSSLESS_ONLY: Jpeg2000Ts = create_ts_jpeg2k(
"1.2.840.10008.1.2.4.90",
"JPEG 2000 Image Compression (Lossless Only)",
);
#[cfg(not(feature = "jpeg2000"))]
pub const JPEG_2000_IMAGE_COMPRESSION_LOSSLESS_ONLY: Ts = create_ts_stub(
"1.2.840.10008.1.2.4.90",
"JPEG 2000 Image Compression (Lossless Only)",
);
#[cfg(feature = "jpeg2000")]
pub const JPEG_2000_IMAGE_COMPRESSION: Jpeg2000Ts =
create_ts_jpeg2k("1.2.840.10008.1.2.4.91", "JPEG 2000 Image Compression");
#[cfg(not(feature = "jpeg2000"))]
pub const JPEG_2000_IMAGE_COMPRESSION: Ts =
create_ts_stub("1.2.840.10008.1.2.4.91", "JPEG 2000 Image Compression");
#[cfg(feature = "jpeg2000")]
pub const JPEG_2000_PART2_MULTI_COMPONENT_IMAGE_COMPRESSION_LOSSLESS_ONLY: Jpeg2000Ts =
create_ts_jpeg2k(
"1.2.840.10008.1.2.4.92",
"JPEG 2000 Part 2 Multi-component Image Compression (Lossless Only)",
);
#[cfg(not(feature = "jpeg2000"))]
pub const JPEG_2000_PART2_MULTI_COMPONENT_IMAGE_COMPRESSION_LOSSLESS_ONLY: Ts = create_ts_stub(
"1.2.840.10008.1.2.4.92",
"JPEG 2000 Part 2 Multi-component Image Compression (Lossless Only)",
);
#[cfg(feature = "jpeg2000")]
pub const JPEG_2000_PART2_MULTI_COMPONENT_IMAGE_COMPRESSION: Jpeg2000Ts = create_ts_jpeg2k(
"1.2.840.10008.1.2.4.93",
"JPEG 2000 Part 2 Multi-component Image Compression",
);
#[cfg(not(feature = "jpeg2000"))]
pub const JPEG_2000_PART2_MULTI_COMPONENT_IMAGE_COMPRESSION: Ts = create_ts_stub(
"1.2.840.10008.1.2.4.93",
"JPEG 2000 Part 2 Multi-component Image Compression",
);
#[cfg(feature = "jpeg2000")]
type Htj2kTs = TransferSyntax<NeverAdapter, Htj2kAdapter, NeverPixelAdapter>;
#[cfg(feature = "jpeg2000")]
const fn create_ts_htj2k(uid: &'static str, name: &'static str) -> Htj2kTs {
TransferSyntax::new_ele(
uid,
name,
Codec::EncapsulatedPixelData(Some(Htj2kAdapter), None),
)
}
#[cfg(feature = "jpeg2000")]
pub const HIGH_THROUGHPUT_JPEG_2000_IMAGE_COMPRESSION_LOSSLESS_ONLY: Htj2kTs = create_ts_htj2k(
"1.2.840.10008.1.2.4.201",
"High-Throughput JPEG 2000 Image Compression (Lossless Only)",
);
#[cfg(not(feature = "jpeg2000"))]
pub const HIGH_THROUGHPUT_JPEG_2000_IMAGE_COMPRESSION_LOSSLESS_ONLY: Ts = create_ts_stub(
"1.2.840.10008.1.2.4.201",
"High-Throughput JPEG 2000 Image Compression (Lossless Only)",
);
#[cfg(feature = "jpeg2000")]
pub const HIGH_THROUGHPUT_JPEG_2000_WITH_RPCL_OPTIONS_IMAGE_COMPRESSION_LOSSLESS_ONLY: Htj2kTs =
create_ts_htj2k(
"1.2.840.10008.1.2.4.202",
"High-Throughput JPEG 2000 with RPCL Options Image Compression (Lossless Only)",
);
#[cfg(not(feature = "jpeg2000"))]
pub const HIGH_THROUGHPUT_JPEG_2000_WITH_RPCL_OPTIONS_IMAGE_COMPRESSION_LOSSLESS_ONLY: Ts =
create_ts_stub(
"1.2.840.10008.1.2.4.202",
"High-Throughput JPEG 2000 with RPCL Options Image Compression (Lossless Only)",
);
#[cfg(feature = "jpeg2000")]
pub const HIGH_THROUGHPUT_JPEG_2000_IMAGE_COMPRESSION: Htj2kTs = create_ts_htj2k(
"1.2.840.10008.1.2.4.203",
"High-Throughput JPEG 2000 Image Compression",
);
#[cfg(not(feature = "jpeg2000"))]
pub const HIGH_THROUGHPUT_JPEG_2000_IMAGE_COMPRESSION: Ts = create_ts_stub(
"1.2.840.10008.1.2.4.203",
"High-Throughput JPEG 2000 Image Compression",
);
pub const JPEG_LS_LOSSLESS_IMAGE_COMPRESSION: Ts = create_ts_stub(
"1.2.840.10008.1.2.4.80",
"JPEG-LS Lossless Image Compression",
);
pub const JPEG_LS_LOSSY_IMAGE_COMPRESSION: Ts = create_ts_stub(
"1.2.840.10008.1.2.4.81",
"JPEG-LS Lossy (Near-Lossless) Image Compression",
);
pub const JPEG_XL_LOSSLESS: Ts = create_ts_stub("1.2.840.10008.1.2.4.110", "JPEG XL Lossless");
pub const JPEG_XL_RECOMPRESSION: Ts =
create_ts_stub("1.2.840.10008.1.2.4.111", "JPEG XL Recompression");
pub const JPEG_XL: Ts = create_ts_stub("1.2.840.10008.1.2.4.112", "JPEG XL");
#[cfg(not(feature = "deflate"))]
pub const DEFLATED_IMAGE_FRAME_COMPRESSION: Ts =
create_ts_stub("1.2.840.10008.1.2.8.1", "Deflated Image Frame Compression");
#[cfg(feature = "deflate")]
pub const DEFLATED_IMAGE_FRAME_COMPRESSION: TransferSyntax<
NeverAdapter,
DeflatedImageFrameAdapter,
DeflatedImageFrameAdapter,
> = TransferSyntax::new_ele(
"1.2.840.10008.1.2.8.1",
"Deflated Image Frame Compression",
Codec::EncapsulatedPixelData(
Some(DeflatedImageFrameAdapter),
Some(DeflatedImageFrameAdapter),
),
);
pub const JPIP_REFERENCED: Ts = create_ts_stub("1.2.840.10008.1.2.4.94", "JPIP Referenced");
pub const JPIP_HTJ2K_REFERENCED: Ts =
create_ts_stub("1.2.840.10008.1.2.4.204", "JPIP HTJ2K Referenced");
pub const MPEG2_MAIN_PROFILE_MAIN_LEVEL: Ts =
create_ts_stub("1.2.840.10008.1.2.4.100", "MPEG2 Main Profile / Main Level");
pub const FRAGMENTABLE_MPEG2_MAIN_PROFILE_MAIN_LEVEL: Ts = create_ts_stub(
"1.2.840.10008.1.2.4.100.1",
"Fragmentable MPEG2 Main Profile / Main Level",
);
pub const MPEG2_MAIN_PROFILE_HIGH_LEVEL: Ts =
create_ts_stub("1.2.840.10008.1.2.4.101", "MPEG2 Main Profile / High Level");
pub const FRAGMENTABLE_MPEG2_MAIN_PROFILE_HIGH_LEVEL: Ts = create_ts_stub(
"1.2.840.10008.1.2.4.101.1",
"Fragmentable MPEG2 Main Profile / High Level",
);
pub const MPEG4_AVC_H264_HIGH_PROFILE: Ts = create_ts_stub(
"1.2.840.10008.1.2.4.102",
"MPEG-4 AVC/H.264 High Profile / Level 4.1",
);
pub const FRAGMENTABLE_MPEG4_AVC_H264_HIGH_PROFILE: Ts = create_ts_stub(
"1.2.840.10008.1.2.4.102.1",
"Fragmentable MPEG-4 AVC/H.264 High Profile / Level 4.1",
);
pub const MPEG4_AVC_H264_BD_COMPATIBLE_HIGH_PROFILE: Ts = create_ts_stub(
"1.2.840.10008.1.2.4.103",
"MPEG-4 AVC/H.264 BD-Compatible High Profile / Level 4.1",
);
pub const FRAGMENTABLE_MPEG4_AVC_H264_BD_COMPATIBLE_HIGH_PROFILE: Ts = create_ts_stub(
"1.2.840.10008.1.2.4.103.1",
"Fragmentable MPEG-4 AVC/H.264 BD-Compatible High Profile / Level 4.1",
);
pub const MPEG4_AVC_H264_HIGH_PROFILE_FOR_2D_VIDEO: Ts = create_ts_stub(
"1.2.840.10008.1.2.4.104",
"MPEG-4 AVC/H.264 High Profile / Level 4.2 For 2D Video",
);
pub const FRAGMENTABLE_MPEG4_AVC_H264_HIGH_PROFILE_FOR_2D_VIDEO: Ts = create_ts_stub(
"1.2.840.10008.1.2.4.104.1",
"Fragmentable MPEG-4 AVC/H.264 High Profile / Level 4.2 For 2D Video",
);
pub const MPEG4_AVC_H264_HIGH_PROFILE_FOR_3D_VIDEO: Ts = create_ts_stub(
"1.2.840.10008.1.2.4.105",
"MPEG-4 AVC/H.264 High Profile / Level 4.2 For 3D Video",
);
pub const FRAGMENTABLE_MPEG4_AVC_H264_HIGH_PROFILE_FOR_3D_VIDEO: Ts = create_ts_stub(
"1.2.840.10008.1.2.4.105.1",
"Fragmentable MPEG-4 AVC/H.264 High Profile / Level 4.2 For 3D Video",
);
pub const MPEG4_AVC_H264_STEREO_HIGH_PROFILE: Ts = create_ts_stub(
"1.2.840.10008.1.2.4.106",
"MPEG-4 AVC/H.264 Stereo High Profile / Level 4.2",
);
pub const FRAGMENTABLE_MPEG4_AVC_H264_STEREO_HIGH_PROFILE: Ts = create_ts_stub(
"1.2.840.10008.1.2.4.106.1",
"Fragmentable MPEG-4 AVC/H.264 Stereo High Profile / Level 4.2",
);
pub const HEVC_H265_MAIN_PROFILE: Ts = create_ts_stub(
"1.2.840.10008.1.2.4.107",
"HEVC/H.265 Main Profile / Level 5.1",
);
pub const HEVC_H265_MAIN_10_PROFILE: Ts = create_ts_stub(
"1.2.840.10008.1.2.4.108",
"HEVC/H.265 Main 10 Profile / Level 5.1",
);
pub const SMPTE_ST_2110_20_UNCOMPRESSED_PROGRESSIVE: Ts = create_ts_stub(
"1.2.840.10008.1.2.7.1",
"SMPTE ST 2110-20 Uncompressed Progressive Active Video",
);
pub const SMPTE_ST_2110_20_UNCOMPRESSED_INTERLACED: Ts = create_ts_stub(
"1.2.840.10008.1.2.7.2",
"SMPTE ST 2110-20 Uncompressed Interlaced Active Video",
);
pub const SMPTE_ST_2110_30_PCM: Ts = create_ts_stub(
"1.2.840.10008.1.2.7.3",
"SMPTE ST 2110-30 PCM Digital Audio",
);