35 for (
const auto& info : tags) {
37 if (!info.keyword.empty()) {
46 std::shared_lock lock(mutex_);
48 const auto it = tag_map_.find(tag);
49 if (it != tag_map_.end()) {
56 -> std::optional<tag_info> {
57 std::shared_lock lock(mutex_);
59 const auto it = keyword_map_.find(keyword);
60 if (it != keyword_map_.end()) {
61 const auto tag_it = tag_map_.find(it->second);
62 if (tag_it != tag_map_.end()) {
63 return tag_it->second;
70 std::shared_lock lock(mutex_);
71 return tag_map_.contains(tag);
75 std::shared_lock lock(mutex_);
76 return keyword_map_.contains(keyword);
80 const auto info = find(tag);
84 return info->vm.is_valid(count);
88 const auto info = find(tag);
97 if (!info.tag.is_private()) {
101 std::unique_lock lock(mutex_);
104 if (tag_map_.contains(info.tag)) {
108 tag_map_.emplace(info.tag, info);
109 if (!info.keyword.empty()) {
110 keyword_map_.emplace(info.keyword, info.tag);
117 std::shared_lock lock(
mutex_);
126 std::shared_lock lock(
mutex_);
131 -> std::vector<tag_info> {
132 std::shared_lock lock(mutex_);
134 std::vector<tag_info> result;
135 for (
const auto& [tag, info] : tag_map_) {
136 if (tag.group() == group) {
137 result.push_back(info);
141 std::sort(result.begin(), result.end(),
142 [](
const auto& a,
const auto& b) {
143 return a.tag < b.tag;
std::unordered_map< std::string_view, dicom_tag > keyword_map_
Hash map for O(1) lookup by keyword.
auto find_by_keyword(std::string_view keyword) const -> std::optional< tag_info >
Find tag metadata by keyword.
std::shared_mutex mutex_
Mutex for thread-safe private tag registration.
auto get_tags_in_group(uint16_t group) const -> std::vector< tag_info >
Get all tags in a specific group.
auto contains(dicom_tag tag) const -> bool
Check if a tag exists in the dictionary.
auto find(dicom_tag tag) const -> std::optional< tag_info >
Find tag metadata by DICOM tag.
void initialize_standard_tags()
Initialize the dictionary with standard PS3.6 tags.
auto size() const -> size_t
Get the total number of tags in the dictionary.
static auto instance() -> dicom_dictionary &
Get the singleton instance.
auto get_vr(dicom_tag tag) const -> uint16_t
Get the VR type for a tag.
auto validate_vm(dicom_tag tag, uint32_t count) const -> bool
Validate that a value count is valid for a tag's VM.
size_t standard_count_
Count of standard tags (vs private)
std::unordered_map< dicom_tag, tag_info > tag_map_
Hash map for O(1) lookup by tag.
auto register_private_tag(const tag_info &info) -> bool
Register a private tag at runtime.
auto private_tag_count() const -> size_t
Get the number of registered private tags.
auto contains_keyword(std::string_view keyword) const -> bool
Check if a keyword exists in the dictionary.
dicom_dictionary()
Private constructor - initializes with standard tags.
auto standard_tag_count() const -> size_t
Get the number of standard (non-private) tags.
DICOM Data Dictionary for tag metadata lookup.
auto get_standard_tags() -> std::span< const tag_info >