Computer Assisted Medical Intervention Tool Kit  version 5.2
ElastixRunner.h
Go to the documentation of this file.
1 /*****************************************************************************
2  * $CAMITK_LICENCE_BEGIN$
3  *
4  * CamiTK - Computer Assisted Medical Intervention ToolKit
5  * (c) 2001-2024 Univ. Grenoble Alpes, CNRS, Grenoble INP - UGA, TIMC, 38000 Grenoble, France
6  *
7  * Visit http://camitk.imag.fr for more information
8  *
9  * This file is part of CamiTK.
10  *
11  * CamiTK is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * CamiTK is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  * GNU Lesser General Public License version 3 for more details.
19  *
20  * You should have received a copy of the GNU Lesser General Public License
21  * version 3 along with CamiTK. If not, see <http://www.gnu.org/licenses/>.
22  *
23  * $CAMITK_LICENCE_END$
24  ****************************************************************************/
25 #ifndef ELASTIXRUNNER_H
26 #define ELASTIXRUNNER_H
27 
28 #include <QObject>
29 #include <QProcess>
30 
31 #include "ElastixRegistrationAPI.h"
32 
40 class ELASTIX_REGISTRATION_API ElastixRunner : public QObject {
41  Q_OBJECT
42 
43 public:
45  ElastixRunner(QString elastixPath, QStringList arguments, QString workingDirectory = "", QObject* parent = nullptr);
46 
47  // retrieve the exit status information
48  int getExitCode() const;
49 
50  // retrieve the standard output
51  QString getStdOutput() const;
52 
53  // retrieve the last process error as a message
54  QString getProcessError() const;
55 
56 public slots:
57  void startProcess();
58 
59 signals:
60  // Signal to notify when output is available
61  void outputReady(const QString& output);
62 
63  // Signal to notify when the process has finished
64  void finished(int exitCode, const QString& output);
65 
66 private slots:
67  // Slot to process the standard output of the process
68  void processOutput();
69 
70 private:
71  QString program;
72  QStringList arguments;
73  QString workingDirectory;
74  int timeOut;
75  QString output;
76  int exitCode;
77  QProcess::ProcessError processError;
78 };
79 
80 #endif // ELASTIXRUNNER_H
#define ELASTIX_REGISTRATION_API
Definition: ElastixRegistrationAPI.h:8
Worker that calls the elastix executable in a subprocess.
Definition: ElastixRunner.h:40
void outputReady(const QString &output)
void finished(int exitCode, const QString &output)