Medical Imaging Interaction Toolkit  2026.06.00
Medical Imaging Interaction Toolkit
QmitkRegistrationJob.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 QmitkRegistrationJob_h
14 #define QmitkRegistrationJob_h
15 
16 // QT
17 #include <QObject>
18 #include <QRunnable>
19 
20 // ITK
21 #include <itkCommand.h>
22 
23 // MITK
24 #include <mitkUIDHelper.h>
25 #include <mitkDataNode.h>
26 #include <mitkImage.h>
28 
29 // MatchPoint
30 #include <mapDeploymentDLLInfo.h>
31 #include <mapIterativeAlgorithmInterface.h>
32 #include <mapMultiResRegistrationAlgorithmInterface.h>
33 #include <mapRegistrationAlgorithmBase.h>
34 #include <mapRegistrationBase.h>
35 
37 
53 class MITKMATCHPOINTREGISTRATIONUI_EXPORT QmitkRegistrationJob : public QObject, public QRunnable
54 {
55  // this is needed for all Qt objects that should have a Qt meta-object
56  // (everything that derives from QObject and wants to have signal/slots)
57  Q_OBJECT
58 
59 public:
70  QmitkRegistrationJob(::map::algorithm::RegistrationAlgorithmBase *pAlgorithm);
71 
76 
85  void run() override;
86 
87 signals:
89  void Finished();
90 
95  void Error(QString err);
96 
102  void RegResultIsAvailable(mitk::MAPRegistrationWrapper::Pointer spResultRegistration,
103  const QmitkRegistrationJob *pJob);
104 
111  void AlgorithmIterated(QString info, bool hasIterationCount, unsigned long currentIteration);
112 
119  void LevelChanged(QString info, bool hasLevelCount, unsigned long currentLevel);
120 
125  void AlgorithmStatusChanged(QString info);
126 
131  void AlgorithmInfo(QString info);
132 
133 public:
135  mitk::BaseData::ConstPointer m_spTargetData;
136 
138  mitk::BaseData::ConstPointer m_spMovingData;
139 
141  mitk::Image::ConstPointer m_spTargetMask;
142 
144  mitk::Image::ConstPointer m_spMovingMask;
145 
148 
151 
154 
156  std::string m_JobName;
157 
160 
163 
166 
169 
174  const ::map::algorithm::RegistrationAlgorithmBase *GetLoadedAlgorithm() const;
175 
176 protected:
177  typedef ::map::algorithm::facet::IterativeAlgorithmInterface IIterativeAlgorithm;
178  typedef ::map::algorithm::facet::MultiResRegistrationAlgorithmInterface IMultiResAlgorithm;
179 
180  // Result registration.
181  ::map::core::RegistrationBase::Pointer m_spResultRegistration;
182  mitk::DataNode::Pointer m_spRegNode;
183  // mapped image. May be null if m_MapEntity is false.
184  mitk::DataNode::Pointer m_spMappedImageNode;
185 
186  ::itk::MemberCommand<QmitkRegistrationJob>::Pointer m_spCommand;
187  unsigned long m_ObserverID;
188  ::map::algorithm::RegistrationAlgorithmBase::Pointer m_spLoadedAlgorithm;
189 
190  // Helper functions
193 
194  void OnMapAlgorithmEvent(::itk::Object *, const itk::EventObject &event);
195 };
196 
197 #endif
#define MITKMATCHPOINTREGISTRATIONUI_EXPORT
QRunnable job that performs image registration using a MatchPoint algorithm in a background thread.
~QmitkRegistrationJob() override
Destructor. Removes the algorithm event observer.
mitk::NodeUIDType m_TargetDataUID
UID of the target data node for provenance tracking.
::map::algorithm::RegistrationAlgorithmBase::Pointer m_spLoadedAlgorithm
::map::core::RegistrationBase::Pointer m_spResultRegistration
void LevelChanged(QString info, bool hasLevelCount, unsigned long currentLevel)
Emitted when the algorithm changes its multi-resolution level.
void run() override
Executes the registration algorithm.
void Error(QString err)
Emitted when an error occurs during registration.
mitk::DataNode::Pointer m_spRegNode
void Finished()
Emitted when the job has completed (regardless of success or failure).
bool m_MapEntity
If true, the job also maps the moving entity using the computed registration.
mitk::BaseData::ConstPointer m_spTargetData
The target (fixed) data for the registration.
mitk::Image::ConstPointer m_spTargetMask
Optional mask image for the target data.
mitk::NodeUIDType m_MovingDataUID
UID of the moving data node for provenance tracking.
std::string m_JobName
Human-readable name for the registration job.
void AlgorithmInfo(QString info)
Emitted for general algorithm information messages.
mitk::NodeUIDType m_MovingMaskDataUID
UID of the moving mask data node for provenance tracking.
void AlgorithmStatusChanged(QString info)
Emitted when the algorithm status changes (e.g., initializing, starting, stopping).
::itk::MemberCommand< QmitkRegistrationJob >::Pointer m_spCommand
::map::algorithm::facet::IterativeAlgorithmInterface IIterativeAlgorithm
::map::algorithm::facet::MultiResRegistrationAlgorithmInterface IMultiResAlgorithm
void RegResultIsAvailable(mitk::MAPRegistrationWrapper::Pointer spResultRegistration, const QmitkRegistrationJob *pJob)
Emitted when the registration result is available.
void AlgorithmIterated(QString info, bool hasIterationCount, unsigned long currentIteration)
Emitted when the algorithm completes an iteration.
mitk::BaseData::ConstPointer m_spMovingData
The moving data for the registration.
const mitk::Image * GetMovingDataAsImage() const
void OnMapAlgorithmEvent(::itk::Object *, const itk::EventObject &event)
mitk::NodeUIDType m_TargetMaskDataUID
UID of the target mask data node for provenance tracking.
bool m_StoreReg
If true, the registration result is stored.
mitk::Image::ConstPointer m_spMovingMask
Optional mask image for the moving data.
bool m_ErrorOccured
Flag indicating whether an error occurred during execution.
mitk::DataNode::Pointer m_spMappedImageNode
const mitk::Image * GetTargetDataAsImage() const
const ::map::algorithm::RegistrationAlgorithmBase * GetLoadedAlgorithm() const
Returns the registration algorithm used by this job.
QmitkRegistrationJob(::map::algorithm::RegistrationAlgorithmBase *pAlgorithm)
Constructs the registration job with the given algorithm.
Image class for storing multi-dimensional medical image data.
Definition: mitkImage.h:76
std::string NodeUIDType
Type alias for node/data UID strings.
Definition: mitkUIDHelper.h:34