Page MenuHomePhabricator

[MultiLabel Segmentation][Utilities] Exception thrown when converting to MultiLabel
Closed, WontfixPublic

Description

Using either the DataManager Context Menu or the ML Utility "Convert to MultiLabel" throws the following exception (printed in the mbilog):
"Could not intialize by provided labeled image." (sic!)

This happens when using e.g. "Pic3D" or "MITK-Data\TinyCTAbdomen"

Event Timeline

kalali triaged this task as High priority.Oct 29 2021, 4:09 PM
kalali created this task.

The description of the actual but swallowed exception is "Prohibited image access: the requested image part is already in use and cannot be requested recursively!" thrown indirectly from line 315 in mitkLabelSetImage.cpp: AccessFixedDimensionByItk_n(), which eventually calls ImageToItkImage() in mitkImageToItk.h:132. There, the Update() call of the ImageToItk class throws the exception mentioned above,

It happens when no more label IDs in the first layer are available in another templated ITK method called mitk::LabelSetImage::InitializeByLabeledImageProcessing(). In this case, a new layer is created to continue creating labels using a whole new range of available IDs the new layer.

The call to AddLayer() creates a new image for the new layer and calls another overload of AddLayer() with the image as first parameter. Here, a new label set is created, an exterior label is added, and set as active label. Then, SetActiveLayer() is called to make the new layer active. In this method, line 315 in mitkLabelSetImage.cpp is reached as described above.

kislinsk lowered the priority of this task from High to Normal.Nov 3 2021, 8:11 PM

I lower the priority since the exception is caught and it results in an error message instead of a crash. It's also an academic edge case, since it hardly makes any sense in a real world scenario to convert an actual image with more than 65000 different pixel values into a segmentation. Converting binary images or segmentation-like images works as expected.

Should not be address directly now. Reason: With the new Segementation class, there will be a hard upper limit for the number of labels anyways. In this corner case we also would have to show a error message then, just telling that we cannot cover more then 2^16 labels. So that the provided image cannot be converted into a label image.

floca claimed this task.

I will close it. For the reasons noted above.