Medical Imaging Interaction Toolkit  2026.06.00
Medical Imaging Interaction Toolkit
QmitkDataGenerationJobBase.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 
14 #ifndef QmitkDataGenerationJobBase_h
15 #define QmitkDataGenerationJobBase_h
16 
17 
18 //QT
19 #include <QRunnable>
20 #include <QObject>
21 #include <QMetaType>
22 
23 //MITK
24 #include <mitkBaseData.h>
25 
27 
39 class MITKIMAGESTATISTICSUI_EXPORT QmitkDataGenerationJobBase : public QObject, public QRunnable
40 {
41  Q_OBJECT
42 
43 public:
50  using ResultMapType = std::map<std::string, mitk::BaseData::Pointer>;
51 
56  virtual ResultMapType GetResults() const = 0;
57 
65  void run() final;
66 
71  bool GetComputationSuccessFlag() const;
72 
77  std::string GetLastErrorMessage() const;
78 
83  bool IsRunning() const;
84 
85 signals:
91  void Error(QString err, const QmitkDataGenerationJobBase* job);
97  void ResultsAvailable(ResultMapType results, const QmitkDataGenerationJobBase* job);
98 
99 protected:
101 
102  virtual ~QmitkDataGenerationJobBase() = default;
103 
105  virtual bool RunComputation() = 0;
106 
107  std::string m_LastErrorMessage;
108 
109 private:
110  bool m_ComputationSuccessful = false;
111  bool m_IsRunning = false;
112 };
113 
114 #endif
#define MITKIMAGESTATISTICSUI_EXPORT
Base class for background data generation jobs used by QmitkDataGeneratorBase and derived classes.
virtual ResultMapType GetResults() const =0
Returns all results generated by this job.
void run() final
Executes the job computation with error handling and result signalling.
std::map< std::string, mitk::BaseData::Pointer > ResultMapType
Map type for results produced by the job.