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

Function SliceStateToJson

Modules/RESTAPI/src/mitkRenderingController.cpp:911–928  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

909 // HandlePUT_selectedPosition).
910
911 nlohmann::json SliceStateToJson(const mitk::SliceState& s)
912 {
913 nlohmann::json j;
914 j["step"] = s.step;
915 j["position"] = {s.position[0], s.position[1], s.position[2]};
916 j["bounds"]["steps"] = s.bounds.steps;
917 if (s.bounds.hasPositions)
918 {
919 j["bounds"]["min_position"] = {s.bounds.minPosition[0], s.bounds.minPosition[1], s.bounds.minPosition[2]};
920 j["bounds"]["max_position"] = {s.bounds.maxPosition[0], s.bounds.maxPosition[1], s.bounds.maxPosition[2]};
921 }
922 else
923 {
924 j["bounds"]["min_position"] = nullptr;
925 j["bounds"]["max_position"] = nullptr;
926 }
927 return j;
928 }
929
930 /**
931 * \brief Parse `{"step": N}` from a slice-PUT body.

Calls

no outgoing calls

Tested by

no test coverage detected