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

Method from_json

Modules/ROI/src/mitkROI.cpp:47–81  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

45}
46
47void mitk::from_json(const nlohmann::json& j, ROI::Element& roi)
48{
49 auto id = j["ID"].get<unsigned int>();
50 roi.SetID(id);
51
52 if (j.contains("TimeSteps"))
53 {
54 for (const auto& jTimeStep : j["TimeSteps"])
55 {
56 auto t = jTimeStep["t"].get<TimeStepType>();
57
58 roi.SetMin(jTimeStep["Min"].get<Point3D>(), t);
59 roi.SetMax(jTimeStep["Max"].get<Point3D>(), t);
60
61 if (jTimeStep.contains("Properties"))
62 {
63 auto properties = mitk::PropertyList::New();
64 properties->FromJSON(jTimeStep["Properties"]);
65 roi.SetProperties(properties, t);
66 }
67 }
68 }
69 else
70 {
71 roi.SetMin(j["Min"].get<Point3D>());
72 roi.SetMax(j["Max"].get<Point3D>());
73 }
74
75 if (j.contains("Properties"))
76 {
77 auto properties = mitk::PropertyList::New();
78 properties->FromJSON(j["Properties"]);
79 roi.SetDefaultProperties(properties);
80 }
81}
82
83mitk::ROI::Element::Element()
84 : Element(0)

Callers

nothing calls this directly

Calls 8

containsMethod · 0.80
SetMinMethod · 0.80
SetMaxMethod · 0.80
NewFunction · 0.50
SetIDMethod · 0.45
FromJSONMethod · 0.45
SetPropertiesMethod · 0.45
SetDefaultPropertiesMethod · 0.45

Tested by

no test coverage detected