| 13 | #include <mitkROI.h> |
| 14 | |
| 15 | void mitk::to_json(nlohmann::json& j, const ROI::Element& roi) |
| 16 | { |
| 17 | j["ID"] = roi.GetID(); |
| 18 | |
| 19 | if (roi.HasTimeSteps()) |
| 20 | { |
| 21 | auto timeSteps = roi.GetTimeSteps(); |
| 22 | |
| 23 | for (const auto t : timeSteps) |
| 24 | { |
| 25 | nlohmann::json jTimeStep = { |
| 26 | { "t", t }, |
| 27 | { "Min", roi.GetMin(t) }, |
| 28 | { "Max", roi.GetMax(t) } |
| 29 | }; |
| 30 | |
| 31 | if (auto* properties = roi.GetProperties(t); properties != nullptr && !properties->IsEmpty()) |
| 32 | properties->ToJSON(jTimeStep["Properties"]); |
| 33 | |
| 34 | j["TimeSteps"].push_back(jTimeStep); |
| 35 | } |
| 36 | } |
| 37 | else |
| 38 | { |
| 39 | j["Min"] = roi.GetMin(); |
| 40 | j["Max"] = roi.GetMax(); |
| 41 | } |
| 42 | |
| 43 | if (auto* properties = roi.GetDefaultProperties(); properties != nullptr && !properties->IsEmpty()) |
| 44 | properties->ToJSON(j["Properties"]); |
| 45 | } |
| 46 | |
| 47 | void mitk::from_json(const nlohmann::json& j, ROI::Element& roi) |
| 48 | { |
nothing calls this directly
no test coverage detected