PACS System 0.1.0
PACS DICOM system library
Loading...
Searching...
No Matches
sop_class_registry.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
18#ifndef PACS_SERVICES_SOP_CLASS_REGISTRY_HPP
19#define PACS_SERVICES_SOP_CLASS_REGISTRY_HPP
20
21#include <functional>
22#include <optional>
23#include <string>
24#include <string_view>
25#include <unordered_map>
26#include <vector>
27
28namespace kcenon::pacs::services {
29
30// =============================================================================
31// SOP Class Categories
32// =============================================================================
33
38 storage,
40 worklist,
41 mpps,
43 ups,
45 print,
46 media,
47 other
48};
49
53enum class modality_type {
54 ct,
55 mr,
56 us,
57 xa,
58 xrf,
59 cr,
60 dx,
61 mg,
62 nm,
63 pet,
64 rt,
65 sc,
66 sr,
67 seg,
68 sm,
69 op,
70 pmap,
71 other
72};
73
74// =============================================================================
75// SOP Class Information
76// =============================================================================
77
89
90// =============================================================================
91// SOP Class Registry
92// =============================================================================
93
116public:
120 [[nodiscard]] static sop_class_registry& instance();
121
127 [[nodiscard]] bool is_supported(std::string_view uid) const;
128
134 [[nodiscard]] const sop_class_info* get_info(std::string_view uid) const;
135
141 [[nodiscard]] std::vector<std::string>
142 get_by_category(sop_class_category category) const;
143
150 [[nodiscard]] std::vector<std::string>
151 get_by_modality(modality_type modality, bool include_retired = true) const;
152
158 [[nodiscard]] std::vector<std::string>
159 get_all_storage_classes(bool include_retired = true) const;
160
165 [[nodiscard]] std::vector<std::string> get_all() const;
166
175 bool register_sop_class(const sop_class_info& info);
176
182 [[nodiscard]] static std::string_view
183 modality_to_string(modality_type modality) noexcept;
184
190 [[nodiscard]] static modality_type
191 parse_modality(std::string_view modality) noexcept;
192
193private:
196
197 // Non-copyable, non-movable singleton
202
221
222 std::unordered_map<std::string, sop_class_info> registry_;
223};
224
225// =============================================================================
226// Convenience Functions
227// =============================================================================
228
234[[nodiscard]] bool is_storage_sop_class(std::string_view uid);
235
241[[nodiscard]] modality_type get_storage_modality(std::string_view uid);
242
248[[nodiscard]] std::string_view get_sop_class_name(std::string_view uid);
249
250} // namespace kcenon::pacs::services
251
252#endif // PACS_SERVICES_SOP_CLASS_REGISTRY_HPP
const sop_class_info * get_info(std::string_view uid) const
Get information about a SOP Class.
std::vector< std::string > get_all_storage_classes(bool include_retired=true) const
Get all storage SOP Classes.
static modality_type parse_modality(std::string_view modality) noexcept
Parse a modality string to enum.
bool register_sop_class(const sop_class_info &info)
Register a new SOP Class.
std::vector< std::string > get_by_category(sop_class_category category) const
Get all SOP Classes in a category.
std::vector< std::string > get_all() const
Get all registered SOP Class UIDs.
static std::string_view modality_to_string(modality_type modality) noexcept
Get the modality string for a modality type.
bool is_supported(std::string_view uid) const
Check if a SOP Class UID is supported.
sop_class_registry(const sop_class_registry &)=delete
sop_class_registry & operator=(const sop_class_registry &)=delete
static sop_class_registry & instance()
Get the singleton instance.
std::unordered_map< std::string, sop_class_info > registry_
sop_class_registry(sop_class_registry &&)=delete
sop_class_registry & operator=(sop_class_registry &&)=delete
std::vector< std::string > get_by_modality(modality_type modality, bool include_retired=true) const
Get all storage SOP Classes for a modality.
modality_type
Modality type for storage SOP classes.
@ op
Ophthalmic Photography / Tomography.
@ pet
Positron Emission Tomography.
@ xrf
X-Ray Radiofluoroscopic.
@ sm
Slide Microscopy (Whole Slide Imaging)
bool is_storage_sop_class(std::string_view uid)
Check if a SOP Class UID is a storage class.
modality_type get_storage_modality(std::string_view uid)
Get the modality for a storage SOP Class.
std::string_view get_sop_class_name(std::string_view uid)
Get human-readable name for a SOP Class.
sop_class_category
Category of SOP Class.
@ query_retrieve
Query/Retrieve Service Class.
@ worklist
Modality Worklist Service Class.
@ media
Media Storage Service Class.
@ ups
Unified Procedure Step Service Class.
@ storage_commitment
Storage Commitment Push Model Service Class.
@ mpps
Modality Performed Procedure Step.
@ print
Print Management Service Class.
@ verification
Verification Service Class.
Complete information about a SOP Class.
sop_class_category category
Service class category.
std::string_view name
Human-readable name.
modality_type modality
Modality (for storage classes)
std::string_view uid
SOP Class UID.
bool supports_multiframe
Multi-frame support (for storage)
bool is_retired
Whether this SOP class is retired.
std::string_view uid