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

Function ReadVector3D

Modules/RESTAPI/src/mitkRenderingController.cpp:700–713  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

698 }
699
700 std::optional<std::string> ReadVector3D(const nlohmann::json& arr, mitk::Vector3D& out)
701 {
702 if (!arr.is_array())
703 return "must be an array of 3 numbers";
704 if (arr.size() != 3)
705 return "must have exactly 3 elements, got " + std::to_string(arr.size());
706 for (std::size_t i = 0; i < 3; ++i)
707 {
708 if (!arr[i].is_number())
709 return "element " + std::to_string(i) + " is not a number";
710 out[i] = arr[i].get<double>();
711 }
712 return std::nullopt;
713 }
714
715 /**
716 * \brief Parse and validate a camera patch body for a given window kind.

Callers 1

ParseCameraPatchFunction · 0.85

Calls 1

sizeMethod · 0.45

Tested by

no test coverage detected