Medical Imaging Interaction Toolkit  2026.06.00
Medical Imaging Interaction Toolkit
QmitkDataGenerationJobBase Class Referenceabstract

Base class for background data generation jobs used by QmitkDataGeneratorBase and derived classes. More...

#include <QmitkDataGenerationJobBase.h>

Inheritance diagram for QmitkDataGenerationJobBase:
Collaboration diagram for QmitkDataGenerationJobBase:

Public Types

using ResultMapType = std::map< std::string, mitk::BaseData::Pointer >
 Map type for results produced by the job. More...
 

Signals

void Error (QString err, const QmitkDataGenerationJobBase *job)
 Emitted when an error occurs during computation. More...
 
void ResultsAvailable (ResultMapType results, const QmitkDataGenerationJobBase *job)
 Emitted when computation results are available. More...
 

Public Member Functions

virtual ResultMapType GetResults () const =0
 Returns all results generated by this job. More...
 
void run () final
 Executes the job computation with error handling and result signalling. More...
 
bool GetComputationSuccessFlag () const
 Returns whether the last computation completed successfully. More...
 
std::string GetLastErrorMessage () const
 Returns the error message from the last failed computation. More...
 
bool IsRunning () const
 Returns whether the job is currently executing. More...
 

Protected Member Functions

 QmitkDataGenerationJobBase ()=default
 
virtual ~QmitkDataGenerationJobBase ()=default
 
virtual bool RunComputation ()=0
 

Protected Attributes

std::string m_LastErrorMessage
 

Detailed Description

Base class for background data generation jobs used by QmitkDataGeneratorBase and derived classes.

This class combines QObject (for signal/slot communication) and QRunnable (for thread pool execution) to provide a foundation for asynchronous data generation tasks. Derived classes implement RunComputation() to perform the actual work. The run() method handles error management, sets status flags, and emits appropriate signals when results are available or errors occur.

See also
QmitkDataGeneratorBase
QmitkImageStatisticsCalculationRunnable

Definition at line 39 of file QmitkDataGenerationJobBase.h.

Member Typedef Documentation

◆ ResultMapType

using QmitkDataGenerationJobBase::ResultMapType = std::map<std::string, mitk::BaseData::Pointer>

Map type for results produced by the job.

The key is a job-specific label identifying each result (e.g. "statistics"), and the value is the corresponding mitk::BaseData output.

Definition at line 50 of file QmitkDataGenerationJobBase.h.

Constructor & Destructor Documentation

◆ QmitkDataGenerationJobBase()

QmitkDataGenerationJobBase::QmitkDataGenerationJobBase ( )
protecteddefault

◆ ~QmitkDataGenerationJobBase()

virtual QmitkDataGenerationJobBase::~QmitkDataGenerationJobBase ( )
protectedvirtualdefault

Member Function Documentation

◆ Error

void QmitkDataGenerationJobBase::Error ( QString  err,
const QmitkDataGenerationJobBase *  job 
)
signal

Emitted when an error occurs during computation.

Parameters
[in]errA human-readable error description.
[in]jobPointer to the job that encountered the error.

◆ GetComputationSuccessFlag()

bool QmitkDataGenerationJobBase::GetComputationSuccessFlag ( ) const

Returns whether the last computation completed successfully.

Returns
True if RunComputation() returned true; false otherwise.

◆ GetLastErrorMessage()

std::string QmitkDataGenerationJobBase::GetLastErrorMessage ( ) const

Returns the error message from the last failed computation.

Returns
A string describing the last error, or an empty string if no error occurred.

◆ GetResults()

virtual ResultMapType QmitkDataGenerationJobBase::GetResults ( ) const
pure virtual

Returns all results generated by this job.

Returns
A map of label-to-result pairs produced by the computation.

Implemented in QmitkImageStatisticsCalculationRunnable.

◆ IsRunning()

bool QmitkDataGenerationJobBase::IsRunning ( ) const

Returns whether the job is currently executing.

Returns
True if run() is currently in progress; false otherwise.

◆ ResultsAvailable

void QmitkDataGenerationJobBase::ResultsAvailable ( ResultMapType  results,
const QmitkDataGenerationJobBase *  job 
)
signal

Emitted when computation results are available.

Parameters
[in]resultsThe map of labeled results produced by the job.
[in]jobPointer to the job that produced the results.

◆ run()

void QmitkDataGenerationJobBase::run ( )
final

Executes the job computation with error handling and result signalling.

Calls RunComputation() internally. On success, emits ResultsAvailable with the computed results. On failure or exception, emits Error with a descriptive message. This method is marked final and should not be overridden; override RunComputation() instead.

◆ RunComputation()

virtual bool QmitkDataGenerationJobBase::RunComputation ( )
protectedpure virtual

Does the real computation. Returns true if there where results produced.

Implemented in QmitkImageStatisticsCalculationRunnable.

Member Data Documentation

◆ m_LastErrorMessage

std::string QmitkDataGenerationJobBase::m_LastErrorMessage
protected

Definition at line 107 of file QmitkDataGenerationJobBase.h.


The documentation for this class was generated from the following file: