Page MenuHomePhabricator

[Segmentation] Loading a nifti segmentation (nii) leads to a crash
Closed, ResolvedPublic

Description

Loading a previously stored nifti segmentation (file format nii) leads to a crash if either

  • the segmentation view is already open when the segmentation is loaded
  • the segmentation view is opened after the segmentation was loaded

The error occurs here: LabelSetImage::GetActiveLabelSet()

    • m_LabelSetContainer is unknown
  • this is unknown

This comes from the fact that inside QmitkSegmentationView::EstablishLabelSetConnection the call auto workingImage = dynamic_cast<mitk::LabelSetImage*>(m_WorkingNode->GetData()) returns a nullptr. While there is no check for nullptr I'm wondering why the nifti image is not recognized as a LabelSetImage.
I guess something was not written correctly to the file.

To reproduce:

  • open MITK, load a simple image
  • create a new segmentation with a layer and a label (no need to draw something)
  • right click on the segmentation node and store as nifti (*.nii)
  • remove the segmentation node from the data storage
  • load the saved nifti file
    • either while the segmentation view is still open
    • close the segmentation view before loading and open it again after loading

Revisions and Commits

rMITK MITK
Restricted Differential Revision
Restricted Differential Revision
Restricted Differential Revision
Restricted Differential Revision

Event Timeline

kalali triaged this task as Unbreak Now! priority.Tue, Nov 15, 5:52 PM
kalali created this task.
kalali added a project: Request for Discussion.
kalali added a subscriber: b030s.
kalali added a revision: Restricted Differential Revision.Tue, Nov 15, 6:27 PM

I added a first fix to avoid crashes. More changes are required:
Inside QmitkSegmentationView::UpdateGUI() the two functions m_Controls->layersWidget->UpdateGUI() and m_Controls->labelsWidget->UpdateGUI() are called. They both require the working image to be a LabelSetImage, otherwise the GUI elements will stay deactivated. Also, since no layer is available the toolselectionboxes stay deactivated.

The seg predicate of the view is wrong. Should not be able to select the nifti at all.

Also seg in nifti form have to be converted into label image currently via context menu "convert to segmentation".

Is this reason for a patch release?

+ we should add a check to the checklist to verify that legacy segmentations are handeled correctly (not selectable).

kalali added a revision: Restricted Differential Revision.Wed, Nov 16, 9:21 AM
kalali renamed this task from [Segmentation] Loading a nifty segmentation (nii) leads to a crash to [Segmentation] Loading a nifti segmentation (nii) leads to a crash.Wed, Nov 16, 9:24 AM
kalali updated the task description. (Show Details)

The seg predicate of the view is wrong. Should not be able to select the nifti at all.

Also seg in nifti form have to be converted into label image currently via context menu "convert to segmentation".

I agree, a differential was added accordingly. So we actually do not correctly convert a nifti? The nifti was stored from within MITK and it was a manually, newly created labelset image using the segmentation view.

We will add the two suggested changes as a hotfix / release patch because

  • we should definitely avoid workbench crashes
  • also old legacy segmentations / scene files will provoke the crash

So we assume that more people will experience the crash.