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

Method BindImage

Modules/Python/src/mitkPythonContext.cpp:226–244  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

224}
225
226void mitk::PythonContext::BindImage(Image* image, const std::string& varName)
227{
228 py::gil_scoped_acquire gil;
229
230 if (image == nullptr)
231 {
232 m_Impl->Dictionary[py::str(varName)] = py::none();
233 return;
234 }
235
236 try
237 {
238 m_Impl->Dictionary[py::str(varName)] = py::cast(image, py::return_value_policy::reference);
239 }
240 catch (const py::error_already_set& e)
241 {
242 mitkThrow() << "Could not bind image to Python variable \"" << varName << "\": " << e.what();
243 }
244}
245
246bool mitk::PythonContext::HasVariable(const std::string &varName)
247{

Callers 5

TestBindImageToPythonMethod · 0.80
AddLassoInteractionMethod · 0.80

Calls 1

whatMethod · 0.80

Tested by 1

TestBindImageToPythonMethod · 0.64