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

Method FetchOverallInfo

Modules/Segmentation/src/Interactions/mitkMonaiLabelTool.cpp:439–472  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

437}
438
439void mitk::MonaiLabelTool::FetchOverallInfo(const std::string &hostName, const int &port)
440{
441 m_InfoParameters.reset();
442 if (!IsMonaiServerOn(hostName, port))
443 {
444 Tool::ErrorMessage.Send(m_SERVER_503_ERROR_TEXT);
445 mitkThrow() << m_SERVER_503_ERROR_TEXT;
446 }
447 httplib::SSLClient cli(hostName, port);
448 cli.enable_server_certificate_verification(false);
449 if (auto response = cli.Get("/info/"))
450 {
451 if (response->status == 200)
452 {
453 auto jsonObj = nlohmann::json::parse(response->body);
454 if (jsonObj.is_discarded() || !jsonObj.is_object())
455 {
456 MITK_ERROR << "Could not parse response from MONAILabel server as JSON object!";
457 return;
458 }
459 auto appData = jsonObj.template get<mitk::MonaiAppMetadata>();
460 m_InfoParameters = std::make_unique<mitk::MonaiAppMetadata>(appData);
461 if (nullptr != m_InfoParameters)
462 {
463 m_InfoParameters->hostName = hostName;
464 m_InfoParameters->port = port;
465 }
466 }
467 }
468 else
469 {
470 Tool::ErrorMessage.Send(httplib::to_string(response.error()) + " error occurred.");
471 }
472}
473
474void mitk::MonaiLabelTool::PostInferRequest(const std::string &hostName,
475 const int &port,

Callers 1

OnFetchBtnClickedMethod · 0.80

Calls 4

resetMethod · 0.80
SendMethod · 0.45
GetMethod · 0.45
errorMethod · 0.45

Tested by

no test coverage detected