14#include <unordered_map>
25 "1.2.840.10008.1.2.1",
29 "1.2.840.10008.1.2.4.201",
31 "1.2.840.10008.1.2.4.90",
33 "1.2.840.10008.1.2.5",
35 "1.2.840.10008.1.2.4.70"
54 if (value ==
"FRACTIONAL") {
61 return value ==
"BINARY" || value ==
"FRACTIONAL";
80 if (value ==
"OCCUPANCY") {
95 return "SEMIAUTOMATIC";
104 if (value ==
"AUTOMATIC") {
107 if (value ==
"SEMIAUTOMATIC") {
114 return value ==
"AUTOMATIC" ||
115 value ==
"SEMIAUTOMATIC" ||
129const std::unordered_map<std::string_view, segment_color> standard_colors = {
131 {
"Liver", {43690, 39321, 42597}},
132 {
"Kidney", {36044, 43690, 29491}},
133 {
"Spleen", {38229, 42597, 30583}},
134 {
"Pancreas", {47185, 37945, 39321}},
135 {
"Heart", {32768, 49151, 32768}},
136 {
"Lung", {54612, 32112, 34078}},
137 {
"Brain", {54612, 34406, 32768}},
138 {
"Bone", {61166, 32768, 35389}},
139 {
"Muscle", {40894, 39977, 32768}},
142 {
"Tumor", {32768, 52428, 32768}},
143 {
"Lesion", {36044, 49151, 36044}},
144 {
"Nodule", {40894, 45874, 34406}},
147 {
"Artery", {29491, 52428, 32768}},
148 {
"Vein", {32768, 32768, 45874}},
149 {
"Vessel", {36044, 45874, 38229}},
152 {
"Air", {58981, 32768, 32768}},
153 {
"Fat", {52428, 35389, 29491}},
154 {
"Fluid", {45874, 32768, 49151}},
155 {
"Default", {43690, 32768, 32768}}
161 auto it = standard_colors.find(segment_label);
162 if (it != standard_colors.end()) {
166 return standard_colors.at(
"Default");
175constexpr std::array<seg_sop_class_info, 4> seg_sop_classes = {{
178 "Segmentation Storage",
179 "Binary or fractional segmentation of medical images",
185 "Surface Segmentation Storage",
186 "3D surface mesh segmentation",
192 "Heightmap Segmentation Storage",
193 "Height-value based retinal layer boundary segmentation (Sup 240)",
199 "Label Map Segmentation Storage",
200 "Non-overlapping integer label voxel classification (Sup 243)",
209 std::vector<std::string> result;
210 result.reserve(include_surface ? 4 : 3);
212 for (
const auto& info : seg_sop_classes) {
213 if (!info.is_surface || include_surface) {
214 result.emplace_back(info.uid);
221const seg_sop_class_info*
223 auto it = std::find_if(
224 seg_sop_classes.begin(),
225 seg_sop_classes.end(),
226 [
uid](
const auto& info) { return info.uid == uid; }
229 if (it != seg_sop_classes.end()) {
249struct category_code_info {
254constexpr std::array<category_code_info, 7> category_codes = {{
255 {
"85756007",
"Tissue"},
256 {
"123037004",
"Anatomical Structure"},
257 {
"260787004",
"Physical Object"},
258 {
"49755003",
"Morphologically Abnormal Structure"},
259 {
"246464006",
"Function"},
260 {
"272737002",
"Spatial Concept"},
261 {
"91720002",
"Body Substance"}
267 auto index =
static_cast<size_t>(category);
268 if (index < category_codes.size()) {
269 return category_codes[index].code;
271 return category_codes[0].code;
275 auto index =
static_cast<size_t>(category);
276 if (index < category_codes.size()) {
277 return category_codes[index].meaning;
279 return category_codes[0].meaning;
std::string_view get_segment_category_code(segment_category category) noexcept
Get SNOMED CT code for segment category.
const seg_sop_class_info * get_seg_sop_class_info(std::string_view uid) noexcept
Get information about a specific SEG SOP Class.
constexpr std::string_view label_map_segmentation_storage_uid
Label Map Segmentation Storage SOP Class UID (Supplement 243)
segment_algorithm_type parse_segment_algorithm_type(std::string_view value) noexcept
Parse segment algorithm type from DICOM string.
segment_algorithm_type
Segment algorithm type (0062,0008)
@ automatic
AUTOMATIC - Fully automated segmentation.
@ manual
MANUAL - Manual segmentation.
@ semiautomatic
SEMIAUTOMATIC - Semi-automated with user input.
segmentation_fractional_type parse_segmentation_fractional_type(std::string_view value) noexcept
Parse segmentation fractional type from DICOM string.
bool is_valid_segmentation_type(std::string_view value) noexcept
Check if segmentation type string is valid.
constexpr std::string_view heightmap_segmentation_storage_uid
Heightmap Segmentation Storage SOP Class UID (Supplement 240)
bool is_surface_segmentation_sop_class(std::string_view uid) noexcept
Check if a SOP Class UID is Surface Segmentation.
segmentation_type parse_segmentation_type(std::string_view value) noexcept
Parse segmentation type from DICOM string.
std::vector< std::string > get_seg_storage_sop_classes(bool include_surface=true)
Get all SEG Storage SOP Class UIDs.
constexpr std::string_view surface_segmentation_storage_uid
Surface Segmentation Storage SOP Class UID.
std::vector< std::string > get_seg_transfer_syntaxes()
Get recommended transfer syntaxes for SEG objects.
bool is_valid_segment_algorithm_type(std::string_view value) noexcept
Check if segment algorithm type string is valid.
segmentation_type
Segmentation type (0062,0001)
@ binary
BINARY - Binary segmentation (0 or 1)
@ fractional
FRACTIONAL - Fractional/probabilistic segmentation.
constexpr std::string_view segmentation_storage_uid
Segmentation Storage SOP Class UID.
bool is_seg_storage_sop_class(std::string_view uid) noexcept
Check if a SOP Class UID is a SEG Storage SOP Class.
segmentation_fractional_type
Segmentation fractional type (0062,0010)
@ probability
PROBABILITY - Values represent probability (0.0-1.0)
@ occupancy
OCCUPANCY - Values represent fractional occupancy.
segment_color get_recommended_segment_color(std::string_view segment_label) noexcept
Get recommended color for common segment types.
std::string_view get_segment_category_meaning(segment_category category) noexcept
Get code meaning for segment category.
segment_category
Common anatomical property categories (CID 7150)
std::string_view to_string(dx_photometric_interpretation interp) noexcept
Convert photometric interpretation enum to DICOM string.
Segmentation (SEG) Storage SOP Classes.
Standard segment colors for common anatomical structures.