PACS System 0.1.0
PACS DICOM system library
Loading...
Searching...
No Matches
implicit_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_IMPLICIT_VR_CODEC_HPP
22#define PACS_ENCODING_IMPLICIT_VR_CODEC_HPP
23
27
28#include <cstdint>
29#include <span>
30#include <vector>
31
32namespace kcenon::pacs::encoding {
33
54public:
58 template <typename T>
60
61 // ========================================================================
62 // Dataset Encoding/Decoding
63 // ========================================================================
64
70 [[nodiscard]] static std::vector<uint8_t> encode(
71 const core::dicom_dataset& dataset);
72
78 [[nodiscard]] static result<core::dicom_dataset> decode(
79 std::span<const uint8_t> data);
80
81 // ========================================================================
82 // Element Encoding/Decoding
83 // ========================================================================
84
90 [[nodiscard]] static std::vector<uint8_t> encode_element(
91 const core::dicom_element& element);
92
101 [[nodiscard]] static result<core::dicom_element> decode_element(
102 std::span<const uint8_t>& data);
103
104private:
105 // Internal encoding helpers
106 static void encode_sequence(std::vector<uint8_t>& buffer,
107 const core::dicom_element& element);
108
109 static void encode_sequence_item(std::vector<uint8_t>& buffer,
110 const core::dicom_dataset& item);
111
112 // Internal decoding helpers
115 std::span<const uint8_t>& data);
116
118 std::span<const uint8_t>& data);
119};
120
121} // namespace kcenon::pacs::encoding
122
123#endif // PACS_ENCODING_IMPLICIT_VR_CODEC_HPP
Encoder/decoder for Implicit VR Little Endian transfer syntax.
static result< core::dicom_element > decode_element(std::span< const uint8_t > &data)
Decode a single element from bytes.
static result< core::dicom_dataset > decode_sequence_item(std::span< const uint8_t > &data)
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 std::vector< uint8_t > encode_element(const core::dicom_element &element)
Encode a single element to bytes.
static result< core::dicom_dataset > decode(std::span< const uint8_t > data)
Decode bytes to a dataset using Implicit VR Little Endian.
static void encode_sequence(std::vector< uint8_t > &buffer, const core::dicom_element &element)
static std::vector< uint8_t > encode(const core::dicom_dataset &dataset)
Encode a dataset to bytes using Implicit 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