Page MenuHomePhabricator

[Segmentation] Should warning messages be passed on to the UI?
Closed, ResolvedPublic

Description

Several MITK_WARNING messages inside the algorithms are silently printed to the MITK log.
We should discuss if and which of them should be explicitly presented to the workbench user (e.g. a warning pop-up dialog or the like).

Similar with MITK_ERROR messages, which could be presented as warning labels inside the UI.

Event Timeline

kalali triaged this task as Normal priority.Jan 19 2021, 3:57 PM
kalali created this task.

I will start looking into this to give some examples of important warnings / errors that the user should know about.

I went through the relevant plugins and modules and looked at the warnings and errors. I will post some of the ones that I deem to be important for a workbench user, others I left out.

Inside org.mitk.gui.qt.segmentation:

  • QmitkContourModelToImageWidget
    • MITK_ERROR<<"Error filling contours into an image!";
    • MITK_ERROR<<"Error writing contours into image! Invalid image data selected!";
    • MITK_ERROR << "Error writing contours into image! Currently selected time point is not supported by selected image data.";
    • MITK_ERROR<<"Error writing contours into binary image! Invalid contour data selected!";
    • and some more if the contour filter throws an exception
  • QmitkAutocropAction
    • MITK_INFO << " a nullptr node selected";
    • MITK_ERROR << "Cropping image failed...";, if the crop filter throws an exception
  • QmitkAutocropLabelSetImageAction
    • MITK_WARN << "Autocrop was skipped: Image \"" << dataNode->GetName() << "\" is empty.";
    • MITK_ERROR << "Autocrop was aborted: Image read access to \"" << dataNode->GetName() << "\" was denied.";
  • QmitkMorphologicalOperationsWidget
    • several MITK_WARN << "Exception caught: " << exception.GetDescription();
  • QmitkSurfaceToImageWidget
    • MITK_ERROR << excpt.GetDescription();, if the surfacetoimage filter throws an exception
    • MITK_ERROR << e.GetDescription(); if the mask filter / surfacetoimage filter throws an exception
  • QmitkOtsuAction
    • MITK_ERROR(this->GetClassName()) << err.what();, if the filter throws an exception
  • QmitkCreatePolygonModelAction
    • MITK_ERROR << "Surface creation failed!";, if the surface filter throws an exception

We probably don't need to show the exceptions to the user but some of the classic warning. In other classes typically a twofold approach is used, e.g.

void QmitkBooleanOperationsWidget::DoBooleanOperation(mitk::BooleanOperation::Type type)
{
  [...]

  try
  {
    [...]
  }
  catch (const mitk::Exception& exception)
  {
    MITK_ERROR << "Boolean operation failed: " << exception.GetDescription();
    QMessageBox::information(nullptr, "Boolean operation failed", exception.GetDescription());
  }
}

Inside org.mitk.gui.qt.multilabelsegmentation

  • QmitkMorphologicalOperationsWidget
    • MITK_WARN << "Exception caught: " << exception.GetDescription();, if the closing operation throws an exception
    • MITK_WARN << "Exception caught: " << exception.GetDescription();, if the opening operation throws an exception
    • MITK_WARN << "Exception caught: " << exception.GetDescription();, if the dilate operation throws an exception
    • MITK_WARN << "Exception caught: " << exception.GetDescription();, if the erode operation throws an exception
    • MITK_WARN << "Exception caught: " << exception.GetDescription();, if the fill-holes operation throws an exception
  • QmitkCreateMultiLabelSegmentationAction
    • MITK_WARN << "Could not create multi label segmentation for non-image node - skipping action.";
  • QmitkConvertToMultiLabelSegmentationAction
    • MITK_WARN << "Could not convert to multi label segmentation for non-image node - skipping action.";
    • MITK_ERROR << "Exception caught: " << e.GetDescription();, if the initialization of a labelset image throws an exception
  • QmitkMultilabelSegmentationView
    • MITK_INFO << iter->GetResourcePath(); // currently not used / called, but could be changed into something like MITK_DEBUG
    • MITK_WARN << "Error loading state machine";
    • MITK_WARN << "Error loading state machine configuration";
    • caught exceptions are already handled with a QMessageBox

Inside Segmentation module:

  • itk::ConnectedAdaptiveThresholdImageFilter
    • MITK_ERROR << "Cropping working region failed!";
    • MITK_ERROR << "Fine-detection-segmentation mode not set!";
    • MITK_ERROR << "Iterator-mask-image not set!";
  • AutoMLSegmentationWithPreviewTool
    • MITK_WARN << "Cannot run segementation. Currently selected input image is not set.";
  • AutoSegmentationTool
    • MITK_ERROR << "No valid reference data!";
  • AutoSegmentationWithPreviewTool
    • MITK_ERROR << "Cannot create preview helper objects. Unable to clone working image";
    • MITK_ERROR << "Exception caught: " << excep.GetDescription();, during preview update
  • ContourModelLiveWireInteractor
    • MITK_ERROR << "Invalid Contour"; // btw., there is also an MITK_ERROR << "Invalid Contour!"; and an MITK_ERROR << "invalid contour";
  • ContourModelSetToImageFilter
    • MITK_ERROR << "Cannot detect correct slice number! Only axial, sagittal and frontal oriented contours are supported!";
  • FeatureBasedEdgeDetectionFilter
    • MITK_WARN << "Please set a segmentation mask first" << std::endl;
  • FeedbackContourTool
    • MITK_WARN << "Cannot clear feedback contour at current time step. Feedback contour is in invalid state as its time geometry does not support current selected time point. Invalid time point: " << this->GetLastTimePointTriggered();
    • MITK_WARN << "Cannot update feedback contour. Feedback contour is in invalid state as its time geometry does not support current selected time point. Invalid time point: "<<this->GetLastTimePointTriggered();
    • MITK_WARN << "Cannot update feedback contour. Source contour time geometry does not support passed time step. Invalid time step: " << sourceTimeStep;
    • MITK_WARN << "Cannot update feedback contour. Feedback contour time geometry does not support passed time step. Invalid time step: "<<feedbackTimeStep;
    • MITK_WARN << "Cannot add vertex to feedback contour. Feedback contour is in invalid state as its time geometry does not support current selected time point. Invalid time point: " << this->GetLastTimePointTriggered();
    • MITK_WARN << "Cannot add vertex to feedback contour. Feedback contour time geometry does not support passed time step. Invalid time step: " << feedbackTimeStep;
    • MITK_ERROR << "Unable to extract slice." << std::endl;
  • ImageLiveWireContourModelFilter
    • MITK_ERROR << "No input available."; and itkExceptionMacro("mitk::ImageToLiveWireContourFilter: No input available. Please set the input!");
    • MITK_ERROR << "Filter is only working on 2D images."; and itkExceptionMacro("mitk::ImageToLiveWireContourFilter: Filter is only working on 2D images.. Please make sure that " "the input is 2D!");
    • MITK_INFO << "Exception caught during live wiring calculation: " << e;
    • MITK_INFO << "Exception caught during dynamic cost map alculation: " << e;
  • ImageToContourFilter
    • MITK_ERROR << "mitk::ImageToContourFilter: No input available. Please set the input!" << std::endl; and itkExceptionMacro("mitk::ImageToContourFilter: No input available. Please set the input!");
    • MITK_ERROR << "mitk::ImageToImageFilter::GenerateData() works only with 2D images. Please assure that your input " "image is 2D!" << std::endl; and itkExceptionMacro( "mitk::ImageToImageFilter::GenerateData() works only with 2D images. Please assure that your input image is 2D!");
  • ImageToLiveWireContourFilter
    • MITK_ERROR << "No input available."; and itkExceptionMacro("mitk::ImageToLiveWireContourFilter: No input available. Please set the input!");
    • MITK_ERROR << "Filter is only working on 2D images."; and itkExceptionMacro("mitk::ImageToLiveWireContourFilter: Filter is only working on 2D images.. Please make sure that " "the input is 2D!");
  • LiveWireTool2D
    • MITK_WARN("LiveWireTool2D") << "PositionEvent is outside ImageRegion!";
  • OtsuSegmentationFilter
    • MITK_WARN << "Tried to set an invalid number of thresholds in the OtsuSegmentationFilter.";
    • MITK_WARN << "Tried to set an invalid number of bins in the OtsuSegmentationFilter.";
  • SegmentationInterpolationController
    • MITK_WARN << "Segmentation image has different image characteristics than reference image." << std::endl;
    • MITK_WARN << "original patient image does not match segmentation (different extent in dimension " << dim << "), ignoring patient image" << std::endl;
    • SegmentationInterpolationController::PrintStatus() uses MITK_INFO
    • MITK_ERROR << "Error in 2D interpolation: " << e.what();, if the interpolation / slice extraction throws an exception
  • SegTool2D
    • MITK_DEBUG << "indexPoint " << indexPoint << " affectedDimension " << affectedDimension << " affectedSlice " << affectedSlice;
    • MITK_WARN << "Cannot write tool results. Tool seems to be in an invalid state, as no interaction event was recieved but is expected.";
  • SetRegionTool
    • MITK_WARN << "Point outside of segmentation slice." << std::endl;
  • ShapeBasedInterpolationAlgorithm
    • MITK_ERROR << "The regions of the slices for the 2D interpolation are not equally sized!"; // here it says // TODO Exception etc.
  • ShowSegmentationAsSmoothedSurface
    • MITK_ERROR << e.GetDescription() << endl;, if the input image for the filter cannot be set correctly
    • MITK_ERROR << "Didn't found segmentation labeled with " << imageLabel << "!" << endl; // also gramatically incorrect
    • some MITK_INFO for the current status (e.g. surface extraction, mesh decimation)
  • SliceBasedInterpolationController
    • MITK_WARN << "Segmentation image has different image characteristics than reference image." << std::endl;
    • MITK_WARN << "original patient image does not match segmentation (different extent in dimension " << dim << "), ignoring patient image" << std::endl;
    • MITK_ERROR << "Error in 2D interpolation: " << e.what();, if the slice extractor throws an exception during interpolation
  • Tool
    • MITK_ERROR << "Could not load statemachine pattern " << m_InteractorType << ".xml with exception: " << e.what();
    • MITK_ERROR << "There is more than one GUI for " << classname << " (several factories claim ability to produce a " << guiClassname << " ) " << std::endl;
    • Tool::ErrorMessage("Original image does not have a 'Time sliced geometry'! Cannot create a segmentation."); // not sure what happens here
  • WatershedTool
    • MITK_ERROR << "Watershed Filter Error: " << e.GetDescription();, if one of the used itk filters throws an exception

Inside SegmentationUI module

  • QmitkAdaptiveRegionGrowingToolGUI
    • MITK_WARN << "Cannot run segementation. Currently selected timepoint is not in the time bounds of the selected " "reference image. Time point: " << timePoint;
    • MITK_ERROR << "Missing data node for labeled segmentation image.";
  • QmitkSliceBasedInterpolatorWidget
    • MITK_WARN << "Cannot interpolate WorkingImage. Passed time point is not within the time bounds of WorkingImage. Time point: " << timePoint;
    • MITK_WARN << "Cannot get slice of WorkingImage. Time point selected by SliceNavigationController is not within the time bounds of WorkingImage. Time point: " << timePoint;
    • MITK_ERROR << "Exception caught: " << excep.GetDescription();, if the slice extractor throws an exception
    • MITK_WARN << "Cannot accept interpolation. Time point selected by SliceNavigationController is not within the time bounds of WorkingImage. Time point: " << timePoint;
    • MITK_WARN << "Cannot accept all interpolations. Time point selected by SliceNavigationController is not within the time bounds of WorkingImage. Time point: " << timePoint;
  • QmitkSlicesInterpolator
    • MITK_ERROR << "Unknown interpolation method!";
    • MITK_WARN << "Cannot interpolate segmentation. Passed time point is not within the time bounds of WorkingImage. Time point: " << timePoint;
    • MITK_WARN << "Cannot accept interpolation. Time point selected by SliceNavigationController is not within the time bounds of segmentation. Time point: " << timePoint;
    • MITK_WARN << "Cannot accept all interpolations. Time point selected by passed SliceNavigationController is not within the time bounds of segmentation. Time point: " << timePoint;
    • MITK_WARN << "Cannot accept interpolation. Current time point is not within the time bounds of the patient image and segmentation.";
    • MITK_ERROR << "Error with 3D surface interpolation!";, if the 3D interpolation runner throws an exception
    • MITK_WARN << "Cannot accept interpolation. Time point selected by SliceNavigationController is not within the time bounds of WorkingImage. Time point: " << timePoint;

Inside Multilabel module:

  • DICOMSegmentationIO
    • MITK_INFO << "DICOM segmentation writer is tested only with 3D images, sorry.";
    • MITK_ERROR << "An error occurred while getting the dicom informations: " << e.what() << endl;
    • MITK_ERROR << "An error occurred during writing the DICOM Seg: " << e.what() << endl;
    • MITK_ERROR << "Error reading the DICOM Seg file" << std::endl;
    • MITK_ERROR << "An error occurred while reading the DICOM Seg file: " << e.what();
    • MITK_ERROR << "An error occurred in dcmqi while reading the DICOM Seg file";
    • MITK_ERROR << "Something went wrong with the label ID.";
  • LabelSetImageIO
    • MITK_WARN << "Saving a 2D image with 3D geometry information. Geometry information will be lost! You might " "consider using Convert2Dto3DImageFilter before saving.";
    • MITK_WARN << "Sorry, only dimensions 2, 3 and 4 are supported. The given file has " << ndim << " dimensions! Reading as 4D.";
    • MITK_ERROR << "Stored timepoints are empty. Meta information seems to bee invalid. Switch to ProportionalTimeGeometry fallback";
    • MITK_ERROR << "Stored timepoints (" << timePoints.size() - 1 << ") and size of image time dimension (" << image->GetDimension(3) << ") do not match. Switch to ProportionalTimeGeometry fallback";
    • MITK_ERROR << "Property cannot be correctly deserialized and is skipped. Check if data format is valid. Problematic property value string: \"" << value << "\"; Property info used to deserialized: " << info;
  • LabelSetImageSerializer
    • MITK_ERROR << " Object at " << (const void *)this->m_Data << " is not an mitk::LabelSetImage. Cannot serialize as LabelSetImage.";
    • MITK_ERROR << " Error serializing object at " << (const void *)this->m_Data << " to " << fullname << ": " << e.what();
  • LabelSetImageSurfaceStampFilter
    • MITK_ERROR << "Input surface is nullptr.";
  • LabelSetImageToSurfaceThreadedFilter
    • MITK_WARN << "\"Smooth\" parameter was not set: will use the default value (" << useSmoothing << ").";
    • MITK_WARN << "\"RequestedLabel\" parameter was not set: will use the default value (" << m_RequestedLabel << ").";
    • and some caught exceptions
  • LabelSetIOHelper
    • MITK_WARN << "Not a valid LabelSet preset";
    • MITK_WARN << "LabelSet preset does not contain any layers";
    • MITK_ERROR << "No serializer found for " << property->GetNameOfClass() << ". Skipping object";
    • MITK_WARN << "Multiple serializers found for " << property->GetNameOfClass() << "Using arbitrarily the first one.";
    • MITK_ERROR << "Serializer " << serializer->GetNameOfClass() << " failed: " << e.what();
    • MITK_ERROR << "No serializer found for " << type << ". Skipping object";
    • MITK_WARN << "Multiple deserializers found for " << type << "Using arbitrarily the first one.";
    • MITK_ERROR << "Deserializer " << serializer->GetNameOfClass() << " failed: " << e.what();

Some things to consider here:

  • some modules can not use something like QMessageBox::information, since they don't have a dependency to Qt
  • exceptions could be re-thrown to be handled one layer above, possibly on the UI level
  • in many cases it might be useful to show a warning on the UI to give hints for the user to understand what the user can do to avoid the error
    • this especially true of those cases where nothing happens and the user expects something to happen (e.g. wrong dimension, invalid algorithm parameter)
kalali removed kalali as the assignee of this task.Feb 9 2022, 9:32 AM
a178n lowered the priority of this task from Normal to Low.Jul 26 2023, 12:00 PM
a178n removed a project: Request for Discussion.

It's agreed in the meeting that the status quo is inconsistent.

  1. We should go through all of these MITK_... macros and apply a common heuristic to decide on what macro is used in what case to unify on policy
  2. On the highest level (view level) we could decide on a common mechanism to report actual important errors and warnings for a user. It can't be decided below that level since it might be okay to have an error on filter level since it is handled gracefully by an upper layer and therefore should be brought to for attention.
kislinsk claimed this task.
kislinsk added a project: Moved to git.dkfz.de.
kislinsk added a subscriber: kislinsk.

This task was closed here on Phabricator since it was migrated to GitLab. Please continue on GitLab.