PACS System 0.1.0
PACS DICOM system library
Loading...
Searching...
No Matches
waveform_storage.cpp
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
11
12#include <algorithm>
13#include <array>
14
16
17// =============================================================================
18// Transfer Syntaxes
19// =============================================================================
20
21std::vector<std::string> get_waveform_transfer_syntaxes() {
22 return {
23 // Explicit VR Little Endian (preferred for interoperability)
24 "1.2.840.10008.1.2.1",
25 // Implicit VR Little Endian (universal baseline)
26 "1.2.840.10008.1.2",
27 };
28}
29
30// =============================================================================
31// Waveform Type Classification
32// =============================================================================
33
54
55std::string_view to_string(waveform_type type) noexcept {
56 switch (type) {
57 case waveform_type::ecg_12lead: return "12-Lead ECG";
58 case waveform_type::ecg_general: return "General ECG";
59 case waveform_type::ecg_ambulatory: return "Ambulatory ECG";
60 case waveform_type::hemodynamic: return "Hemodynamic";
61 case waveform_type::cardiac_ep: return "Cardiac Electrophysiology";
62 case waveform_type::audio_basic: return "Basic Voice Audio";
63 case waveform_type::audio_general: return "General Audio";
64 case waveform_type::arterial_pulse: return "Arterial Pulse";
65 case waveform_type::respiratory: return "Respiratory";
66 case waveform_type::respiratory_multi: return "Multi-channel Respiratory";
67 case waveform_type::eeg_routine: return "Routine Scalp EEG";
68 case waveform_type::emg: return "Electromyogram";
69 case waveform_type::eog: return "Electrooculogram";
70 case waveform_type::eeg_sleep: return "Sleep EEG";
71 case waveform_type::body_position: return "Body Position";
72 case waveform_type::presentation_state: return "Waveform Presentation State";
73 case waveform_type::annotation: return "Waveform Annotation";
74 case waveform_type::unknown: return "Unknown";
75 }
76 return "Unknown";
77}
78
79// =============================================================================
80// SOP Class Information Registry
81// =============================================================================
82
83namespace {
84
85static constexpr std::array<waveform_sop_class_info, 17> kWaveformRegistry = {{
86 {twelve_lead_ecg_storage_uid, "12-lead ECG Waveform Storage",
88 {general_ecg_storage_uid, "General ECG Waveform Storage",
90 {ambulatory_ecg_storage_uid, "Ambulatory ECG Waveform Storage",
92 {hemodynamic_waveform_storage_uid, "Hemodynamic Waveform Storage",
94 {cardiac_ep_waveform_storage_uid, "Basic Cardiac EP Waveform Storage",
96 {basic_voice_audio_storage_uid, "Basic Voice Audio Waveform Storage",
98 {general_audio_waveform_storage_uid, "General Audio Waveform Storage",
100 {arterial_pulse_waveform_storage_uid, "Arterial Pulse Waveform Storage",
102 {respiratory_waveform_storage_uid, "Respiratory Waveform Storage",
104 {multichannel_respiratory_waveform_storage_uid, "Multi-channel Respiratory Waveform Storage",
106 {routine_scalp_eeg_storage_uid, "Routine Scalp EEG Waveform Storage",
108 {emg_waveform_storage_uid, "Electromyogram Waveform Storage",
109 waveform_type::emg, false},
110 {eog_waveform_storage_uid, "Electrooculogram Waveform Storage",
111 waveform_type::eog, false},
112 {sleep_eeg_storage_uid, "Sleep EEG Waveform Storage",
114 {body_position_waveform_storage_uid, "Body Position Waveform Storage",
116 {waveform_presentation_state_storage_uid, "Waveform Presentation State Storage",
118 {waveform_annotation_storage_uid, "Waveform Annotation Storage",
120}};
121
122} // namespace
123
124std::vector<std::string>
125get_waveform_storage_sop_classes(bool include_presentation_state,
126 bool include_annotation) {
127 std::vector<std::string> result;
128 result.reserve(kWaveformRegistry.size());
129
130 for (const auto& entry : kWaveformRegistry) {
131 if (entry.type == waveform_type::presentation_state &&
132 !include_presentation_state) {
133 continue;
134 }
135 if (entry.type == waveform_type::annotation && !include_annotation) {
136 continue;
137 }
138 result.emplace_back(entry.uid);
139 }
140 return result;
141}
142
143const waveform_sop_class_info*
144get_waveform_sop_class_info(std::string_view uid) noexcept {
145 auto it = std::find_if(kWaveformRegistry.begin(), kWaveformRegistry.end(),
146 [&uid](const waveform_sop_class_info& info) {
147 return info.uid == uid;
148 });
149 return (it != kWaveformRegistry.end()) ? &(*it) : nullptr;
150}
151
152bool is_waveform_storage_sop_class(std::string_view uid) noexcept {
153 return get_waveform_sop_class_info(uid) != nullptr;
154}
155
159
160bool is_waveform_annotation_sop_class(std::string_view uid) noexcept {
162}
163
164} // namespace kcenon::pacs::services::sop_classes
constexpr std::string_view general_ecg_storage_uid
General ECG Waveform Storage SOP Class UID.
constexpr std::string_view ambulatory_ecg_storage_uid
Ambulatory ECG Waveform Storage SOP Class UID.
const waveform_sop_class_info * get_waveform_sop_class_info(std::string_view uid) noexcept
Get information about a specific Waveform SOP Class.
constexpr std::string_view hemodynamic_waveform_storage_uid
Hemodynamic Waveform Storage SOP Class UID.
constexpr std::string_view arterial_pulse_waveform_storage_uid
Arterial Pulse Waveform Storage SOP Class UID.
constexpr std::string_view waveform_annotation_storage_uid
Waveform Annotation Storage SOP Class UID.
bool is_waveform_presentation_state_sop_class(std::string_view uid) noexcept
Check if a SOP Class UID is a Waveform Presentation State SOP Class.
std::vector< std::string > get_waveform_storage_sop_classes(bool include_presentation_state=true, bool include_annotation=true)
Get all Waveform Storage SOP Class UIDs.
waveform_type get_waveform_type(std::string_view uid) noexcept
Get waveform type from SOP Class UID.
constexpr std::string_view cardiac_ep_waveform_storage_uid
Basic Cardiac Electrophysiology Waveform Storage SOP Class UID.
constexpr std::string_view general_audio_waveform_storage_uid
General Audio Waveform Storage SOP Class UID.
constexpr std::string_view respiratory_waveform_storage_uid
Respiratory Waveform Storage SOP Class UID.
constexpr std::string_view twelve_lead_ecg_storage_uid
12-lead ECG Waveform Storage SOP Class UID
constexpr std::string_view sleep_eeg_storage_uid
Sleep Electroencephalogram Waveform Storage SOP Class UID.
constexpr std::string_view eog_waveform_storage_uid
Electrooculogram Waveform Storage SOP Class UID.
constexpr std::string_view waveform_presentation_state_storage_uid
Waveform Presentation State Storage SOP Class UID.
bool is_waveform_storage_sop_class(std::string_view uid) noexcept
Check if a SOP Class UID is a Waveform Storage SOP Class.
bool is_waveform_annotation_sop_class(std::string_view uid) noexcept
Check if a SOP Class UID is a Waveform Annotation SOP Class.
constexpr std::string_view body_position_waveform_storage_uid
Body Position Waveform Storage SOP Class UID.
constexpr std::string_view basic_voice_audio_storage_uid
Basic Voice Audio Waveform Storage SOP Class UID.
constexpr std::string_view emg_waveform_storage_uid
Electromyogram Waveform Storage SOP Class UID.
waveform_type
Waveform type classification.
@ presentation_state
Waveform Presentation State.
constexpr std::string_view multichannel_respiratory_waveform_storage_uid
Multi-channel Respiratory Waveform Storage SOP Class UID.
constexpr std::string_view routine_scalp_eeg_storage_uid
Routine Scalp Electroencephalogram Waveform Storage SOP Class UID.
std::string_view to_string(dx_photometric_interpretation interp) noexcept
Convert photometric interpretation enum to DICOM string.
std::vector< std::string > get_waveform_transfer_syntaxes()
Get recommended transfer syntaxes for waveform objects.
Information about a Waveform Storage SOP Class.
std::string_view uid
Waveform Presentation State and Annotation Storage SOP Classes.