MCPcopy Create free account
hub / github.com/MITK/MITK / to_json

Method to_json

Modules/ROI/src/mitkROI.cpp:15–45  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

13#include <mitkROI.h>
14
15void 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
47void mitk::from_json(const nlohmann::json& j, ROI::Element& roi)
48{

Callers

nothing calls this directly

Calls 9

HasTimeStepsMethod · 0.80
GetTimeStepsMethod · 0.80
GetDefaultPropertiesMethod · 0.80
GetIDMethod · 0.45
GetMinMethod · 0.45
GetMaxMethod · 0.45
GetPropertiesMethod · 0.45
IsEmptyMethod · 0.45
ToJSONMethod · 0.45

Tested by

no test coverage detected