| 
    Medical Imaging Interaction Toolkit
    2025.08.00
    
   Medical Imaging Interaction Toolkit 
   | 
 
Abstract Class to Setup a python virtual environment and pip install required packages. Derive this class for creating installer for the respective tool. More...
#include <QmitkSetupVirtualEnvUtil.h>

Public Types | |
| using | CallbackType = void(*)(itk::Object *, const itk::EventObject &, void *) | 
Public Member Functions | |
| QmitkSetupVirtualEnvUtil (const QString &baseDir) | |
| QmitkSetupVirtualEnvUtil () | |
| bool | SetupVirtualEnv (const QString &venvName, const QStringList &packages, std::function< bool()> validator, CallbackType printCallback, const QString &torchVersion="") | 
| Sets up a python virtual environment in the DKFZ directory with given.  More... | |
| virtual QString | GetVirtualEnvPath () | 
| Get the Virtual Env Path object. Override this method in the respective tool installer class.  More... | |
| void | PipInstall (const std::string &library, const std::string &workingDir, CallbackType callback, const std::string &command="pip3") | 
| Function to Pip install a library package given the location of pip3 executable. Any callback function can be passed to process the output.  More... | |
| void | PipInstall (const std::string &library, CallbackType callback, const std::string &command="pip3") | 
| Overloaded function to Pip install a library function.  More... | |
| void | ExecutePython (const std::string &args, const std::string &pythonPath, CallbackType callback, const std::string &command="python") | 
| Function to execute any python code given a python path. Any callback function can be passed to process the output.  More... | |
| void | ExecutePython (const std::string &args, CallbackType callback, const std::string &command="python") | 
| Overloaded function to Execute Python code. Any callback function can be passed to process the output.  More... | |
| void | InstallPytorch (const QString &workingDir, CallbackType callback, const QString &torchVersion="") | 
| Installs pytorch using light-the-torch package, correctly identifying cuda version. Requires location of pip3 executable. Any callback function can be passed to process the output.  More... | |
| void | InstallPytorch (const QString &torchVersion="") | 
| Overloaded function to install pytorch using light-the-torch package, correctly identifying cuda version.  More... | |
| void | InstallPytorch (CallbackType callback, const QString &torchVersion="") | 
| Overloaded function to install pytorch using light-the-torch package, correctly identifying cuda version.  More... | |
| QString & | GetBaseDir () | 
| Get the Base Dir object.  More... | |
| QString & | GetSystemPythonPath () | 
| Get the System Python Path object.  More... | |
| QString & | GetPythonPath () | 
| Get the Python Path object.  More... | |
| QString & | GetPipPath () | 
| Get the Pip Path object.  More... | |
| void | SetSystemPythonPath (const QString &path) | 
| Set the System Python Path object.  More... | |
| void | SetPythonPath (const QString &path) | 
| Set the Python Path object.  More... | |
| void | SetPipPath (const QString &path) | 
| Set the Pip Path object.  More... | |
| void | SetVirtualEnvPath (const QString &path) | 
| Set the Virtual Env Path object.  More... | |
| bool | IsPythonPath (const QString &pythonPath) | 
| Check if the path provide has python executable or not.  More... | |
Static Public Member Functions | |
| static bool | IsVenvInstalled (const QString &pythonPath) | 
| Checks if venv module is available for the python.  More... | |
| static QString | GetPipPackageVersion (const QString &pythonPath, const QString &packageName) | 
| Returns version of the pip installed package.  More... | |
| static void | PrintProcessEvent (itk::Object *, const itk::EventObject &e, void *) | 
| Function can be used as callback to simply print out all the process execution output parsed out from itk::EventObject.  More... | |
| static std::pair< QString, QString > | GetExactPythonPath (const QString &pyEnv) | 
| Get the exact Python path and version for any OS from the virtual environment path.  More... | |
| static QStringList | AutoParsePythonPaths () | 
| Searches and parses paths of python virtual environments from predefined lookout locations.  More... | |
Abstract Class to Setup a python virtual environment and pip install required packages. Derive this class for creating installer for the respective tool.
Definition at line 26 of file QmitkSetupVirtualEnvUtil.h.
| using QmitkSetupVirtualEnvUtil::CallbackType = void (*)(itk::Object *, const itk::EventObject &, void *) | 
Definition at line 29 of file QmitkSetupVirtualEnvUtil.h.
| QmitkSetupVirtualEnvUtil::QmitkSetupVirtualEnvUtil | ( | const QString & | baseDir | ) | 
| QmitkSetupVirtualEnvUtil::QmitkSetupVirtualEnvUtil | ( | ) | 
      
  | 
  static | 
Searches and parses paths of python virtual environments from predefined lookout locations.
| void QmitkSetupVirtualEnvUtil::ExecutePython | ( | const std::string & | args, | 
| CallbackType | callback, | ||
| const std::string & | command = "python"  | 
        ||
| ) | 
Overloaded function to Execute Python code. Any callback function can be passed to process the output.
| args | |
| callback | |
| command | 
| void QmitkSetupVirtualEnvUtil::ExecutePython | ( | const std::string & | args, | 
| const std::string & | pythonPath, | ||
| CallbackType | callback, | ||
| const std::string & | command = "python"  | 
        ||
| ) | 
Function to execute any python code given a python path. Any callback function can be passed to process the output.
| args | |
| pythonPath | |
| callback | |
| command | 
| QString& QmitkSetupVirtualEnvUtil::GetBaseDir | ( | ) | 
Get the Base Dir object.
      
  | 
  static | 
Get the exact Python path and version for any OS from the virtual environment path.
      
  | 
  static | 
Returns version of the pip installed package.
| QString& QmitkSetupVirtualEnvUtil::GetPipPath | ( | ) | 
Get the Pip Path object.
| QString& QmitkSetupVirtualEnvUtil::GetPythonPath | ( | ) | 
Get the Python Path object.
| QString& QmitkSetupVirtualEnvUtil::GetSystemPythonPath | ( | ) | 
Get the System Python Path object.
      
  | 
  virtual | 
Get the Virtual Env Path object. Override this method in the respective tool installer class.
Reimplemented in QmitkSAMToolInstaller, and QmitkTotalSegmentatorToolInstaller.
| void QmitkSetupVirtualEnvUtil::InstallPytorch | ( | CallbackType | callback, | 
| const QString & | torchVersion = ""  | 
        ||
| ) | 
Overloaded function to install pytorch using light-the-torch package, correctly identifying cuda version.
| void QmitkSetupVirtualEnvUtil::InstallPytorch | ( | const QString & | torchVersion = "" | ) | 
Overloaded function to install pytorch using light-the-torch package, correctly identifying cuda version.
| void QmitkSetupVirtualEnvUtil::InstallPytorch | ( | const QString & | workingDir, | 
| CallbackType | callback, | ||
| const QString & | torchVersion = ""  | 
        ||
| ) | 
Installs pytorch using light-the-torch package, correctly identifying cuda version. Requires location of pip3 executable. Any callback function can be passed to process the output.
| workingDir | |
| callback | |
| torchVersion | 
| bool QmitkSetupVirtualEnvUtil::IsPythonPath | ( | const QString & | pythonPath | ) | 
Check if the path provide has python executable or not.
| pythonPath | 
      
  | 
  static | 
Checks if venv module is available for the python.
| void QmitkSetupVirtualEnvUtil::PipInstall | ( | const std::string & | library, | 
| CallbackType | callback, | ||
| const std::string & | command = "pip3"  | 
        ||
| ) | 
Overloaded function to Pip install a library function.
| library | |
| callback | |
| command | 
| void QmitkSetupVirtualEnvUtil::PipInstall | ( | const std::string & | library, | 
| const std::string & | workingDir, | ||
| CallbackType | callback, | ||
| const std::string & | command = "pip3"  | 
        ||
| ) | 
Function to Pip install a library package given the location of pip3 executable. Any callback function can be passed to process the output.
| library | |
| workingDir | |
| callback | |
| command | 
      
  | 
  static | 
Function can be used as callback to simply print out all the process execution output parsed out from itk::EventObject.
| void QmitkSetupVirtualEnvUtil::SetPipPath | ( | const QString & | path | ) | 
Set the Pip Path object.
| path | 
| void QmitkSetupVirtualEnvUtil::SetPythonPath | ( | const QString & | path | ) | 
Set the Python Path object.
| path | 
| void QmitkSetupVirtualEnvUtil::SetSystemPythonPath | ( | const QString & | path | ) | 
Set the System Python Path object.
| path | 
| bool QmitkSetupVirtualEnvUtil::SetupVirtualEnv | ( | const QString & | venvName, | 
| const QStringList & | packages, | ||
| std::function< bool()> | validator, | ||
| CallbackType | printCallback, | ||
| const QString & | torchVersion = ""  | 
        ||
| ) | 
Sets up a python virtual environment in the DKFZ directory with given.
| venvName | : Name of the virtual env folder | 
| packages | : List of packages to be installed except Pytorch | 
| validator | : Functor to run and validate the virtual env setup | 
| printCallback | : ITK functor to custom print the virtual en setup log. | 
| torchVersion | Exact version of pytorch version (optional) | 
| void QmitkSetupVirtualEnvUtil::SetVirtualEnvPath | ( | const QString & | path | ) | 
Set the Virtual Env Path object.
| path |