Page MenuHomePhabricator

[MultiLabel] Workbench crashes if autocrop is used with opened plugin view without patient image
Closed, ResolvedPublic

Description

To reproduce:

  1. open multi-label segmentation (e.g. MultiLabel/Pic3DAsMultilabelImage.nrrd)
  2. open MultiLabel Segmentation plugin view
    1. see how the Patient Image selection widget is empty (states Select an image
    2. see how the Segmentation selection widget shows the segmentation node name
  3. right click on the segmentation data node and select autocrop

-> workbensh crashes in QmitkMultiLabelSegmentationView::OnLooseLabelSetConnection() at assert(workingImage);

Revisions and Commits

rMITK MITK
Restricted Differential Revision
Restricted Differential Revision
Restricted Differential Revision

Event Timeline

kalali triaged this task as Normal priority.May 8 2020, 1:38 PM
kalali created this task.
floca added a subscriber: floca.

Checked it the source of the problem is QmitkAutocropAction of the multisegmentation plugin. It generates an mitk::Image instead of a mitk::LabelSetImage as a result. As a consequence a precondition of the QmitkMultiLabelSegmentationView fails with an assertion.

The action was never implemented correctly :(.

I would propose for now to completly deprecate and remove this action. It would a major rework and I also think it is without knowing the concrete use case also illposed as context menu action, as there are many implecations. Do you want to crop just a specific label (which one?)? Crop only a laxer (wich one?)? Crop the entier label set (often not very meaningfull...) I think such a tool is of use, but should be (just) part of the Segmentations Tools View. But in context of this task, I would just remove the action. There implementation based on Toolproviders is anyway shacky/shady as discussed in T27046.

Remark: There is some code in QmitkLabelSetWidget that implements the creation of a cropped mask for one lable (at least).

Discussion result: Stefan will have a look if he might find an easy solution ;) Otherwise skipp it.

@kislinsk What's the status? We discussed this and the mentioned task last Friday and decided to disable the autocrop-freature for multi-label via data manager context menu if there is no easy solution.

There are two separate issues:

  1. Auto-cropping of LabelSetImages produces Image instead of LabelSetImage
  2. MultiLabel Segmentation view crashes when it looses connection to the working node AND the data type of it changes

The second issue is easy to fix as it boils down to a missing nullptr check. If the signal for a lost working node was triggered, it is possible that the data of that node isn't already a LabelSetImage anymore, so we simply have to check the type. It's not the scope of this task but I question the general logic of QmitkMultiLabelSegmentationView::OnLooseLabelSetConnection(). It basically removes observers from the working node and it does not crash for LabelSetImages but I guess the possibility is high that it is already another LabelSetImage and we don't want to remove observers from the new LabelSetImage. Maybe it is a working-by-accident thingy and observers are added shortly after again.

kislinsk added a revision: Restricted Differential Revision.Jul 21 2020, 10:30 PM

Deleted branch bugfix/T27386-LabelSetImageAutoCrop.

kislinsk added a revision: Restricted Differential Revision.Jul 23 2020, 1:01 PM