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

Represents a DICOM Transfer Syntax. More...

#include <transfer_syntax.h>

Collaboration diagram for kcenon::pacs::encoding::transfer_syntax:
Collaboration graph

Public Member Functions

 transfer_syntax (std::string_view uid)
 Constructs a transfer_syntax from a UID string.
 
Property Accessors
std::string_view uid () const noexcept
 Returns the Transfer Syntax UID.
 
std::string_view name () const noexcept
 Returns the human-readable name of the Transfer Syntax.
 
byte_order endianness () const noexcept
 Returns the byte ordering for this Transfer Syntax.
 
vr_encoding vr_type () const noexcept
 Returns the VR encoding mode for this Transfer Syntax.
 
bool is_encapsulated () const noexcept
 Checks if this Transfer Syntax uses encapsulated (compressed) format.
 
bool is_deflated () const noexcept
 Checks if this Transfer Syntax uses deflate compression.
 
Validation
bool is_valid () const noexcept
 Checks if this is a recognized DICOM Transfer Syntax.
 
bool is_supported () const noexcept
 Checks if this Transfer Syntax is currently supported.
 
Comparison Operators
bool operator== (const transfer_syntax &other) const noexcept
 Compares two Transfer Syntaxes by UID.
 
bool operator!= (const transfer_syntax &other) const noexcept
 Compares two Transfer Syntaxes by UID.
 

Static Public Attributes

Standard Transfer Syntax Instances
static const transfer_syntax implicit_vr_little_endian
 Implicit VR Little Endian (1.2.840.10008.1.2)
 
static const transfer_syntax explicit_vr_little_endian
 Explicit VR Little Endian (1.2.840.10008.1.2.1)
 
static const transfer_syntax explicit_vr_big_endian
 Explicit VR Big Endian (1.2.840.10008.1.2.2) - Retired.
 
static const transfer_syntax deflated_explicit_vr_le
 Deflated Explicit VR Little Endian (1.2.840.10008.1.2.1.99)
 
static const transfer_syntax jpeg_baseline
 JPEG Baseline (Process 1) (1.2.840.10008.1.2.4.50)
 
static const transfer_syntax jpeg_lossless
 JPEG Lossless, Non-Hierarchical (1.2.840.10008.1.2.4.70)
 
static const transfer_syntax jpeg2000_lossless
 JPEG 2000 Image Compression (Lossless Only) (1.2.840.10008.1.2.4.90)
 
static const transfer_syntax jpeg2000_lossy
 JPEG 2000 Image Compression (1.2.840.10008.1.2.4.91)
 
static const transfer_syntax rle_lossless
 RLE Lossless (1.2.840.10008.1.2.5)
 
static const transfer_syntax htj2k_lossless
 HTJ2K Lossless Only (1.2.840.10008.1.2.4.201)
 
static const transfer_syntax htj2k_rpcl
 HTJ2K RPCL (1.2.840.10008.1.2.4.202) - Lossless Only.
 
static const transfer_syntax htj2k_lossy
 HTJ2K (1.2.840.10008.1.2.4.203) - Lossless or Lossy.
 
static const transfer_syntax hevc_main
 HEVC/H.265 Main Profile / Level 5.1 (1.2.840.10008.1.2.4.107)
 
static const transfer_syntax hevc_main10
 HEVC/H.265 Main 10 Profile / Level 5.1 (1.2.840.10008.1.2.4.108)
 
static const transfer_syntax jpegxl_lossless
 JPEG XL Lossless (1.2.840.10008.1.2.4.110) - Supplement 232.
 
static const transfer_syntax jpegxl_jpeg_recompression
 JPEG XL JPEG Recompression (1.2.840.10008.1.2.4.111) - Supplement 232.
 
static const transfer_syntax jpegxl_lossy
 JPEG XL (1.2.840.10008.1.2.4.112) - Supplement 232.
 
static const transfer_syntax frame_deflate
 Frame Deflate (1.2.840.10008.1.2.11) - Supplement 244.
 

Private Member Functions

 transfer_syntax (std::string_view uid, std::string_view name, byte_order endian, vr_encoding vr, bool encapsulated, bool deflated, bool supported)
 Private constructor for static instances and registry functions.
 

Private Attributes

std::string uid_
 
std::string name_
 
byte_order endianness_
 
vr_encoding vr_type_
 
bool encapsulated_
 
bool deflated_
 
bool valid_
 
bool supported_
 

Friends

std::optional< transfer_syntaxfind_transfer_syntax (std::string_view uid)
 Allow registry functions to use private constructor.
 
std::vector< transfer_syntaxsupported_transfer_syntaxes ()
 Returns a list of all supported Transfer Syntaxes.
 
std::vector< transfer_syntaxall_transfer_syntaxes ()
 Returns a list of all known Transfer Syntaxes.
 

Detailed Description

Represents a DICOM Transfer Syntax.

Transfer Syntax defines how DICOM data is encoded, including:

  • Byte ordering (little-endian or big-endian)
  • VR encoding (implicit or explicit)
  • Compression (encapsulated pixel data)

Each Transfer Syntax is uniquely identified by a UID.

See also
DICOM PS3.5 Section 10 - Transfer Syntax
Examples
dcm_conv/main.cpp.

Definition at line 35 of file transfer_syntax.h.

Constructor & Destructor Documentation

◆ transfer_syntax() [1/2]

kcenon::pacs::encoding::transfer_syntax::transfer_syntax ( std::string_view uid)
explicit

Constructs a transfer_syntax from a UID string.

Parameters
uidThe Transfer Syntax UID (e.g., "1.2.840.10008.1.2")

If the UID is not recognized, the transfer_syntax will be invalid (is_valid() returns false).

Definition at line 297 of file transfer_syntax.cpp.

298 : uid_(uid),
299 name_("Unknown"),
302 encapsulated_(false),
303 deflated_(false),
304 valid_(false),
305 supported_(false) {
306 if (const auto* entry = find_entry(uid)) {
307 name_ = entry->name;
308 endianness_ = entry->endian;
309 vr_type_ = entry->vr;
310 encapsulated_ = entry->encapsulated;
311 deflated_ = entry->deflated;
312 valid_ = true;
313 supported_ = entry->supported;
314 }
315}
std::string_view uid() const noexcept
Returns the Transfer Syntax UID.
@ little_endian
Least significant byte first (most common)
@ implicit
VR determined from data dictionary lookup.

References deflated_, encapsulated_, endianness_, name_, supported_, uid(), valid_, and vr_type_.

Here is the call graph for this function:

◆ transfer_syntax() [2/2]

kcenon::pacs::encoding::transfer_syntax::transfer_syntax ( std::string_view uid,
std::string_view name,
byte_order endian,
vr_encoding vr,
bool encapsulated,
bool deflated,
bool supported )
private

Private constructor for static instances and registry functions.

Definition at line 318 of file transfer_syntax.cpp.

322 : uid_(uid),
323 name_(name),
325 vr_type_(vr),
328 valid_(true),
std::string_view name() const noexcept
Returns the human-readable name of the Transfer Syntax.
vr_encoding vr
byte_order endian
bool deflated
bool supported
bool encapsulated

Member Function Documentation

◆ endianness()

byte_order kcenon::pacs::encoding::transfer_syntax::endianness ( ) const
nodiscardnoexcept

Returns the byte ordering for this Transfer Syntax.

Returns
byte_order::little_endian or byte_order::big_endian

Definition at line 339 of file transfer_syntax.cpp.

339 {
340 return endianness_;
341}

References endianness_.

◆ is_deflated()

bool kcenon::pacs::encoding::transfer_syntax::is_deflated ( ) const
nodiscardnoexcept

Checks if this Transfer Syntax uses deflate compression.

Returns
true if the entire dataset is deflate-compressed

Definition at line 351 of file transfer_syntax.cpp.

351 {
352 return deflated_;
353}

References deflated_.

◆ is_encapsulated()

bool kcenon::pacs::encoding::transfer_syntax::is_encapsulated ( ) const
nodiscardnoexcept

Checks if this Transfer Syntax uses encapsulated (compressed) format.

Returns
true if pixel data is encapsulated (JPEG, JPEG 2000, etc.)

Definition at line 347 of file transfer_syntax.cpp.

347 {
348 return encapsulated_;
349}

References encapsulated_.

◆ is_supported()

bool kcenon::pacs::encoding::transfer_syntax::is_supported ( ) const
nodiscardnoexcept

Checks if this Transfer Syntax is currently supported.

Returns
true if encoding/decoding is implemented

In Phase 1, only uncompressed transfer syntaxes are supported.

Definition at line 359 of file transfer_syntax.cpp.

359 {
360 return supported_;
361}

References supported_.

◆ is_valid()

bool kcenon::pacs::encoding::transfer_syntax::is_valid ( ) const
nodiscardnoexcept

Checks if this is a recognized DICOM Transfer Syntax.

Returns
true if the UID was recognized in the registry

Definition at line 355 of file transfer_syntax.cpp.

355 {
356 return valid_;
357}

References valid_.

◆ name()

std::string_view kcenon::pacs::encoding::transfer_syntax::name ( ) const
nodiscardnoexcept

Returns the human-readable name of the Transfer Syntax.

Returns
The name (e.g., "Implicit VR Little Endian")

Definition at line 335 of file transfer_syntax.cpp.

335 {
336 return name_;
337}

References name_.

◆ operator!=()

bool kcenon::pacs::encoding::transfer_syntax::operator!= ( const transfer_syntax & other) const
noexcept

Compares two Transfer Syntaxes by UID.

Parameters
otherThe Transfer Syntax to compare with
Returns
true if UIDs are not equal

Definition at line 367 of file transfer_syntax.cpp.

367 {
368 return !(*this == other);
369}

◆ operator==()

bool kcenon::pacs::encoding::transfer_syntax::operator== ( const transfer_syntax & other) const
noexcept

Compares two Transfer Syntaxes by UID.

Parameters
otherThe Transfer Syntax to compare with
Returns
true if UIDs are equal

Definition at line 363 of file transfer_syntax.cpp.

363 {
364 return uid_ == other.uid_;
365}

◆ uid()

std::string_view kcenon::pacs::encoding::transfer_syntax::uid ( ) const
nodiscardnoexcept

Returns the Transfer Syntax UID.

Returns
The UID string (e.g., "1.2.840.10008.1.2")

Definition at line 331 of file transfer_syntax.cpp.

331 {
332 return uid_;
333}

References uid_.

Referenced by transfer_syntax().

Here is the caller graph for this function:

◆ vr_type()

vr_encoding kcenon::pacs::encoding::transfer_syntax::vr_type ( ) const
nodiscardnoexcept

Returns the VR encoding mode for this Transfer Syntax.

Returns
vr_encoding::implicit or vr_encoding::explicit_vr

Definition at line 343 of file transfer_syntax.cpp.

343 {
344 return vr_type_;
345}

References vr_type_.

Friends And Related Symbol Documentation

◆ all_transfer_syntaxes

std::vector< transfer_syntax > all_transfer_syntaxes ( )
friend

Returns a list of all known Transfer Syntaxes.

Returns
Vector of all registered transfer_syntax instances

Definition at line 394 of file transfer_syntax.cpp.

394 {
395 std::vector<transfer_syntax> result;
396 result.reserve(TS_REGISTRY.size());
397
398 for (const auto& entry : TS_REGISTRY) {
399 result.push_back(transfer_syntax{entry.uid, entry.name, entry.endian,
400 entry.vr, entry.encapsulated,
401 entry.deflated, entry.supported});
402 }
403 return result;
404}

◆ find_transfer_syntax

std::optional< transfer_syntax > find_transfer_syntax ( std::string_view uid)
friend

Allow registry functions to use private constructor.

Parameters
uidThe Transfer Syntax UID to search for
Returns
The transfer_syntax if found, std::nullopt otherwise

Definition at line 371 of file transfer_syntax.cpp.

371 {
372 if (const auto* entry = find_entry(uid)) {
373 return transfer_syntax{entry->uid, entry->name, entry->endian,
374 entry->vr, entry->encapsulated, entry->deflated,
375 entry->supported};
376 }
377 return std::nullopt;
378}

◆ supported_transfer_syntaxes

std::vector< transfer_syntax > supported_transfer_syntaxes ( )
friend

Returns a list of all supported Transfer Syntaxes.

Returns
Vector of supported transfer_syntax instances

Definition at line 380 of file transfer_syntax.cpp.

380 {
381 std::vector<transfer_syntax> result;
382 result.reserve(TS_REGISTRY.size());
383
384 for (const auto& entry : TS_REGISTRY) {
385 if (entry.supported) {
386 result.push_back(transfer_syntax{entry.uid, entry.name, entry.endian,
387 entry.vr, entry.encapsulated,
388 entry.deflated, entry.supported});
389 }
390 }
391 return result;
392}

Member Data Documentation

◆ deflated_

bool kcenon::pacs::encoding::transfer_syntax::deflated_
private

Definition at line 200 of file transfer_syntax.h.

Referenced by is_deflated(), and transfer_syntax().

◆ deflated_explicit_vr_le

const transfer_syntax kcenon::pacs::encoding::transfer_syntax::deflated_explicit_vr_le
static
Initial value:
{
"1.2.840.10008.1.2.1.99",
"Deflated Explicit VR Little Endian",
false, true, false}
@ explicit_vr
VR explicitly encoded in the data stream.

Deflated Explicit VR Little Endian (1.2.840.10008.1.2.1.99)

Definition at line 119 of file transfer_syntax.h.

◆ encapsulated_

bool kcenon::pacs::encoding::transfer_syntax::encapsulated_
private

Definition at line 199 of file transfer_syntax.h.

Referenced by is_encapsulated(), and transfer_syntax().

◆ endianness_

byte_order kcenon::pacs::encoding::transfer_syntax::endianness_
private

Definition at line 197 of file transfer_syntax.h.

Referenced by endianness(), and transfer_syntax().

◆ explicit_vr_big_endian

const transfer_syntax kcenon::pacs::encoding::transfer_syntax::explicit_vr_big_endian
static
Initial value:
{
"1.2.840.10008.1.2.2",
"Explicit VR Big Endian",
false, false, true}
@ big_endian
Most significant byte first (legacy, rarely used)

Explicit VR Big Endian (1.2.840.10008.1.2.2) - Retired.

Definition at line 116 of file transfer_syntax.h.

◆ explicit_vr_little_endian

const transfer_syntax kcenon::pacs::encoding::transfer_syntax::explicit_vr_little_endian
static
Initial value:
{
"1.2.840.10008.1.2.1",
"Explicit VR Little Endian",
false, false, true}

Explicit VR Little Endian (1.2.840.10008.1.2.1)

Examples
dcm_dir/main.cpp, get_scu/main.cpp, module_example/main.cpp, and retrieve_scu/main.cpp.

Definition at line 113 of file transfer_syntax.h.

Referenced by kcenon::pacs::storage::file_storage::store(), kcenon::pacs::storage::azure_blob_storage::store_with_progress(), and kcenon::pacs::storage::s3_storage::store_with_progress().

◆ frame_deflate

const transfer_syntax kcenon::pacs::encoding::transfer_syntax::frame_deflate
static
Initial value:
{
"1.2.840.10008.1.2.11",
"Frame Deflate",
true, false, true}

Frame Deflate (1.2.840.10008.1.2.11) - Supplement 244.

Definition at line 161 of file transfer_syntax.h.

◆ hevc_main

const transfer_syntax kcenon::pacs::encoding::transfer_syntax::hevc_main
static
Initial value:
{
"1.2.840.10008.1.2.4.107",
"HEVC/H.265 Main Profile / Level 5.1",
true, false, true}

HEVC/H.265 Main Profile / Level 5.1 (1.2.840.10008.1.2.4.107)

Definition at line 146 of file transfer_syntax.h.

◆ hevc_main10

const transfer_syntax kcenon::pacs::encoding::transfer_syntax::hevc_main10
static
Initial value:
{
"1.2.840.10008.1.2.4.108",
"HEVC/H.265 Main 10 Profile / Level 5.1",
true, false, true}

HEVC/H.265 Main 10 Profile / Level 5.1 (1.2.840.10008.1.2.4.108)

Definition at line 149 of file transfer_syntax.h.

◆ htj2k_lossless

const transfer_syntax kcenon::pacs::encoding::transfer_syntax::htj2k_lossless
static
Initial value:
{
"1.2.840.10008.1.2.4.201",
"High-Throughput JPEG 2000 Image Compression (Lossless Only)",
true, false, true}

HTJ2K Lossless Only (1.2.840.10008.1.2.4.201)

Definition at line 137 of file transfer_syntax.h.

◆ htj2k_lossy

const transfer_syntax kcenon::pacs::encoding::transfer_syntax::htj2k_lossy
static
Initial value:
{
"1.2.840.10008.1.2.4.203",
"High-Throughput JPEG 2000 Image Compression",
true, false, true}

HTJ2K (1.2.840.10008.1.2.4.203) - Lossless or Lossy.

Definition at line 143 of file transfer_syntax.h.

◆ htj2k_rpcl

const transfer_syntax kcenon::pacs::encoding::transfer_syntax::htj2k_rpcl
static
Initial value:
{
"1.2.840.10008.1.2.4.202",
"High-Throughput JPEG 2000 with RPCL Options Image Compression (Lossless Only)",
true, false, true}

HTJ2K RPCL (1.2.840.10008.1.2.4.202) - Lossless Only.

Definition at line 140 of file transfer_syntax.h.

◆ implicit_vr_little_endian

const transfer_syntax kcenon::pacs::encoding::transfer_syntax::implicit_vr_little_endian
static
Initial value:
{
"1.2.840.10008.1.2",
"Implicit VR Little Endian",
false, false, true}

Implicit VR Little Endian (1.2.840.10008.1.2)

Examples
module_example/main.cpp.

Definition at line 110 of file transfer_syntax.h.

◆ jpeg2000_lossless

const transfer_syntax kcenon::pacs::encoding::transfer_syntax::jpeg2000_lossless
static
Initial value:
{
"1.2.840.10008.1.2.4.90",
"JPEG 2000 Image Compression (Lossless Only)",
true, false, false}

JPEG 2000 Image Compression (Lossless Only) (1.2.840.10008.1.2.4.90)

Definition at line 128 of file transfer_syntax.h.

◆ jpeg2000_lossy

const transfer_syntax kcenon::pacs::encoding::transfer_syntax::jpeg2000_lossy
static
Initial value:
{
"1.2.840.10008.1.2.4.91",
"JPEG 2000 Image Compression",
true, false, false}

JPEG 2000 Image Compression (1.2.840.10008.1.2.4.91)

Definition at line 131 of file transfer_syntax.h.

◆ jpeg_baseline

const transfer_syntax kcenon::pacs::encoding::transfer_syntax::jpeg_baseline
static
Initial value:
{
"1.2.840.10008.1.2.4.50",
"JPEG Baseline (Process 1)",
true, false, true}

JPEG Baseline (Process 1) (1.2.840.10008.1.2.4.50)

Definition at line 122 of file transfer_syntax.h.

◆ jpeg_lossless

const transfer_syntax kcenon::pacs::encoding::transfer_syntax::jpeg_lossless
static
Initial value:
{
"1.2.840.10008.1.2.4.70",
"JPEG Lossless, Non-Hierarchical, First-Order Prediction",
true, false, false}

JPEG Lossless, Non-Hierarchical (1.2.840.10008.1.2.4.70)

Definition at line 125 of file transfer_syntax.h.

◆ jpegxl_jpeg_recompression

const transfer_syntax kcenon::pacs::encoding::transfer_syntax::jpegxl_jpeg_recompression
static
Initial value:
{
"1.2.840.10008.1.2.4.111",
"JPEG XL JPEG Recompression",
true, false, true}

JPEG XL JPEG Recompression (1.2.840.10008.1.2.4.111) - Supplement 232.

Definition at line 155 of file transfer_syntax.h.

◆ jpegxl_lossless

const transfer_syntax kcenon::pacs::encoding::transfer_syntax::jpegxl_lossless
static
Initial value:
{
"1.2.840.10008.1.2.4.110",
"JPEG XL Lossless",
true, false, true}

JPEG XL Lossless (1.2.840.10008.1.2.4.110) - Supplement 232.

Definition at line 152 of file transfer_syntax.h.

◆ jpegxl_lossy

const transfer_syntax kcenon::pacs::encoding::transfer_syntax::jpegxl_lossy
static
Initial value:
{
"1.2.840.10008.1.2.4.112",
"JPEG XL",
true, false, true}

JPEG XL (1.2.840.10008.1.2.4.112) - Supplement 232.

Definition at line 158 of file transfer_syntax.h.

◆ name_

std::string kcenon::pacs::encoding::transfer_syntax::name_
private

Definition at line 196 of file transfer_syntax.h.

Referenced by name(), and transfer_syntax().

◆ rle_lossless

const transfer_syntax kcenon::pacs::encoding::transfer_syntax::rle_lossless
static
Initial value:
{
"1.2.840.10008.1.2.5",
"RLE Lossless",
true, false, true}

RLE Lossless (1.2.840.10008.1.2.5)

Definition at line 134 of file transfer_syntax.h.

◆ supported_

bool kcenon::pacs::encoding::transfer_syntax::supported_
private

Definition at line 202 of file transfer_syntax.h.

Referenced by is_supported(), and transfer_syntax().

◆ uid_

std::string kcenon::pacs::encoding::transfer_syntax::uid_
private

Definition at line 195 of file transfer_syntax.h.

Referenced by uid().

◆ valid_

bool kcenon::pacs::encoding::transfer_syntax::valid_
private

Definition at line 201 of file transfer_syntax.h.

Referenced by is_valid(), and transfer_syntax().

◆ vr_type_

vr_encoding kcenon::pacs::encoding::transfer_syntax::vr_type_
private

Definition at line 198 of file transfer_syntax.h.

Referenced by transfer_syntax(), and vr_type().


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