13 #ifndef mitkPythonContext_h
14 #define mitkPythonContext_h
29 itkFactorylessNewMacro(Self);
81 std::string
GetStdOut(
const std::string &varName =
"_mitk_stdout");
89 std::unique_ptr<Impl> m_Impl;
93 MITKPYTHON_EXPORT std::optional<bool> PythonContext::GetVariableAs<bool>(
const std::string&);
99 MITKPYTHON_EXPORT std::optional<double> PythonContext::GetVariableAs<double>(
const std::string&);
102 MITKPYTHON_EXPORT std::optional<std::string> PythonContext::GetVariableAs<std::string>(
const std::string&);
#define MITKPYTHON_EXPORT
Base of all data objects.
Image class for storing images.
std::string ExecuteFile(const std::string &filePath)
Executes the given python file in the current context defined by globals (m_GlobalDictionary) & local...
PythonContext(const std::string &venvName={})
std::string GetStdOut(const std::string &varName="_mitk_stdout")
Returns value from the given string stream object. See: https://docs.python.org/3/library/io....
std::optional< T > GetVariableAs(const std::string &varName)
mitkClassMacroItkParent(PythonContext, itk::LightObject)
bool HasVariable(const std::string &varName)
Check if given variable exists in the current context defined by globals (m_GlobalDictionary) & local...
void TransferBaseDataToPython(mitk::BaseData *mitkImage, const std::string &varName="_mitk_image")
Creates view of mitk::BaseData pointer in MITK into corresponding SWIG proxy type object in Python.
mitkNewMacro1Param(Self, const std::string &)
void Activate()
Imports essential python packages: numpy, os, sys, io and pyMITK. Also adds current bin folder to pat...
std::string ExecuteString(const std::string &pyCommands)
Executes the given python syntax in the current context defined by globals (m_GlobalDictionary) & loc...
std::string GetPythonExceptionTraceback()
Returns any exception stacktrace occured in python as string back to MITK.
mitk::Image * LoadImageFromPython(const std::string &varName)
Provides view into mitk::Image type object in Python as mitk::Image* pointer in MITK.
Find image slices visible on a given plane.