PACS System 0.1.0
PACS DICOM system library
Loading...
Searching...
No Matches
measurement_record.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#pragma once
19
20#include <chrono>
21#include <optional>
22#include <string>
23
24namespace kcenon::pacs::storage {
25
29enum class measurement_type {
30 length,
31 area,
32 angle,
34 suv,
37};
38
42[[nodiscard]] inline auto to_string(measurement_type type) -> std::string {
43 switch (type) {
44 case measurement_type::length: return "length";
45 case measurement_type::area: return "area";
46 case measurement_type::angle: return "angle";
47 case measurement_type::hounsfield: return "hounsfield";
48 case measurement_type::suv: return "suv";
49 case measurement_type::ellipse_area: return "ellipse_area";
50 case measurement_type::polygon_area: return "polygon_area";
51 }
52 return "unknown";
53}
54
58[[nodiscard]] inline auto measurement_type_from_string(std::string_view str)
59 -> std::optional<measurement_type> {
60 if (str == "length") return measurement_type::length;
61 if (str == "area") return measurement_type::area;
62 if (str == "angle") return measurement_type::angle;
63 if (str == "hounsfield") return measurement_type::hounsfield;
64 if (str == "suv") return measurement_type::suv;
65 if (str == "ellipse_area") return measurement_type::ellipse_area;
66 if (str == "polygon_area") return measurement_type::polygon_area;
67 return std::nullopt;
68}
69
78 int64_t pk{0};
79
81 std::string measurement_id;
82
84 std::string sop_instance_uid;
85
87 std::optional<int> frame_number;
88
90 std::string user_id;
91
94
96 std::string geometry_json;
97
99 double value{0.0};
100
102 std::string unit;
103
105 std::string label;
106
108 std::chrono::system_clock::time_point created_at;
109
115 [[nodiscard]] auto is_valid() const noexcept -> bool {
116 return !measurement_id.empty() && !sop_instance_uid.empty();
117 }
118};
119
136 std::optional<std::string> sop_instance_uid;
137
139 std::optional<std::string> study_uid;
140
142 std::optional<std::string> user_id;
143
145 std::optional<measurement_type> type;
146
148 size_t limit{0};
149
151 size_t offset{0};
152
158 [[nodiscard]] auto has_criteria() const noexcept -> bool {
159 return sop_instance_uid.has_value() || study_uid.has_value() ||
160 user_id.has_value() || type.has_value();
161 }
162};
163
164} // namespace kcenon::pacs::storage
auto measurement_type_from_string(std::string_view str) -> std::optional< measurement_type >
Parse string to measurement_type.
measurement_type
Measurement types supported by the system.
@ hounsfield
CT Hounsfield unit value.
@ length
Linear distance measurement.
@ area
Area measurement (generic)
@ polygon_area
Polygon area measurement.
@ ellipse_area
Ellipse area measurement.
@ angle
Angle measurement in degrees.
@ suv
PET Standard Uptake Value.
auto to_string(annotation_type type) -> std::string
Convert annotation_type to string.
@ angle
Angle measurement annotation.
std::optional< std::string > sop_instance_uid
SOP Instance UID filter.
auto has_criteria() const noexcept -> bool
Check if any filter criteria is set.
std::optional< std::string > study_uid
Study Instance UID filter (requires join with instances)
size_t limit
Maximum number of results to return (0 = unlimited)
std::optional< measurement_type > type
Measurement type filter.
std::optional< std::string > user_id
User ID filter.
Measurement record from the database.
std::string unit
Unit of measurement (mm, cm2, degrees, HU, g/ml, etc.)
std::string measurement_id
Unique measurement identifier (UUID)
auto is_valid() const noexcept -> bool
Check if this record has valid data.
std::string geometry_json
Geometry data as JSON string (coordinates)
std::chrono::system_clock::time_point created_at
Record creation timestamp.
std::string sop_instance_uid
SOP Instance UID - DICOM tag (0008,0018)
measurement_type type
Type of measurement.
std::string label
Optional label/description.
std::optional< int > frame_number
Frame number for multi-frame images (1-based)
double value
Calculated measurement value.
int64_t pk
Primary key (auto-generated)
std::string user_id
User who created the measurement.