38 if (value.size() == 1) {
39 switch (std::toupper(
static_cast<unsigned char>(value[0]))) {
47 std::string lower_value;
48 lower_value.reserve(value.size());
49 for (
char c : value) {
50 lower_value +=
static_cast<char>(std::tolower(
static_cast<unsigned char>(c)));
55 if (lower_value ==
"bilateral" || lower_value ==
"both") {
63 return value ==
"L" || value ==
"R" || value ==
"B";
104 std::string upper_value;
105 upper_value.reserve(value.size());
106 for (
char c : value) {
107 upper_value +=
static_cast<char>(std::toupper(
static_cast<unsigned char>(c)));
130 if (upper_value ==
"SPOT MAG" || upper_value ==
"SPOTMAG") {
141 if (upper_value ==
"TAN" || upper_value ==
"TANGENTIAL") {
144 if (upper_value ==
"ID" || upper_value ==
"IMPLANT DISPLACED" ||
145 upper_value ==
"IMPLANTDISPLACED") {
168 "CC",
"MLO",
"ML",
"LM",
"XCCL",
"XCCM",
"FB",
"SIO",
"ISO",
169 "CV",
"AT",
"SPOT",
"MAG",
"SPOT MAG",
"RL",
"RM",
"RS",
"RI",
181 return force_n >= 20.0 && force_n <= 300.0;
185 return {50.0, 200.0};
191 return thickness_mm >= 10.0 && thickness_mm <= 150.0;
213 return "NOT PROCESSED";
215 return "PROCESSED - NO FINDINGS";
217 return "PROCESSED - FINDINGS";
219 return "PROCESSING FAILED";
233constexpr std::array<mg_sop_class_info, 5> mg_sop_classes = {{
236 "Digital Mammography X-Ray Image Storage - For Presentation",
237 "Standard 2D mammography images ready for display",
244 "Digital Mammography X-Ray Image Storage - For Processing",
245 "Raw 2D mammography images requiring processing",
252 "Breast Tomosynthesis Image Storage",
253 "3D breast tomosynthesis image set",
260 "Breast Projection X-Ray Image Storage - For Presentation",
261 "Synthesized 2D from tomosynthesis - for display",
268 "Breast Projection X-Ray Image Storage - For Processing",
269 "Synthesized 2D from tomosynthesis - raw",
279 std::vector<std::string> result;
280 result.reserve(mg_sop_classes.size());
282 for (
const auto& info : mg_sop_classes) {
283 if (!include_tomosynthesis && info.is_tomosynthesis) {
286 result.emplace_back(info.uid);
293 auto it = std::find_if(mg_sop_classes.begin(), mg_sop_classes.end(),
295 return info.uid == uid;
298 if (it != mg_sop_classes.end()) {
310 return info && info->is_tomosynthesis;
330 "1.2.840.10008.1.2.4.201",
332 "1.2.840.10008.1.2.4.90",
334 "1.2.840.10008.1.2.4.70",
336 "1.2.840.10008.1.2.4.91",
338 "1.2.840.10008.1.2.1",
373std::vector<std::pair<breast_laterality, mg_view_position>>
391 result += is_original ?
"ORIGINAL" :
"DERIVED";
395 result += is_primary ?
"PRIMARY" :
"SECONDARY";
Digital Mammography X-Ray Image Storage SOP Classes.
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.
constexpr std::string_view mg_image_storage_for_presentation_uid
Digital Mammography X-Ray Image Storage - For Presentation SOP Class UID.
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.
@ 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)
@ other
Other or unspecified view.
@ at
Axillary Tail - for axillary extension.
@ ml
Mediolateral - true lateral (medial to lateral)
@ implant
Implant displaced view (Eklund technique)
@ spot
Spot compression view.
@ 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.
@ for_presentation
Ready for display and diagnosis.
@ for_processing
Raw data requiring further processing.
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.
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.
cad_processing_status
CAD (Computer-Aided Detection) processing status.
@ not_processed
CAD has not been run on this image.
@ pending
CAD processing is pending.
@ processed_no_findings
CAD completed with no findings.
@ processing_failed
CAD processing failed.
@ processed_findings
CAD completed with 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.
@ right
Right breast (DICOM value: "R")
@ left
Left breast (DICOM value: "L")
@ 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.
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.
std::string_view to_string(dx_photometric_interpretation interp) noexcept
Convert photometric interpretation enum to DICOM string.
Information about a Mammography Storage SOP Class.