|
PACS System 0.1.0
PACS DICOM system library
|
Encoder/decoder for Explicit VR Big Endian transfer syntax. More...
#include <explicit_vr_big_endian_codec.h>

Public Types | |
| template<typename T > | |
| using | result = kcenon::pacs::Result<T> |
| Result type for decode operations using kcenon::pacs::Result<T> pattern. | |
Static Public Member Functions | |
| static std::vector< uint8_t > | encode (const core::dicom_dataset &dataset) |
| Encode a dataset to bytes using Explicit VR Big Endian. | |
| static result< core::dicom_dataset > | decode (std::span< const uint8_t > data) |
| Decode bytes to a dataset using Explicit VR Big Endian. | |
| static std::vector< uint8_t > | encode_element (const core::dicom_element &element) |
| Encode a single element to bytes. | |
| static result< core::dicom_element > | decode_element (std::span< const uint8_t > &data) |
| Decode a single element from bytes. | |
| static std::vector< uint8_t > | to_big_endian (vr_type vr, std::span< const uint8_t > data) |
| Convert element value from little-endian to big-endian. | |
| static std::vector< uint8_t > | from_big_endian (vr_type vr, std::span< const uint8_t > data) |
| Convert element value from big-endian to little-endian. | |
Static Private Member Functions | |
| static void | encode_sequence (std::vector< uint8_t > &buffer, const core::dicom_element &element) |
| static void | encode_sequence_item (std::vector< uint8_t > &buffer, const core::dicom_dataset &item) |
| static result< core::dicom_element > | decode_undefined_length (core::dicom_tag tag, vr_type vr, std::span< const uint8_t > &data) |
| static result< core::dicom_dataset > | decode_sequence_item (std::span< const uint8_t > &data) |
Encoder/decoder for Explicit VR Big Endian transfer syntax.
Explicit VR Big Endian encoding has the same structure as Little Endian but with big-endian byte ordering for all multi-byte numeric values:
Standard VRs (16-bit length): ┌─────────────────────────────────────────────────────┐ │ Data Element │ ├───────────┬───────────┬────────┬──────────┬─────────┤ │ Group │ Element │ VR │ Length │ Value │ │ (2 bytes) │ (2 bytes) │(2 char)│ (2 bytes)│ │ │ BE │ BE │ ASCII │ BE │ BE │ └───────────┴───────────┴────────┴──────────┴─────────┘
Extended VRs (32-bit length): ┌──────────────────────────────────────────────────────────────┐ │ Data Element │ ├───────────┬───────────┬────────┬──────────┬──────────┬───────┤ │ Group │ Element │ VR │ Reserved │ Length │ Value │ │ (2 bytes) │ (2 bytes) │(2 char)│ (2 bytes)│ (4 bytes)│ │ │ BE │ BE │ ASCII │ 0x0000 │ BE │ BE │ └───────────┴───────────┴────────┴──────────┴──────────┴───────┘
Byte swapping is required for:
Definition at line 69 of file explicit_vr_big_endian_codec.h.
| using kcenon::pacs::encoding::explicit_vr_big_endian_codec::result = kcenon::pacs::Result<T> |
Result type for decode operations using kcenon::pacs::Result<T> pattern.
Definition at line 75 of file explicit_vr_big_endian_codec.h.
|
staticnodiscard |
Decode bytes to a dataset using Explicit VR Big Endian.
| data | The bytes to decode |
Definition at line 257 of file explicit_vr_big_endian_codec.cpp.
References decode_element(), kcenon::pacs::core::dicom_dataset::insert(), kcenon::pacs::pacs_error(), and kcenon::pacs::encoding::read_be16().
Referenced by decode_sequence_item().


|
staticnodiscard |
Decode a single element from bytes.
The span reference is advanced past the decoded element.
| data | Reference to the data span (will be modified) |
Definition at line 291 of file explicit_vr_big_endian_codec.cpp.
References decode_undefined_length(), from_big_endian(), kcenon::pacs::encoding::from_string(), kcenon::pacs::encoding::has_explicit_32bit_length(), kcenon::pacs::error_codes::insufficient_data, kcenon::pacs::encoding::read_be16(), kcenon::pacs::encoding::read_be32(), kcenon::pacs::encoding::UN, kcenon::pacs::error_codes::unknown_vr, and vr.
Referenced by decode(), and decode_sequence_item().


|
staticprivate |
Definition at line 463 of file explicit_vr_big_endian_codec.cpp.
References decode(), decode_element(), kcenon::pacs::error_codes::insufficient_data, kcenon::pacs::error_codes::invalid_sequence, kcenon::pacs::encoding::read_be16(), and kcenon::pacs::encoding::read_be32().
Referenced by decode_undefined_length().


|
staticprivate |
Definition at line 371 of file explicit_vr_big_endian_codec.cpp.
References decode_sequence_item(), from_big_endian(), kcenon::pacs::error_codes::insufficient_data, kcenon::pacs::error_codes::invalid_sequence, kcenon::pacs::encoding::read_be16(), kcenon::pacs::encoding::read_be32(), kcenon::pacs::core::dicom_element::sequence_items(), kcenon::pacs::encoding::SQ, and vr.
Referenced by decode_element().


|
staticnodiscard |
Encode a dataset to bytes using Explicit VR Big Endian.
| dataset | The dataset to encode |
Definition at line 160 of file explicit_vr_big_endian_codec.cpp.
References encode_element().
Referenced by encode_sequence_item().


|
staticnodiscard |
Encode a single element to bytes.
| element | The element to encode |
Definition at line 173 of file explicit_vr_big_endian_codec.cpp.
References encode_sequence(), kcenon::pacs::encoding::has_explicit_32bit_length(), kcenon::pacs::core::dicom_element::is_sequence(), kcenon::pacs::encoding::pad_to_even(), kcenon::pacs::core::dicom_element::raw_data(), kcenon::pacs::core::dicom_element::tag(), to_big_endian(), kcenon::pacs::encoding::to_string(), kcenon::pacs::core::dicom_element::vr(), kcenon::pacs::encoding::write_be16(), and kcenon::pacs::encoding::write_be32().
Referenced by encode().


|
staticprivate |
Definition at line 214 of file explicit_vr_big_endian_codec.cpp.
References encode_sequence_item(), kcenon::pacs::core::dicom_element::sequence_items(), kcenon::pacs::encoding::write_be16(), and kcenon::pacs::encoding::write_be32().
Referenced by encode_element().


|
staticprivate |
Definition at line 235 of file explicit_vr_big_endian_codec.cpp.
References encode(), kcenon::pacs::encoding::write_be16(), and kcenon::pacs::encoding::write_be32().
Referenced by encode_sequence().


|
staticnodiscard |
Convert element value from big-endian to little-endian.
| vr | The VR type of the element |
| data | The big-endian data to convert |
Performs the inverse of to_big_endian().
Definition at line 150 of file explicit_vr_big_endian_codec.cpp.
References to_big_endian(), and vr.
Referenced by decode_element(), and decode_undefined_length().


|
staticnodiscard |
Convert element value from little-endian to big-endian.
| vr | The VR type of the element |
| data | The little-endian data to convert |
Performs byte swapping based on VR type:
Definition at line 132 of file explicit_vr_big_endian_codec.cpp.
References kcenon::pacs::encoding::swap_od_bytes(), kcenon::pacs::encoding::swap_ol_bytes(), kcenon::pacs::encoding::swap_ow_bytes(), and vr.
Referenced by encode_element(), and from_big_endian().

