11#ifndef PACS_ENCODING_VR_TYPE_HPP
12#define PACS_ENCODING_VR_TYPE_HPP
123 default:
return "??";
132[[nodiscard]]
constexpr std::optional<vr_type>
from_string(std::string_view str)
noexcept {
133 if (str.size() != 2) {
138 const auto code =
static_cast<uint16_t
>(
139 (
static_cast<uint16_t
>(
static_cast<unsigned char>(str[0])) << 8) |
140 static_cast<uint16_t
>(
static_cast<unsigned char>(str[1]))
constexpr std::size_t fixed_length(vr_type vr) noexcept
Gets the fixed size of a VR if applicable.
constexpr char padding_char(vr_type vr) noexcept
Gets the padding character for a VR.
constexpr bool is_numeric_vr(vr_type vr) noexcept
Checks if a VR is a numeric type.
constexpr bool is_binary_vr(vr_type vr) noexcept
Checks if a VR is a binary/raw byte type.
vr_type
DICOM Value Representation (VR) types.
@ OB
Other Byte (variable length)
@ DA
Date (8 chars, format: YYYYMMDD)
@ UN
Unknown (variable length)
@ IS
Integer String (12 chars max)
@ SQ
Sequence of Items (undefined length)
@ UR
Universal Resource Identifier (2^32-2 max)
@ OV
Other 64-bit Very Long (variable length)
@ LO
Long String (64 chars max)
@ DS
Decimal String (16 chars max)
@ DT
Date Time (26 chars max)
@ UL
Unsigned Long (4 bytes)
@ UC
Unlimited Characters (2^32-2 max)
@ UI
Unique Identifier (64 chars max)
@ SL
Signed Long (4 bytes)
@ US
Unsigned Short (2 bytes)
@ OD
Other Double (variable length)
@ PN
Person Name (64 chars max per component group)
@ OF
Other Float (variable length)
@ UT
Unlimited Text (2^32-2 max)
@ CS
Code String (16 chars max, uppercase + digits + space + underscore)
@ OW
Other Word (variable length)
@ AS
Age String (4 chars, format: nnnD/W/M/Y)
@ FD
Floating Point Double (8 bytes)
@ FL
Floating Point Single (4 bytes)
@ TM
Time (14 chars max, format: HHMMSS.FFFFFF)
@ OL
Other Long (variable length)
@ LT
Long Text (10240 chars max)
@ SV
Signed 64-bit Very Long (8 bytes)
@ SS
Signed Short (2 bytes)
@ UV
Unsigned 64-bit Very Long (8 bytes)
@ AE
Application Entity (16 chars max)
@ SH
Short String (16 chars max)
@ ST
Short Text (1024 chars max)
@ AT
Attribute Tag (4 bytes)
constexpr bool is_string_vr(vr_type vr) noexcept
Checks if a VR is a string type.
constexpr std::optional< vr_type > from_string(std::string_view str) noexcept
Parses a two-character string to a vr_type.
constexpr bool has_explicit_32bit_length(vr_type vr) noexcept
Checks if a VR requires 32-bit length field in Explicit VR encoding.
constexpr std::string_view to_string(vr_type vr) noexcept
Converts a vr_type to its two-character string representation.
constexpr bool is_fixed_length(vr_type vr) noexcept
Checks if a VR has a fixed length.