| 162 | } |
| 163 | |
| 164 | void QmitkRegistrationJob::run() |
| 165 | { |
| 166 | try |
| 167 | { |
| 168 | mitk::MAPAlgorithmHelper helper(m_spLoadedAlgorithm); |
| 169 | mitk::MaskedAlgorithmHelper maskedHelper(m_spLoadedAlgorithm); |
| 170 | |
| 171 | //*@TODO Data Check and failure handle |
| 172 | helper.SetData(this->m_spMovingData, this->m_spTargetData); |
| 173 | maskedHelper.SetMasks(this->m_spMovingMask, this->m_spTargetMask); |
| 174 | |
| 175 | // perform registration |
| 176 | m_spResultRegistration = helper.GetRegistration(); |
| 177 | |
| 178 | // wrap the registration in a data node |
| 179 | if (m_spResultRegistration.IsNull()) |
| 180 | { |
| 181 | emit Error(QString("Error. No registration was determined. No results to store.")); |
| 182 | } |
| 183 | else |
| 184 | { |
| 185 | auto spRegWrapper = mitk::MAPRegistrationWrapper::New(m_spResultRegistration); |
| 186 | |
| 187 | emit RegResultIsAvailable(spRegWrapper, this); |
| 188 | } |
| 189 | } |
| 190 | catch (::std::exception &e) |
| 191 | { |
| 192 | emit Error(QString("Error while registering data. Details: ") + QString::fromLatin1(e.what())); |
| 193 | } |
| 194 | catch (...) |
| 195 | { |
| 196 | emit Error(QString("Unknown error when registering data.")); |
| 197 | } |
| 198 | |
| 199 | emit Finished(); |
| 200 | } |