Page MenuHomePhabricator

[Segmentation][Utilities] "Image Masking" has several issues regarding image dimensionality
Closed, ResolvedPublic

Description

Using a 4D image and a dynamic segmentation results in an exception thrown when using a “Custom” background value.
Tested with Pic2DplusT

image.png (569×1 px, 39 KB)

Revisions and Commits

rMITK MITK
Restricted Differential Revision
Restricted Differential Revision

Event Timeline

kalali triaged this task as Normal priority.Oct 29 2021, 2:59 PM
kalali created this task.

Works with Zero and Minimum background value options, only "custom" results in an uncaught "dimension (4) is not in (2)(3)" exception + crash.

Also, dynamic image + static segmentation disables the image masking widgets with the message "Different image sizes cannot be masked". Tested with 2d+t and 3d+t image.

kislinsk renamed this task from [Segmentation][Utilities] Using custom background pixels for "Image Masking" fails to [Segmentation][Utilities] "Image Masking" has several issues regarding image dimensionality.Nov 4 2021, 7:51 AM
kislinsk claimed this task.
kislinsk raised the priority of this task from Normal to High.

I also looked into this task yesterday and the issue is that for custom background values, the "AccessByItk_n" function is used, which only works for 2D and 3D images. A potential fix would be to use the "AccessFixedDimensionByItk_n" function for the 4D case, then the Workbench does not crash anymore. So in the QmitkImageMaskingWidget.cpp one could replace

AccessByItk_n(referenceImage, GetRange, (bottom, top));

by

if (referenceImage->GetDimension() == 4)
{
  AccessFixedDimensionByItk_n(referenceImage, GetRange, 4, (bottom, top));
}
else
{
  AccessByItk_n(referenceImage, GetRange, (bottom, top));
}

However, I'm not sure if this is the best solution

kahl added a revision: Restricted Differential Revision.Nov 4 2021, 3:48 PM