Page MenuHomePhabricator

[Segmentation] Erosion crashes the MITK Workbench after interpolation
Closed, ResolvedPublic

Description

To reproduce:

  1. Load Pic3D
  2. Segment two slices with any tool (I segmented the vertebra with region growing but others will work, too)
  3. Use interpolation 2D for all axial slices
  4. Open segmentation utilities
  5. Start erosion => Crash

It doesn't crash on segmentations created with treshold

Revisions and Commits

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

Event Timeline

thomass triaged this task as High priority.Mar 18 2021, 2:15 PM
thomass created this task.

On a first glance, the interpolation seems to affect the result.

  1. Create the segmentation with interpolation -> save it -> reload segmentation -> erosion = no crash
  2. Create the segmentation with interpolation -> erosion = crash

3D interpolation does not produce a crash.

floca lowered the priority of this task from High to Normal.Jun 7 2021, 9:09 AM
floca edited projects, added MITK (v2021.10); removed MITK.
floca moved this task from Backlog to Segmentation on the MITK (v2021.10) board.
floca added a project: Missing Info.
floca added a subscriber: floca.

Does it only crash with erosion or also with other utilities?

I was able to reproduce the bug for all morphological operations (Dilation, Erosion, ...) and also in all orientations (axial, coronal, sagittal). Other segmentation utilities all work without problem.

@kleina Just as a remark. I would postpone this task a bit, as we have enough other things to do and @kislinsk is currently working on interpolation and this might have also impact on this tasks.

Oh, ok. Did not know that. I will postpone it then.

kleina added a subscriber: kleina.

@floca I just tested it with my latest changes and the issue still persists. The connection to interpolation seems to be that the SegmentationInterpolationController is still holding a reference to the image and is notified about a modification. When changing the segmentation volume to the new segmentation eventually the ImageTimeSelector crashes when trying to clone an ImageDataItem that already seems to be null (this is 0x00000000). Here's a part of the call stack:

MitkCore.dll!mitk::ImageDataItem::Clone() Line 67
MitkCore.dll!mitk::ImageTimeSelector::GenerateData() Line 71
ITKCommon-4.13d.dll!itk::ProcessObject::UpdateOutputData(itk::DataObject * __formal) Line 1776
ITKCommon-4.13d.dll!itk::DataObject::UpdateOutputData() Line 419
ITKCommon-4.13d.dll!itk::DataObject::Update() Line 342
ITKCommon-4.13d.dll!itk::ProcessObject::UpdateLargestPossibleRegion() Line 1902
MitkSegmentation.dll!mitk::SegmentationInterpolationController::SetSegmentationVolume(const mitk::Image * segmentation) Line 144
MitkSegmentation.dll!mitk::SegmentationInterpolationController::OnImageModified(const itk::EventObject & __formal) Line 85

This indicates a shorter reproduction of the issue that I can confirm: It is enough to just set the interpolation combobox to "2D interpolation" without doing anything else and than do an erosion to induce a crash. Vise versa, it is enough to switch the combobox back to either "Disabled" or "3D interpolation" to circumvent the crash.

We can fix it in the SegmentationInterpolationController by explicitly handling the situation that the modified image is not initialized (IsInitialized() == false).

However, I think that The ImportItkImage() function is ill-formed when someone imports into an already existing image in which case the re-initialization of the image triggers Modified events (when changing the geometry during initialization for example), while the actual pixel data is not yet set/changed. There's even a state when the image is marked initialized again but the pixel data pointer not yet points to the new data, as it has to be done manually in another call after initialization.

kislinsk added a revision: Restricted Differential Revision.Thu, Jul 8, 7:57 AM
kislinsk renamed this task from [Segmentation Utilities] Erosion crashes the MITK Workbench after interpolation to [Segmentation] Erosion crashes the MITK Workbench after interpolation.Thu, Jul 8, 12:23 PM

Deleted branch from rMITK MITK: bugfix/T28385-InterpolationCrashOnMorphologicalOperations.

Deleted branch from rMITK MITK: bugfix/T28385-AddNullptrCheck.