PACS System 0.1.0
PACS DICOM system library
Loading...
Searching...
No Matches
kcenon::pacs::encoding::compression::codec_factory Class Reference

Factory class for creating compression codec instances. More...

#include <codec_factory.h>

Collaboration diagram for kcenon::pacs::encoding::compression::codec_factory:
Collaboration graph

Static Public Member Functions

static std::unique_ptr< compression_codeccreate (std::string_view transfer_syntax_uid)
 Creates a codec instance for the given Transfer Syntax UID.
 
static std::unique_ptr< compression_codeccreate (const transfer_syntax &ts)
 Creates a codec instance for the given Transfer Syntax.
 
static std::vector< std::string_view > supported_transfer_syntaxes ()
 Returns a list of all supported Transfer Syntax UIDs.
 
static bool is_supported (std::string_view transfer_syntax_uid)
 Checks if a Transfer Syntax is supported for compression.
 
static bool is_supported (const transfer_syntax &ts)
 Checks if a Transfer Syntax is supported for compression.
 

Private Member Functions

 codec_factory ()=delete
 

Detailed Description

Factory class for creating compression codec instances.

Provides a centralized registry for codec creation based on Transfer Syntax UID. Thread-safe: All factory methods can be called from multiple threads.

Usage:

auto codec = codec_factory::create("1.2.840.10008.1.2.4.50");
if (codec) {
auto result = codec->encode(pixel_data, params);
}
static std::unique_ptr< compression_codec > create(std::string_view transfer_syntax_uid)
Creates a codec instance for the given Transfer Syntax UID.

Definition at line 38 of file codec_factory.h.

Constructor & Destructor Documentation

◆ codec_factory()

kcenon::pacs::encoding::compression::codec_factory::codec_factory ( )
privatedelete

Member Function Documentation

◆ create() [1/2]

std::unique_ptr< compression_codec > kcenon::pacs::encoding::compression::codec_factory::create ( const transfer_syntax & ts)
staticnodiscard

Creates a codec instance for the given Transfer Syntax.

Parameters
tsThe Transfer Syntax object
Returns
A codec instance if supported, nullptr otherwise

Definition at line 135 of file codec_factory.cpp.

136 {
137 return create(ts.uid());
138}
Transfer Syntax UIDs.
Definition main.cpp:78

References create().

Here is the call graph for this function:

◆ create() [2/2]

std::unique_ptr< compression_codec > kcenon::pacs::encoding::compression::codec_factory::create ( std::string_view transfer_syntax_uid)
staticnodiscard

Creates a codec instance for the given Transfer Syntax UID.

Parameters
transfer_syntax_uidThe DICOM Transfer Syntax UID
Returns
A codec instance if supported, nullptr otherwise

Supported UIDs:

  • 1.2.840.10008.1.2.4.50 - JPEG Baseline (Process 1)

Definition at line 49 of file codec_factory.cpp.

50 {
51
52 // RLE Lossless (1.2.840.10008.1.2.5)
53 if (transfer_syntax_uid == rle_codec::kTransferSyntaxUID) {
54 return std::make_unique<rle_codec>();
55 }
56
57 // JPEG Baseline (Process 1)
58 if (transfer_syntax_uid == jpeg_baseline_codec::kTransferSyntaxUID) {
59 return std::make_unique<jpeg_baseline_codec>();
60 }
61
62 // JPEG Lossless (Process 14, Selection Value 1)
63 if (transfer_syntax_uid == jpeg_lossless_codec::kTransferSyntaxUID) {
64 return std::make_unique<jpeg_lossless_codec>();
65 }
66
67 // JPEG-LS Lossless (1.2.840.10008.1.2.4.80)
68 if (transfer_syntax_uid == jpeg_ls_codec::kTransferSyntaxUIDLossless) {
69 return std::make_unique<jpeg_ls_codec>(true); // lossless = true
70 }
71
72 // JPEG-LS Near-Lossless (1.2.840.10008.1.2.4.81)
73 if (transfer_syntax_uid == jpeg_ls_codec::kTransferSyntaxUIDNearLossless) {
74 return std::make_unique<jpeg_ls_codec>(false); // lossless = false
75 }
76
77 // JPEG 2000 Lossless Only (1.2.840.10008.1.2.4.90)
78 if (transfer_syntax_uid == jpeg2000_codec::kTransferSyntaxUIDLossless) {
79 return std::make_unique<jpeg2000_codec>(true); // lossless = true
80 }
81
82 // JPEG 2000 (1.2.840.10008.1.2.4.91) - can be lossy or lossless
83 if (transfer_syntax_uid == jpeg2000_codec::kTransferSyntaxUIDLossy) {
84 return std::make_unique<jpeg2000_codec>(false); // lossless = false (default lossy)
85 }
86
87 // HEVC/H.265 Main Profile (1.2.840.10008.1.2.4.107)
88 if (transfer_syntax_uid == hevc_codec::kTransferSyntaxUIDMain) {
89 return std::make_unique<hevc_codec>(false); // main10 = false
90 }
91
92 // HEVC/H.265 Main 10 Profile (1.2.840.10008.1.2.4.108)
93 if (transfer_syntax_uid == hevc_codec::kTransferSyntaxUIDMain10) {
94 return std::make_unique<hevc_codec>(true); // main10 = true
95 }
96
97 // JPEG XL Lossless (1.2.840.10008.1.2.4.110)
98 if (transfer_syntax_uid == jpegxl_codec::kTransferSyntaxUIDLossless) {
99 return std::make_unique<jpegxl_codec>(true, false);
100 }
101
102 // JPEG XL JPEG Recompression (1.2.840.10008.1.2.4.111)
103 if (transfer_syntax_uid == jpegxl_codec::kTransferSyntaxUIDJPEGRecompression) {
104 return std::make_unique<jpegxl_codec>(true, true);
105 }
106
107 // JPEG XL (1.2.840.10008.1.2.4.112) - lossy
108 if (transfer_syntax_uid == jpegxl_codec::kTransferSyntaxUIDLossy) {
109 return std::make_unique<jpegxl_codec>(false);
110 }
111
112 // HTJ2K Lossless Only (1.2.840.10008.1.2.4.201)
113 if (transfer_syntax_uid == htj2k_codec::kTransferSyntaxUIDLossless) {
114 return std::make_unique<htj2k_codec>(true, false);
115 }
116
117 // HTJ2K with RPCL Options (1.2.840.10008.1.2.4.202)
118 if (transfer_syntax_uid == htj2k_codec::kTransferSyntaxUIDRPCL) {
119 return std::make_unique<htj2k_codec>(true, true);
120 }
121
122 // HTJ2K (1.2.840.10008.1.2.4.203) - lossy
123 if (transfer_syntax_uid == htj2k_codec::kTransferSyntaxUIDLossy) {
124 return std::make_unique<htj2k_codec>(false);
125 }
126
127 // Frame Deflate (1.2.840.10008.1.2.11)
128 if (transfer_syntax_uid == frame_deflate_codec::kTransferSyntaxUID) {
129 return std::make_unique<frame_deflate_codec>();
130 }
131
132 return nullptr;
133}
static constexpr std::string_view kTransferSyntaxUID
DICOM Transfer Syntax UID for Frame Deflate.
static constexpr std::string_view kTransferSyntaxUIDMain10
DICOM Transfer Syntax UID for HEVC/H.265 Main 10 Profile / Level 5.1.
Definition hevc_codec.h:52
static constexpr std::string_view kTransferSyntaxUIDMain
DICOM Transfer Syntax UID for HEVC/H.265 Main Profile / Level 5.1.
Definition hevc_codec.h:48
static constexpr std::string_view kTransferSyntaxUIDLossy
DICOM Transfer Syntax UID for HTJ2K (Lossy)
Definition htj2k_codec.h:58
static constexpr std::string_view kTransferSyntaxUIDLossless
DICOM Transfer Syntax UID for HTJ2K Lossless Only.
Definition htj2k_codec.h:50
static constexpr std::string_view kTransferSyntaxUIDRPCL
DICOM Transfer Syntax UID for HTJ2K with RPCL Options (Lossless Only)
Definition htj2k_codec.h:54
static constexpr std::string_view kTransferSyntaxUIDLossy
DICOM Transfer Syntax UID for JPEG 2000 (Lossy or Lossless)
static constexpr std::string_view kTransferSyntaxUIDLossless
DICOM Transfer Syntax UID for JPEG 2000 Lossless Only.
static constexpr std::string_view kTransferSyntaxUID
DICOM Transfer Syntax UID for JPEG Baseline.
static constexpr std::string_view kTransferSyntaxUID
DICOM Transfer Syntax UID for JPEG Lossless (Process 14, Selection Value 1)
static constexpr std::string_view kTransferSyntaxUIDLossless
DICOM Transfer Syntax UID for JPEG-LS Lossless.
static constexpr std::string_view kTransferSyntaxUIDNearLossless
DICOM Transfer Syntax UID for JPEG-LS Near-Lossless (Lossy)
static constexpr std::string_view kTransferSyntaxUIDJPEGRecompression
DICOM Transfer Syntax UID for JPEG XL JPEG Recompression.
static constexpr std::string_view kTransferSyntaxUIDLossy
DICOM Transfer Syntax UID for JPEG XL (any mode)
static constexpr std::string_view kTransferSyntaxUIDLossless
DICOM Transfer Syntax UID for JPEG XL Lossless.
static constexpr std::string_view kTransferSyntaxUID
DICOM Transfer Syntax UID for RLE Lossless.
Definition rle_codec.h:52

References kcenon::pacs::encoding::compression::frame_deflate_codec::kTransferSyntaxUID, kcenon::pacs::encoding::compression::jpeg_baseline_codec::kTransferSyntaxUID, kcenon::pacs::encoding::compression::jpeg_lossless_codec::kTransferSyntaxUID, kcenon::pacs::encoding::compression::rle_codec::kTransferSyntaxUID, kcenon::pacs::encoding::compression::jpegxl_codec::kTransferSyntaxUIDJPEGRecompression, kcenon::pacs::encoding::compression::htj2k_codec::kTransferSyntaxUIDLossless, kcenon::pacs::encoding::compression::jpeg2000_codec::kTransferSyntaxUIDLossless, kcenon::pacs::encoding::compression::jpeg_ls_codec::kTransferSyntaxUIDLossless, kcenon::pacs::encoding::compression::jpegxl_codec::kTransferSyntaxUIDLossless, kcenon::pacs::encoding::compression::htj2k_codec::kTransferSyntaxUIDLossy, kcenon::pacs::encoding::compression::jpeg2000_codec::kTransferSyntaxUIDLossy, kcenon::pacs::encoding::compression::jpegxl_codec::kTransferSyntaxUIDLossy, kcenon::pacs::encoding::compression::hevc_codec::kTransferSyntaxUIDMain, kcenon::pacs::encoding::compression::hevc_codec::kTransferSyntaxUIDMain10, kcenon::pacs::encoding::compression::jpeg_ls_codec::kTransferSyntaxUIDNearLossless, and kcenon::pacs::encoding::compression::htj2k_codec::kTransferSyntaxUIDRPCL.

Referenced by create().

Here is the caller graph for this function:

◆ is_supported() [1/2]

bool kcenon::pacs::encoding::compression::codec_factory::is_supported ( const transfer_syntax & ts)
staticnodiscard

Checks if a Transfer Syntax is supported for compression.

Parameters
tsThe Transfer Syntax object
Returns
true if compression/decompression is supported

Definition at line 153 of file codec_factory.cpp.

153 {
154 return is_supported(ts.uid());
155}
static bool is_supported(std::string_view transfer_syntax_uid)
Checks if a Transfer Syntax is supported for compression.

References is_supported().

Here is the call graph for this function:

◆ is_supported() [2/2]

bool kcenon::pacs::encoding::compression::codec_factory::is_supported ( std::string_view transfer_syntax_uid)
staticnodiscard

Checks if a Transfer Syntax is supported for compression.

Parameters
transfer_syntax_uidThe DICOM Transfer Syntax UID
Returns
true if compression/decompression is supported

Definition at line 144 of file codec_factory.cpp.

144 {
145 for (const auto& uid : kSupportedTransferSyntaxes) {
146 if (uid == transfer_syntax_uid) {
147 return true;
148 }
149 }
150 return false;
151}
std::string_view uid

References uid.

Referenced by is_supported().

Here is the caller graph for this function:

◆ supported_transfer_syntaxes()

std::vector< std::string_view > kcenon::pacs::encoding::compression::codec_factory::supported_transfer_syntaxes ( )
staticnodiscard

Returns a list of all supported Transfer Syntax UIDs.

Returns
Vector of supported UIDs for compression codecs

Definition at line 140 of file codec_factory.cpp.

140 {
141 return {kSupportedTransferSyntaxes.begin(), kSupportedTransferSyntaxes.end()};
142}

The documentation for this class was generated from the following files: