Medical Imaging Interaction Toolkit  2026.06.00
Medical Imaging Interaction Toolkit
QmitkVenvProcess.h
Go to the documentation of this file.
1 /*============================================================================
2 
3 The Medical Imaging Interaction Toolkit (MITK)
4 
5 Copyright (c) German Cancer Research Center (DKFZ)
6 All rights reserved.
7 
8 Use of this source code is governed by a 3-clause BSD license that can be
9 found in the LICENSE file.
10 
11 ============================================================================*/
12 
13 #ifndef QmitkVenvProcess_h
14 #define QmitkVenvProcess_h
15 
17 
18 #include <mitkFileSystem.h>
19 
20 #include <QProcessEnvironment>
21 #include <QString>
22 #include <QStringList>
23 
35 {
38 
46  MITKPYTHONSEGMENTATIONUI_EXPORT QString ToQString(const fs::path& path);
47 
48  struct Result
49  {
50  bool success = false;
51  QString standardOutput;
52  QString standardError;
53 
55  QString combined() const { return (standardOutput + standardError).trimmed(); }
56  };
57 
70  MITKPYTHONSEGMENTATIONUI_EXPORT Result Run(const QString& executable, const QStringList& args, int finishedTimeoutMs = -1);
71 }
72 
73 #endif
#define MITKPYTHONSEGMENTATIONUI_EXPORT
Portability header that provides a unified namespace alias for the C++ filesystem library.
Helpers for running an executable from a MITK-managed Python virtual environment as a subprocess.
MITKPYTHONSEGMENTATIONUI_EXPORT QString ToQString(const fs::path &path)
Lossless conversion of a filesystem path to a QString.
MITKPYTHONSEGMENTATIONUI_EXPORT Result Run(const QString &executable, const QStringList &args, int finishedTimeoutMs=-1)
Runs executable with args in a clean environment and blocks until it finishes.
MITKPYTHONSEGMENTATIONUI_EXPORT QProcessEnvironment CleanEnvironment()
The current process environment with PYTHONHOME and PYTHONPATH removed.
QString combined() const
Trimmed standard output and standard error concatenated.