29 #include <QThreadPool>
32 #include <mapAlgorithmEvents.h>
33 #include <mapAlgorithmWrapperEvent.h>
34 #include <mapExceptionObjectMacros.h>
35 #include <mapImageRegistrationAlgorithmInterface.h>
36 #include <mapRegistrationAlgorithmInterface.h>
55 const map::events::AlgorithmEvent *pAlgEvent =
dynamic_cast<const map::events::AlgorithmEvent *
>(&event);
56 const map::events::AlgorithmIterationEvent *pIterationEvent =
57 dynamic_cast<const map::events::AlgorithmIterationEvent *
>(&event);
58 const map::events::AlgorithmWrapperEvent *pWrapEvent =
59 dynamic_cast<const map::events::AlgorithmWrapperEvent *
>(&event);
60 const map::events::AlgorithmResolutionLevelEvent *pLevelEvent =
61 dynamic_cast<const map::events::AlgorithmResolutionLevelEvent *
>(&event);
63 const map::events::InitializingAlgorithmEvent *pInitEvent =
64 dynamic_cast<const map::events::InitializingAlgorithmEvent *
>(&event);
65 const map::events::StartingAlgorithmEvent *pStartEvent =
66 dynamic_cast<const map::events::StartingAlgorithmEvent *
>(&event);
67 const map::events::StoppingAlgorithmEvent *pStoppingEvent =
68 dynamic_cast<const map::events::StoppingAlgorithmEvent *
>(&event);
69 const map::events::StoppedAlgorithmEvent *pStoppedEvent =
70 dynamic_cast<const map::events::StoppedAlgorithmEvent *
>(&event);
71 const map::events::FinalizingAlgorithmEvent *pFinalizingEvent =
72 dynamic_cast<const map::events::FinalizingAlgorithmEvent *
>(&event);
73 const map::events::FinalizedAlgorithmEvent *pFinalizedEvent =
74 dynamic_cast<const map::events::FinalizedAlgorithmEvent *
>(&event);
84 else if (pStoppingEvent)
88 else if (pStoppedEvent)
92 if (!pStoppedEvent->getComment().empty())
94 emit
AlgorithmInfo(QString(
"Stopping condition: ") + QString::fromStdString(pStoppedEvent->getComment()));
97 else if (pFinalizingEvent)
101 else if (pFinalizedEvent)
105 else if (pIterationEvent)
110 map::algorithm::facet::IterativeAlgorithmInterface::IterationCountType count = 0;
111 bool hasCount =
false;
113 if (pIterative && pIterative->hasIterationCount())
116 count = pIterative->getCurrentIteration();
119 emit
AlgorithmIterated(QString::fromStdString(pIterationEvent->getComment()), hasCount, count);
121 else if (pLevelEvent)
126 map::algorithm::facet::MultiResRegistrationAlgorithmInterface::ResolutionLevelCountType count = 0;
127 bool hasCount =
false;
128 QString
info = QString::fromStdString(pLevelEvent->getComment());
130 if (pResAlg && pResAlg->hasLevelCount())
132 count = pResAlg->getCurrentLevel() + 1;
134 info = QString(
"Level #") + QString::number(pResAlg->getCurrentLevel() + 1) + QString(
" ") +
info;
139 else if (pAlgEvent && !pWrapEvent)
141 emit
AlgorithmInfo(QString::fromStdString(pAlgEvent->getComment()));
185 emit
Error(QString(
"Error. No registration was determined. No results to store."));
195 catch (::std::exception &e)
197 emit
Error(QString(
"Error while registering data. Details: ") + QString::fromLatin1(e.what()));
201 emit
Error(QString(
"Unkown error when registering data."));
mitk::Image::ConstPointer m_spMovingMask
map::core::RegistrationBase::Pointer GetRegistration() const
const mitk::Image * GetMovingDataAsImage() const
void LevelChanged(QString info, bool hasLevelCount, unsigned long currentLevel)
::itk::MemberCommand< QmitkRegistrationJob >::Pointer m_spCommand
mitk::BaseData::ConstPointer m_spMovingData
QmitkRegistrationJob(map::algorithm::RegistrationAlgorithmBase *pAlgorithm)
map::core::RegistrationBase::Pointer m_spResultRegistration
const map::algorithm::RegistrationAlgorithmBase * GetLoadedAlgorithm() const
void AlgorithmInfo(QString info)
mitk::NodeUIDType m_MovingDataUID
static void info(const char *fmt,...)
void SetData(const mitk::BaseData *moving, const mitk::BaseData *target)
const mitk::Image * GetTargetDataAsImage() const
mitk::BaseData::ConstPointer m_spTargetData
Image class for storing images.
unsigned long m_ObserverID
mitk::Image::ConstPointer m_spTargetMask
mitk::NodeUIDType m_TargetDataUID
map::algorithm::facet::IterativeAlgorithmInterface IIterativeAlgorithm
bool SetMasks(const mitk::Image *movingMask, const mitk::Image *targetMask)
MaskedAlgorithmHelper Helper class as an easy bridge to set mitk images as masks for registration alg...
map::algorithm::RegistrationAlgorithmBase::Pointer m_spLoadedAlgorithm
map::algorithm::facet::MultiResRegistrationAlgorithmInterface IMultiResAlgorithm
void RegResultIsAvailable(mitk::MAPRegistrationWrapper::Pointer spResultRegistration, const QmitkRegistrationJob *pJob)
void AlgorithmIterated(QString info, bool hasIterationCount, unsigned long currentIteration)
void OnMapAlgorithmEvent(::itk::Object *, const itk::EventObject &event)
void AlgorithmStatusChanged(QString info)
static itkEventMacro(BoundingShapeInteractionEvent, itk::AnyEvent) class MITKBOUNDINGSHAPE_EXPORT BoundingShapeInteractor Pointer New()
Basic interaction methods for mitk::GeometryData.