|
PACS System 0.1.0
PACS DICOM system library
|
#include <dicom_element.h>

Public Member Functions | |
| dicom_element (dicom_tag tag, encoding::vr_type vr) noexcept | |
| Construct an empty element with given tag and VR. | |
| dicom_element (dicom_tag tag, encoding::vr_type vr, std::span< const uint8_t > data) | |
| Construct an element with raw data. | |
| dicom_element (const dicom_element &) | |
| Copy constructor. | |
| dicom_element (dicom_element &&) noexcept | |
| Move constructor. | |
| auto | operator= (const dicom_element &) -> dicom_element & |
| Copy assignment. | |
| auto | operator= (dicom_element &&) noexcept -> dicom_element & |
| Move assignment. | |
| ~dicom_element () | |
| Destructor. | |
| constexpr auto | tag () const noexcept -> dicom_tag |
| Get the element's tag. | |
| constexpr auto | vr () const noexcept -> encoding::vr_type |
| Get the element's VR. | |
| auto | length () const noexcept -> uint32_t |
| Get the value length in bytes. | |
| auto | raw_data () const noexcept -> std::span< const uint8_t > |
| Get the raw data bytes. | |
| auto | is_empty () const noexcept -> bool |
| Check if the element has no value. | |
| auto | as_string () const -> kcenon::pacs::Result< std::string > |
| Get the value as a string. | |
| auto | as_string_list () const -> kcenon::pacs::Result< std::vector< std::string > > |
| Get multi-valued string as a list. | |
| template<typename T > requires std::is_arithmetic_v<T> | |
| auto | as_numeric () const -> kcenon::pacs::Result< T > |
| Get the value as a numeric type. | |
| template<typename T > requires std::is_arithmetic_v<T> | |
| auto | as_numeric_list () const -> kcenon::pacs::Result< std::vector< T > > |
| Get multi-valued numeric data as a list. | |
| auto | is_sequence () const noexcept -> bool |
| Check if this element is a sequence. | |
| auto | sequence_item_count () const noexcept -> std::size_t |
| Get the number of items in the sequence. | |
| auto | sequence_item (std::size_t index) const -> const dicom_dataset & |
| Get a specific sequence item by index. | |
| auto | sequence_item (std::size_t index) -> dicom_dataset & |
| Get a specific sequence item by index (mutable) | |
| auto | sequence_items () -> std::vector< dicom_dataset > & |
| Get mutable access to sequence items. | |
| auto | sequence_items () const -> const std::vector< dicom_dataset > & |
| Get read-only access to sequence items. | |
| void | add_sequence_item (dicom_dataset item) |
| Add a new item to the sequence. | |
| void | set_value (std::span< const uint8_t > data) |
| Set the raw value data. | |
| void | set_string (std::string_view value) |
| Set the value from a string. | |
| template<typename T > requires std::is_arithmetic_v<T> | |
| void | set_numeric (T value) |
| Set the value from a numeric value. | |
Static Public Member Functions | |
| static auto | from_string (dicom_tag tag, encoding::vr_type vr, std::string_view value) -> dicom_element |
| Create an element from a string value. | |
| template<typename T > requires std::is_arithmetic_v<T> | |
| static auto | from_numeric (dicom_tag tag, encoding::vr_type vr, T value) -> dicom_element |
| Create an element from a numeric value. | |
| template<typename T > requires std::is_arithmetic_v<T> | |
| static auto | from_numeric_list (dicom_tag tag, encoding::vr_type vr, std::span< const T > values) -> dicom_element |
| Create an element from multiple numeric values. | |
Private Member Functions | |
| auto | apply_padding (std::string_view str) const -> std::string |
| Apply DICOM padding to ensure even length. | |
Static Private Member Functions | |
| static auto | remove_padding (std::string_view str, encoding::vr_type vr) -> std::string |
| Remove DICOM padding from a string value. | |
Private Attributes | |
| dicom_tag | tag_ |
| encoding::vr_type | vr_ |
| std::vector< uint8_t > | data_ |
| std::vector< dicom_dataset > | sequence_items_ |
Definition at line 67 of file dicom_element.h.
|
noexcept |
Construct an empty element with given tag and VR.
| tag | The DICOM tag |
| vr | The value representation |
Definition at line 24 of file dicom_element.cpp.
| kcenon::pacs::core::dicom_element::dicom_element | ( | dicom_tag | tag, |
| encoding::vr_type | vr, | ||
| std::span< const uint8_t > | data ) |
Construct an element with raw data.
| tag | The DICOM tag |
| vr | The value representation |
| data | The raw byte data |
Definition at line 27 of file dicom_element.cpp.
|
default |
Copy constructor.
|
defaultnoexcept |
Move constructor.
|
default |
Destructor.
| void kcenon::pacs::core::dicom_element::add_sequence_item | ( | dicom_dataset | item | ) |
Add a new item to the sequence.
| item | The dataset to add (will be moved) |
Definition at line 179 of file dicom_element.cpp.
References sequence_items_.
|
nodiscardprivate |
Apply DICOM padding to ensure even length.
| str | The input string |
Definition at line 201 of file dicom_element.cpp.
References kcenon::pacs::encoding::padding_char().
Referenced by set_string().


|
nodiscard |
Get the value as a numeric type.
| T | The target numeric type |
Definition at line 369 of file dicom_element.h.
References data_, kcenon::pacs::error_codes::data_size_mismatch, and kcenon::pacs::pacs_error().
Referenced by as_string().


|
nodiscard |
Get multi-valued numeric data as a list.
| T | The target numeric type |
Definition at line 385 of file dicom_element.h.
References data_, and kcenon::pacs::error_codes::data_size_mismatch.
|
nodiscard |
Get the value as a string.
For string VRs, returns the value with trailing padding removed. For numeric VRs, converts the value to a string representation.
Definition at line 52 of file dicom_element.cpp.
References as_numeric(), data_, kcenon::pacs::encoding::FD, kcenon::pacs::encoding::FL, kcenon::pacs::encoding::is_numeric_vr(), kcenon::pacs::encoding::is_string_vr(), remove_padding(), kcenon::pacs::encoding::SL, kcenon::pacs::encoding::SS, kcenon::pacs::encoding::SV, kcenon::pacs::encoding::UL, kcenon::pacs::encoding::US, kcenon::pacs::encoding::UV, and vr_.
Referenced by as_string_list().


|
nodiscard |
Get multi-valued string as a list.
Splits the value by backslash delimiter (DICOM VM > 1).
Definition at line 125 of file dicom_element.cpp.
References as_string(), and code.

|
staticnodiscard |
Create an element from a numeric value.
| T | The numeric type (uint16_t, int32_t, float, double, etc.) |
| tag | The DICOM tag |
| vr | The value representation (should be a numeric VR) |
| value | The numeric value |
Definition at line 345 of file dicom_element.h.
References set_numeric(), tag(), and vr().
Referenced by kcenon::pacs::integration::container_adapter::from_container_value(), and kcenon::pacs::core::dicom_dataset::set_numeric().


|
staticnodiscard |
Create an element from multiple numeric values.
| T | The numeric type |
| tag | The DICOM tag |
| vr | The value representation |
| values | The numeric values |
Definition at line 354 of file dicom_element.h.

|
staticnodiscard |
Create an element from a string value.
| tag | The DICOM tag |
| vr | The value representation (should be a string VR) |
| value | The string value |
Definition at line 41 of file dicom_element.cpp.
References set_string(), and vr.
Referenced by kcenon::pacs::integration::container_adapter::from_container_value(), kcenon::pacs::encoding::set_encoded_string(), and kcenon::pacs::core::dicom_dataset::set_string().


|
inlinenodiscardnoexcept |
Check if the element has no value.
Definition at line 186 of file dicom_element.h.
References data_.
|
inlinenodiscardnoexcept |
Check if this element is a sequence.
Definition at line 242 of file dicom_element.h.
References kcenon::pacs::encoding::SQ, and vr_.
Referenced by kcenon::pacs::encoding::explicit_vr_big_endian_codec::encode_element(), kcenon::pacs::encoding::explicit_vr_codec::encode_element(), and kcenon::pacs::encoding::implicit_vr_codec::encode_element().

|
inlinenodiscardnoexcept |
Get the value length in bytes.
Definition at line 170 of file dicom_element.h.
References data_.
|
default |
Copy assignment.
|
defaultnoexcept |
Move assignment.
|
inlinenodiscardnoexcept |
Get the raw data bytes.
Definition at line 178 of file dicom_element.h.
References data_.
Referenced by kcenon::pacs::encoding::explicit_vr_big_endian_codec::encode_element(), kcenon::pacs::encoding::explicit_vr_codec::encode_element(), and kcenon::pacs::encoding::implicit_vr_codec::encode_element().

|
staticnodiscardprivate |
Remove DICOM padding from a string value.
| str | The padded string |
Definition at line 212 of file dicom_element.cpp.
References kcenon::pacs::encoding::is_string_vr(), kcenon::pacs::encoding::padding_char(), kcenon::pacs::encoding::UI, and vr.
Referenced by as_string().


|
nodiscard |
Get a specific sequence item by index (mutable)
| index | The zero-based index of the item |
| std::out_of_range | if index >= sequence_item_count() |
Definition at line 167 of file dicom_element.cpp.
|
nodiscard |
Get a specific sequence item by index.
| index | The zero-based index of the item |
| std::out_of_range | if index >= sequence_item_count() |
Definition at line 162 of file dicom_element.cpp.
|
nodiscardnoexcept |
Get the number of items in the sequence.
Definition at line 158 of file dicom_element.cpp.
References sequence_items_.
|
nodiscard |
Get mutable access to sequence items.
Definition at line 171 of file dicom_element.cpp.
Referenced by kcenon::pacs::encoding::explicit_vr_big_endian_codec::decode_undefined_length(), kcenon::pacs::encoding::explicit_vr_codec::decode_undefined_length(), kcenon::pacs::encoding::implicit_vr_codec::decode_undefined_length(), kcenon::pacs::encoding::explicit_vr_big_endian_codec::encode_sequence(), kcenon::pacs::encoding::explicit_vr_codec::encode_sequence(), and kcenon::pacs::encoding::implicit_vr_codec::encode_sequence().

|
nodiscard |
Get read-only access to sequence items.
Definition at line 175 of file dicom_element.cpp.
References sequence_items_.
| void kcenon::pacs::core::dicom_element::set_numeric | ( | T | value | ) |
Set the value from a numeric value.
| T | The numeric type |
| value | The numeric value |
Definition at line 406 of file dicom_element.h.
References data_.
Referenced by from_numeric().

| void kcenon::pacs::core::dicom_element::set_string | ( | std::string_view | value | ) |
Set the value from a string.
| value | The string value (will be padded if needed) |
Definition at line 191 of file dicom_element.cpp.
References apply_padding(), and data_.
Referenced by from_string().


| void kcenon::pacs::core::dicom_element::set_value | ( | std::span< const uint8_t > | data | ) |
Set the raw value data.
| data | The new raw data |
Definition at line 187 of file dicom_element.cpp.
References data_.
Referenced by kcenon::pacs::integration_test::test_data_generator::add_multiframe_pixel_data(), kcenon::pacs::integration_test::test_data_generator::add_pixel_data(), kcenon::pacs::integration_test::generate_ct_dataset(), kcenon::pacs::integration_test::generate_mr_dataset(), kcenon::pacs::integration_test::generate_xa_dataset(), and kcenon::pacs::integration_test::test_data_generator::invalid().

|
inlinenodiscardconstexprnoexcept |
Get the element's tag.
Definition at line 158 of file dicom_element.h.
References tag_.
Referenced by kcenon::pacs::encoding::explicit_vr_big_endian_codec::encode_element(), kcenon::pacs::encoding::explicit_vr_codec::encode_element(), kcenon::pacs::encoding::implicit_vr_codec::encode_element(), from_numeric(), from_numeric_list(), and kcenon::pacs::core::dicom_dataset::insert().

|
inlinenodiscardconstexprnoexcept |
Get the element's VR.
Definition at line 164 of file dicom_element.h.
References vr_.
Referenced by kcenon::pacs::encoding::explicit_vr_big_endian_codec::encode_element(), kcenon::pacs::encoding::explicit_vr_codec::encode_element(), kcenon::pacs::encoding::implicit_vr_codec::encode_element(), from_numeric(), and from_numeric_list().

|
private |
Definition at line 320 of file dicom_element.h.
Referenced by as_numeric(), as_numeric_list(), as_string(), is_empty(), length(), raw_data(), set_numeric(), set_string(), and set_value().
|
private |
Definition at line 321 of file dicom_element.h.
Referenced by add_sequence_item(), sequence_item_count(), and sequence_items().
|
private |
Definition at line 318 of file dicom_element.h.
Referenced by tag().
|
private |
Definition at line 319 of file dicom_element.h.
Referenced by as_string(), is_sequence(), and vr().