PACS System 0.1.0
PACS DICOM system library
Loading...
Searching...
No Matches
vr_info.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
11#ifndef PACS_ENCODING_VR_INFO_HPP
12#define PACS_ENCODING_VR_INFO_HPP
13
14#include "vr_type.h"
15
16#include <cstdint>
17#include <span>
18#include <string>
19#include <string_view>
20#include <vector>
21
22namespace kcenon::pacs::encoding {
23
32struct vr_info {
34 std::string_view name;
35 uint32_t max_length;
38 std::size_t fixed_size;
39};
40
43
55[[nodiscard]] const vr_info& get_vr_info(vr_type vr);
56
58
61
73[[nodiscard]] bool validate_value(vr_type vr, std::span<const uint8_t> data);
74
86[[nodiscard]] bool validate_string(vr_type vr, std::string_view value);
87
89
92
106[[nodiscard]] std::vector<uint8_t> pad_to_even(vr_type vr,
107 std::span<const uint8_t> data);
108
119[[nodiscard]] std::string trim_padding(vr_type vr, std::string_view value);
120
122
125
142[[nodiscard]] bool is_valid_charset(vr_type vr, std::string_view value);
143
145
146} // namespace kcenon::pacs::encoding
147
148#endif // PACS_ENCODING_VR_INFO_HPP
vr_type
DICOM Value Representation (VR) types.
Definition vr_type.h:29
bool is_valid_charset(vr_type vr, std::string_view value)
Validates that a string uses only allowed characters for its VR.
Definition vr_info.cpp:225
std::vector< uint8_t > pad_to_even(vr_type vr, std::span< const uint8_t > data)
Pads data to even length as required by DICOM.
Definition vr_info.cpp:196
bool validate_string(vr_type vr, std::string_view value)
Validates a string value against VR encoding rules.
Definition vr_info.cpp:170
bool validate_value(vr_type vr, std::span< const uint8_t > data)
Validates binary data against VR encoding rules.
Definition vr_info.cpp:141
std::string trim_padding(vr_type vr, std::string_view value)
Removes trailing padding characters from a string value.
Definition vr_info.cpp:207
const vr_info & get_vr_info(vr_type vr)
Retrieves comprehensive metadata for a VR type.
Definition vr_info.cpp:131
Metadata structure containing comprehensive VR properties.
Definition vr_info.h:32
char padding_char
Padding character (' ' or '\0')
Definition vr_info.h:36
uint32_t max_length
Maximum value length in bytes.
Definition vr_info.h:35
bool is_fixed_length
Whether VR has fixed length.
Definition vr_info.h:37
std::string_view name
Human-readable name (e.g., "Person Name")
Definition vr_info.h:34
vr_type type
The VR enumeration value.
Definition vr_info.h:33
std::size_t fixed_size
Size for fixed-length VRs (0 if variable)
Definition vr_info.h:38
vr_encoding vr