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

Method GetModelLicense

Modules/PythonSegmentation/src/mitknnInteractiveTool.cpp:1368–1395  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1366}
1367
1368std::optional<std::string> mitk::nnInteractiveTool::GetModelLicense() const
1369{
1370 if (!this->IsSessionRunning())
1371 return std::nullopt;
1372
1373 try
1374 {
1375 auto pythonContext = m_Impl->GetPythonContext();
1376
1377 // session.license is a cached attribute on both local and remote sessions
1378 // (the remote one reads it from the server's /capabilities during
1379 // construction), so this is a plain local attribute read: no network call
1380 // and no remote guard needed.
1381 pythonContext->Execute("nni_license = getattr(session, 'license', None) or ''\n");
1382 const auto license = pythonContext->GetVariableAsString("nni_license").value_or("");
1383 pythonContext->Execute("del nni_license\n");
1384
1385 if (license.empty())
1386 return std::nullopt;
1387
1388 return license;
1389 }
1390 catch (const Exception& e)
1391 {
1392 MITK_WARN << "nnInteractive: could not read the model license: " << e.GetDescription();
1393 return std::nullopt;
1394 }
1395}
1396
1397bool mitk::nnInteractiveTool::SupportsUndo() const
1398{

Callers 1

Calls 6

IsSessionRunningMethod · 0.95
GetVariableAsStringMethod · 0.80
GetPythonContextMethod · 0.45
ExecuteMethod · 0.45
emptyMethod · 0.45
GetDescriptionMethod · 0.45

Tested by

no test coverage detected