PACS System 0.1.0
PACS DICOM system library
Loading...
Searching...
No Matches
mg_storage.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
26#ifndef PACS_SERVICES_SOP_CLASSES_MG_STORAGE_HPP
27#define PACS_SERVICES_SOP_CLASSES_MG_STORAGE_HPP
28
29#include <array>
30#include <cstdint>
31#include <optional>
32#include <string>
33#include <string_view>
34#include <vector>
35
37
38// =============================================================================
39// Digital Mammography Storage SOP Class UIDs (re-exported from dx_storage.hpp)
40// =============================================================================
41
44
46inline constexpr std::string_view mg_image_storage_for_presentation_uid =
47 "1.2.840.10008.5.1.4.1.1.1.2";
48
50inline constexpr std::string_view mg_image_storage_for_processing_uid =
51 "1.2.840.10008.5.1.4.1.1.1.2.1";
52
54inline constexpr std::string_view breast_tomosynthesis_image_storage_uid =
55 "1.2.840.10008.5.1.4.1.1.13.1.3";
56
59 "1.2.840.10008.5.1.4.1.1.13.1.4";
60
62inline constexpr std::string_view breast_projection_image_storage_for_processing_uid =
63 "1.2.840.10008.5.1.4.1.1.13.1.5";
64
66
67// =============================================================================
68// Breast Laterality
69// =============================================================================
70
81 left,
82 right,
83 bilateral,
84 unknown
85};
86
92[[nodiscard]] std::string_view to_string(breast_laterality laterality) noexcept;
93
99[[nodiscard]] breast_laterality parse_breast_laterality(std::string_view value) noexcept;
100
106[[nodiscard]] bool is_valid_breast_laterality(std::string_view value) noexcept;
107
108// =============================================================================
109// Mammography View Position
110// =============================================================================
111
123 // Standard screening views
124 cc,
125 mlo,
126
127 // Additional diagnostic views
128 ml,
129 lm,
130 xccl,
131 xccm,
132 fb,
133 sio,
134 iso,
135 cv,
136 at,
137
138 // Spot/magnification views
139 spot,
140 mag,
141 spot_mag,
142 rl,
143 rm,
144 rs,
145 ri,
146
147 // Specialized views
148 tangen,
149 implant,
150 id,
151
152 // Other
153 other
154};
155
161[[nodiscard]] std::string_view to_string(mg_view_position position) noexcept;
162
168[[nodiscard]] mg_view_position parse_mg_view_position(std::string_view value) noexcept;
169
179[[nodiscard]] bool is_screening_view(mg_view_position position) noexcept;
180
186[[nodiscard]] bool is_magnification_view(mg_view_position position) noexcept;
187
193[[nodiscard]] bool is_spot_compression_view(mg_view_position position) noexcept;
194
199[[nodiscard]] std::vector<std::string_view> get_valid_mg_view_positions() noexcept;
200
201// =============================================================================
202// Mammography Image Acquisition Parameters
203// =============================================================================
204
213 std::optional<double> compression_force_n;
214
216 std::optional<double> compressed_breast_thickness_mm;
217
219 std::optional<double> relative_x_ray_exposure;
220
222 std::optional<double> entrance_dose_dgy;
223
225 std::optional<std::string> entrance_dose_derivation;
226
228 std::optional<double> organ_dose_dgy;
229
231 std::optional<double> half_value_layer_mm;
232
234 std::optional<double> kvp;
235
237 std::optional<double> exposure_time_ms;
238
240 std::optional<double> tube_current_ma;
241
243 std::optional<double> exposure_mas;
244
246 std::optional<std::string> anode_target_material;
247
249 std::optional<std::string> filter_material;
250
252 std::optional<double> filter_thickness_mm;
253
255 std::optional<double> focal_spot_mm;
256
258 std::optional<bool> breast_implant_present;
259
261 std::optional<bool> partial_view;
262
264 std::optional<std::string> partial_view_description;
265};
266
277[[nodiscard]] bool is_valid_compression_force(double force_n) noexcept;
278
283[[nodiscard]] std::pair<double, double> get_typical_compression_force_range() noexcept;
284
291[[nodiscard]] bool is_valid_compressed_breast_thickness(double thickness_mm) noexcept;
292
293// =============================================================================
294// Mammography Image Type
295// =============================================================================
296
308
314[[nodiscard]] std::string_view to_string(mg_image_type type) noexcept;
315
316// =============================================================================
317// Mammography CAD Integration
318// =============================================================================
319
332
338[[nodiscard]] std::string_view to_string(cad_processing_status status) noexcept;
339
340// =============================================================================
341// Mammography SOP Class Information
342// =============================================================================
343
348 std::string_view uid;
349 std::string_view name;
350 std::string_view description;
354};
355
365[[nodiscard]] std::vector<std::string>
366get_mg_storage_sop_classes(bool include_tomosynthesis = true);
367
374[[nodiscard]] const mg_sop_class_info*
375get_mg_sop_class_info(std::string_view uid) noexcept;
376
385[[nodiscard]] bool is_mg_storage_sop_class(std::string_view uid) noexcept;
386
393[[nodiscard]] bool is_breast_tomosynthesis_sop_class(std::string_view uid) noexcept;
394
401[[nodiscard]] bool is_mg_for_processing_sop_class(std::string_view uid) noexcept;
402
409[[nodiscard]] bool is_mg_for_presentation_sop_class(std::string_view uid) noexcept;
410
411// =============================================================================
412// Transfer Syntax Recommendations
413// =============================================================================
414
424[[nodiscard]] std::vector<std::string> get_mg_transfer_syntaxes();
425
426// =============================================================================
427// Utility Functions
428// =============================================================================
429
440[[nodiscard]] bool is_valid_laterality_view_combination(
441 breast_laterality laterality,
442 mg_view_position view) noexcept;
443
452[[nodiscard]] std::vector<std::pair<breast_laterality, mg_view_position>>
454
466[[nodiscard]] std::string create_mg_image_type(
467 bool is_original,
468 bool is_primary,
469 mg_image_type type);
470
471} // namespace kcenon::pacs::services::sop_classes
472
473#endif // PACS_SERVICES_SOP_CLASSES_MG_STORAGE_HPP
std::vector< std::string > get_mg_storage_sop_classes(bool include_tomosynthesis=true)
Get all Mammography Storage SOP Class UIDs.
std::pair< double, double > get_typical_compression_force_range() noexcept
Get typical compression force range.
bool is_valid_compression_force(double force_n) noexcept
Validate compression force value.
bool is_mg_for_presentation_sop_class(std::string_view uid) noexcept
Check if a SOP Class UID is a For Presentation mammography SOP Class.
bool is_valid_compressed_breast_thickness(double thickness_mm) noexcept
Validate compressed breast thickness.
constexpr std::string_view breast_tomosynthesis_image_storage_uid
Breast Tomosynthesis Image Storage SOP Class UID.
Definition mg_storage.h:54
constexpr std::string_view mg_image_storage_for_presentation_uid
Digital Mammography X-Ray Image Storage - For Presentation SOP Class UID.
Definition mg_storage.h:46
std::vector< std::pair< breast_laterality, mg_view_position > > get_standard_screening_views() noexcept
Get standard four-view screening exam views.
mg_view_position
Mammography-specific view positions.
Definition mg_storage.h:122
@ lm
Lateromedial - true lateral (lateral to medial)
@ spot_mag
Spot compression with magnification.
@ fb
From Below - inferior to superior view.
@ sio
Superolateral to Inferomedial Oblique.
@ xccl
Exaggerated CC Laterally - for lateral breast tissue.
@ xccm
Exaggerated CC Medially - for medial breast tissue.
@ mlo
Mediolateral Oblique - angled lateral view (most common)
@ at
Axillary Tail - for axillary extension.
@ ml
Mediolateral - true lateral (medial to lateral)
@ implant
Implant displaced view (Eklund technique)
@ id
Implant Displaced (alternate code)
@ cv
Cleavage View - for medial breast tissue.
@ cc
Craniocaudal - standard superior-inferior view.
@ iso
Inferomedial to Superolateral Oblique.
const mg_sop_class_info * get_mg_sop_class_info(std::string_view uid) noexcept
Get information about a specific Mammography SOP Class.
mg_image_type
Mammography image purpose classification.
Definition mg_storage.h:304
bool is_breast_tomosynthesis_sop_class(std::string_view uid) noexcept
Check if a SOP Class UID is a breast tomosynthesis SOP Class.
mg_view_position parse_mg_view_position(std::string_view value) noexcept
Parse DICOM view position string to mammography view enum.
std::string create_mg_image_type(bool is_original, bool is_primary, mg_image_type type)
Create DICOM-compliant image type value for mammography.
constexpr std::string_view breast_projection_image_storage_for_processing_uid
Breast Projection X-Ray Image Storage - For Processing SOP Class UID.
Definition mg_storage.h:62
bool is_valid_laterality_view_combination(breast_laterality laterality, mg_view_position view) noexcept
Check if laterality and view position are consistent.
bool is_mg_storage_sop_class(std::string_view uid) noexcept
Check if a SOP Class UID is a Mammography Storage SOP Class.
bool is_magnification_view(mg_view_position position) noexcept
Check if a view position requires magnification.
breast_laterality parse_breast_laterality(std::string_view value) noexcept
Parse DICOM laterality string to enum.
bool is_valid_breast_laterality(std::string_view value) noexcept
Check if a laterality value is valid for mammography.
std::vector< std::string_view > get_valid_mg_view_positions() noexcept
Get all valid mammography view position strings.
std::vector< std::string > get_mg_transfer_syntaxes()
Get recommended transfer syntaxes for mammography images.
@ for_presentation
Ready for display and diagnosis.
@ for_processing
Raw data requiring further processing.
cad_processing_status
CAD (Computer-Aided Detection) processing status.
Definition mg_storage.h:325
@ not_processed
CAD has not been run on this image.
@ processed_no_findings
CAD completed with no findings.
bool is_spot_compression_view(mg_view_position position) noexcept
Check if a view position involves spot compression.
bool is_screening_view(mg_view_position position) noexcept
Check if a view position is a standard screening view.
breast_laterality
Breast laterality enumeration.
Definition mg_storage.h:80
@ unknown
Unknown or unspecified laterality.
@ bilateral
Both breasts (DICOM value: "B") - used for comparison views.
constexpr std::string_view mg_image_storage_for_processing_uid
Digital Mammography X-Ray Image Storage - For Processing SOP Class UID.
Definition mg_storage.h:50
bool is_mg_for_processing_sop_class(std::string_view uid) noexcept
Check if a SOP Class UID is a For Processing mammography SOP Class.
constexpr std::string_view breast_projection_image_storage_for_presentation_uid
Breast Projection X-Ray Image Storage - For Presentation SOP Class UID.
Definition mg_storage.h:58
std::string_view to_string(dx_photometric_interpretation interp) noexcept
Convert photometric interpretation enum to DICOM string.
Mammography acquisition parameters structure.
Definition mg_storage.h:211
std::optional< double > kvp
KVP - X-ray tube peak kilovoltage (0018,0060)
Definition mg_storage.h:234
std::optional< bool > partial_view
Partial view flag (0028,1350)
Definition mg_storage.h:261
std::optional< double > half_value_layer_mm
Half value layer in mm Al (0040,0314)
Definition mg_storage.h:231
std::optional< std::string > partial_view_description
Partial view description (0028,1351)
Definition mg_storage.h:264
std::optional< double > exposure_time_ms
Exposure time in ms (0018,1150)
Definition mg_storage.h:237
std::optional< double > entrance_dose_dgy
Entrance dose in dGy (0040,0302)
Definition mg_storage.h:222
std::optional< double > focal_spot_mm
Focal spot size in mm (0018,1190)
Definition mg_storage.h:255
std::optional< double > organ_dose_dgy
Organ dose in dGy (0040,0316)
Definition mg_storage.h:228
std::optional< bool > breast_implant_present
Breast implant present (0028,1300)
Definition mg_storage.h:258
std::optional< double > tube_current_ma
X-ray tube current in mA (0018,1151)
Definition mg_storage.h:240
std::optional< double > compression_force_n
Compression force in Newtons (0018,11A2)
Definition mg_storage.h:213
std::optional< double > filter_thickness_mm
Filter thickness in mm (0018,7052)
Definition mg_storage.h:252
std::optional< std::string > filter_material
Filter material (0018,7050)
Definition mg_storage.h:249
std::optional< double > exposure_mas
Exposure in mAs (0018,1153)
Definition mg_storage.h:243
std::optional< double > relative_x_ray_exposure
Relative X-ray exposure (0018,1405)
Definition mg_storage.h:219
std::optional< std::string > entrance_dose_derivation
Entrance dose derivation (0040,0303)
Definition mg_storage.h:225
std::optional< std::string > anode_target_material
Anode target material (0018,1191)
Definition mg_storage.h:246
std::optional< double > compressed_breast_thickness_mm
Compressed breast thickness in mm (0018,11A0)
Definition mg_storage.h:216
Information about a Mammography Storage SOP Class.
Definition mg_storage.h:347
std::string_view name
Human-readable name.
Definition mg_storage.h:349
mg_image_type image_type
For Presentation or For Processing.
Definition mg_storage.h:351
bool is_tomosynthesis
True if this is a tomosynthesis class.
Definition mg_storage.h:352
std::string_view description
Brief description.
Definition mg_storage.h:350
std::string_view uid