19 std::string_view default_value) {
21 const auto* elem = ds.
get(tag);
22 if (elem ==
nullptr) {
23 return std::string{default_value};
26 auto raw = elem->as_string();
28 return std::string{default_value};
42 std::string_view utf8_value) {
auto get(dicom_tag tag) noexcept -> dicom_element *
Get a pointer to the element with the given tag.
void insert(dicom_element element)
Insert or replace an element in the dataset.
auto get_string(dicom_tag tag, std::string_view default_value="") const -> std::string
Get the string value of an element.
static auto from_string(dicom_tag tag, encoding::vr_type vr, std::string_view value) -> dicom_element
Create an element from a string value.
Character set-aware string access for DICOM datasets.
Compile-time constants for commonly used DICOM tags.
vr_type
DICOM Value Representation (VR) types.
std::string encode_from_utf8(std::string_view utf8_text, const specific_character_set &scs)
Encode a UTF-8 string to the target character set encoding.
specific_character_set parse_specific_character_set(std::string_view value)
Parse a Specific Character Set (0008,0005) value.
std::string get_decoded_string(const core::dicom_dataset &ds, core::dicom_tag tag, std::string_view default_value="")
Get a string value from dataset, decoded to UTF-8.
void set_encoded_string(core::dicom_dataset &ds, core::dicom_tag tag, vr_type vr, std::string_view utf8_value)
Set a string value in dataset, encoding from UTF-8.
std::string decode_to_utf8(std::string_view text, const specific_character_set &scs)
Decode a DICOM string to UTF-8 using the given character set.