Page MenuHomePhabricator

Error when loading a measurement or pointset and then an image
Closed, ResolvedPublic

Description

If you load a measurement or point set first and an image afterwards, the workbench crashes. When I tried to reproduce the error by creating an own measurement and doing the same, the error didn't occur.

Steps to reproduce:

  1. Load a measurement (e.g. MITK-Data\RenderingTestData\PlanarFigures\Line1.pf)
  2. Load an image (e.g. Pic3D)

Revisions and Commits

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

Event Timeline

kahl triaged this task as Normal priority.Jan 9 2020, 10:03 AM
kahl created this task.
kislinsk edited projects, added MITK (2018-04-4); removed MITK.Jan 9 2020, 2:52 PM
kislinsk edited projects, added MITK; removed MITK (2018-04-4).Feb 11 2020, 4:42 PM
kislinsk renamed this task from Debug error when loading a measurement or pointset and then an image to Error when loading a measurement or pointset and then an image.Apr 15 2020, 7:17 AM
kislinsk raised the priority of this task from Normal to High.
kislinsk updated the task description. (Show Details)
kislinsk edited projects, added MITK (2020); removed MITK.
kalali added subscribers: floca, kislinsk, kalali.EditedThu, May 7, 10:56 AM

mitk::ExtractSliceFilter::GenerateOutputInformation() generates the bounds of the itk object. There are some values that need to be inspected:

xMin = 0
xMax = 512
yMin = 0
yMax = 0

So subsequently

// currently the unit rectangle must be starting at the origin [0,0]
assert(bounds[0] == 0);
assert(bounds[2] == 0);
// the unit rectangle must be two-dimensional
assert(bounds[1] > 0);
assert(bounds[3] > 0);

in PlaneGeometry::CheckBounds(const BoundingBox::BoundsArrayType &bounds) fails.

I think this is due to yMax = static_cast<int>(extent[1]); inside mitk::ExtractSliceFilter::GenerateOutputInformation() with extent[1] being 0.333333 so it's cut off to zero.
@floca @kislinsk , I'm not an expert on geometry-stuff so please take a look. I don't know why it does not happen when loading both data objects in a different order.

kalali added a comment.Fri, May 8, 8:54 AM

I just ran into this error (on Windows) unexpectedly by doing the following:

  1. load ImageStatistics/testimage.dcm
  2. remove the image node
  3. load Pic3D
  4. -> Error in PlaneGeometry::CheckBounds(const BoundingBox::BoundsArrayType &bounds)
floca added a revision: Restricted Differential Revision.Mon, May 25, 9:36 PM
floca claimed this task.Mon, May 25, 9:50 PM
floca added a project: Request for Discussion.
floca added a subscriber: nolden.

I know how to fix the obvious problem. But I want to discuss if this is the complete fix or only curing the symptoms,

The problem occures when the current world geometry, that
should be rendered by the mapper, has an FOV that in combination with
a loaded image generates an index (right or bottom vector) that is
smaller then 1 and will be rounded to 0, wich violates the bound checks
of plane geometry.

To make it concrete:
Loading ImageStatistics/testimage.dcm (size 17x17x1) leads in the 2d mappers to slices of (17x1). When I load Pic3D (spacing: 1x1x3), the mapper wants a reslice for the world geometry still defined by testimage.dcm (so a slice 17x1 mm). For mapping the ponts to index the geometry of the input image (Pic3D) is used. Therefor the mapped index is -> 17x0.3333. This will be later floored to 17x0, which leads to the error.
I assume that happens because the mappers are triggered at least once before a new world geometry is establisched.

@kislinsk @nolden I think from first glance that it is valid to just ensure that the slice never colapses (see code review) and there is no deeper error just covered by the fix. But I want to discuss to get a second opinion.