]> Creatis software - clitk.git/commitdiff
Avoid crash with non-orthogonal matrices
authortbaudier <thomas.baudier@creatis.insa-lyon.fr>
Fri, 26 Feb 2016 12:51:49 +0000 (13:51 +0100)
committertbaudier <thomas.baudier@creatis.insa-lyon.fr>
Fri, 26 Feb 2016 12:51:49 +0000 (13:51 +0100)
vv/vvToolRigidReg.cxx

index e050426ea99c52ec95cffbb59e4b12c14ec50be1..d2c889cb31fd8b9b3e8670d911d569f9727a3793 100644 (file)
@@ -378,7 +378,17 @@ void vvToolRigidReg::SetTransform(vtkMatrix4x4 *matrix)
   itk::Euler3DTransform<double>::Pointer euler;
   euler = itk::Euler3DTransform<double>::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