PACS System 0.1.0
PACS DICOM system library
Loading...
Searching...
No Matches
explicit_vr_codec.h
Go to the documentation of this file.
1// BSD 3-Clause License
2// Copyright (c) 2021-2025, 🍀☀🌕🌥 🌊
3// See the LICENSE file in the project root for full license information.
4
21#ifndef PACS_ENCODING_EXPLICIT_VR_CODEC_HPP
22#define PACS_ENCODING_EXPLICIT_VR_CODEC_HPP
23
27
28#include <cstdint>
29#include <span>
30#include <vector>
31
32namespace kcenon::pacs::encoding {
33
62public:
66 template <typename T>
68
69 // ========================================================================
70 // Dataset Encoding/Decoding
71 // ========================================================================
72
78 [[nodiscard]] static std::vector<uint8_t> encode(
79 const core::dicom_dataset& dataset);
80
86 [[nodiscard]] static result<core::dicom_dataset> decode(
87 std::span<const uint8_t> data);
88
89 // ========================================================================
90 // Element Encoding/Decoding
91 // ========================================================================
92
98 [[nodiscard]] static std::vector<uint8_t> encode_element(
99 const core::dicom_element& element);
100
109 [[nodiscard]] static result<core::dicom_element> decode_element(
110 std::span<const uint8_t>& data);
111
112private:
113 // Internal encoding helpers
114 static void encode_sequence(std::vector<uint8_t>& buffer,
115 const core::dicom_element& element);
116
117 static void encode_sequence_item(std::vector<uint8_t>& buffer,
118 const core::dicom_dataset& item);
119
120 // Internal decoding helpers
123 std::span<const uint8_t>& data);
124
126 std::span<const uint8_t>& data);
127};
128
129} // namespace kcenon::pacs::encoding
130
131#endif // PACS_ENCODING_EXPLICIT_VR_CODEC_HPP
Encoder/decoder for Explicit VR Little Endian transfer syntax.
static result< core::dicom_element > decode_undefined_length(core::dicom_tag tag, vr_type vr, std::span< const uint8_t > &data)
static void encode_sequence_item(std::vector< uint8_t > &buffer, const core::dicom_dataset &item)
static result< core::dicom_element > decode_element(std::span< const uint8_t > &data)
Decode a single element from bytes.
static void encode_sequence(std::vector< uint8_t > &buffer, const core::dicom_element &element)
static result< core::dicom_dataset > decode_sequence_item(std::span< const uint8_t > &data)
static result< core::dicom_dataset > decode(std::span< const uint8_t > data)
Decode bytes to a dataset using Explicit VR Little Endian.
static std::vector< uint8_t > encode_element(const core::dicom_element &element)
Encode a single element to bytes.
static std::vector< uint8_t > encode(const core::dicom_dataset &dataset)
Encode a dataset to bytes using Explicit VR Little Endian.
DICOM Dataset - ordered collection of Data Elements.
DICOM Data Element representation (Tag, VR, Value)
vr_type
DICOM Value Representation (VR) types.
Definition vr_type.h:29
Result<T> type aliases and helpers for PACS system.
vr_encoding vr