13 #ifndef mitkPythonContext_h
14 #define mitkPythonContext_h
190 std::unique_ptr<Impl> m_Impl;
#define MITKPYTHON_EXPORT
Image class for storing multi-dimensional medical image data.
Provides a Python interpreter context for executing Python code and interacting with MITK data like i...
~PythonContext()
Destructor. Clears the internal Python dictionary.
std::optional< bool > GetVariableAsBool(const std::string &varName)
Retrieves a Python variable as a bool.
void BindImage(mitk::Image *image, const std::string &varName)
Binds an MITK image to a Python variable in the context's dictionary.
void ExecuteFile(const fs::path &filePath)
Executes a Python file within this context.
std::optional< std::string > GetVariableAsString(const std::string &varName)
Retrieves a Python variable as a string.
PythonContext(const std::string &venvName={})
Constructs a PythonContext and optionally creates or activates a virtual environment.
std::optional< double > GetVariableAsDouble(const std::string &varName)
Retrieves a Python variable as a double.
void Activate(bool importBindings=true)
Initializes the Python interpreter context and sets up module paths.
bool HasVariable(const std::string &varName)
Checks whether a Python variable with the given name exists.
std::optional< int > GetVariableAsInt(const std::string &varName)
Retrieves a Python variable as an int.
void Execute(const std::string &expression)
Executes arbitrary Python code within this context.
Portability header that provides a unified namespace alias for the C++ filesystem library.
Find image slices visible on a given plane.