Page MenuHomePhabricator

Unreachable catch block in OTSU?
Open, NormalPublic

Description

The catch block (see below) in QmitkOtsuTool3DGUI::OnPreviewBtnClicked is not reached when an exception (eg. mitkThrow()) happens OtsuTool3D::DoUpdatePreview method.

...
      tool->UpdatePreview();
    }
    catch (...)
    {
      MITK_INFO << "In QmitkOtsuTool3DGUI catch";
      this->setCursor(Qt::ArrowCursor);
      QMessageBox *messageBox =
        new QMessageBox(QMessageBox::Critical,
                        nullptr,
                        "itkOtsuFilter error: image dimension must be in {2, 3} and no RGB images can be handled.");
      messageBox->exec();
      delete messageBox;
      return;
    }

Is this expected behavior or happened in course of time while modifying the base tool api classes (eg. SegWithPreviewTool)?
If so, this "bug" could exist in GrowCut, nnUnet & upcoming MonaiLabel, as well.

Event Timeline

floca triaged this task as Normal priority.Mar 22 2023, 9:21 AM

A pop up appears with whatever error message was thrown from OtsuTool3D::DoUpdatePreview.

Not necessary for the upcoming release but we should look into it nevertheless and take care of it.