From: tbaudier Date: Fri, 26 Feb 2016 12:51:49 +0000 (+0100) Subject: Avoid crash with non-orthogonal matrices X-Git-Tag: v1.4.0~41 X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=4a5d4517e48bf9a17c464d8384bd1cdd0397738c;p=clitk.git Avoid crash with non-orthogonal matrices --- diff --git a/vv/vvToolRigidReg.cxx b/vv/vvToolRigidReg.cxx index e050426..d2c889c 100644 --- a/vv/vvToolRigidReg.cxx +++ b/vv/vvToolRigidReg.cxx @@ -378,7 +378,17 @@ void vvToolRigidReg::SetTransform(vtkMatrix4x4 *matrix) itk::Euler3DTransform::Pointer euler; euler = itk::Euler3DTransform::New(); euler->SetCenter(center); - euler->SetMatrix(rotMat); + try { + euler->SetMatrix(rotMat); + } catch (itk::ExceptionObject) { + QString warning = "The matrice is a non-orthogonal rotation matrix.\nThe manual registration doesn't work."; + QMessageBox msgBox(QMessageBox::Warning, tr("Reset transform"),warning, 0, this); + msgBox.addButton(tr("OK"), QMessageBox::AcceptRole); + if (msgBox.exec() == QMessageBox::AcceptRole) { + //SetTransform(mInitialMatrix); + vvToolWidgetBase::close(); + } + } euler->SetOffset(transVec); // Modify GUI according to the new parameters