Page MenuHomePhabricator

Incorrect origin for SlicedGeometry3D, shifted with half spacing
Closed, DuplicatePublic


In mitk::SlicedGeometry3D::InitializeEvenlySpaced() the origin of the geometry is calculated incorrectly.

Now, if the axis is not flipped, the origin is the same as that of the plane geometry used for the initialisation. However, it should be shifted with half spacing along the direction that is orthogonal to the plane. The same should be done if the axis is flipped, just to the opposite direction.

The bug causes that if you construct three sliced geometries, one for each renderer, then the bounding box of these geometries will not be the same, nor the centre, origin or corner points. These should all be equal.

Event Timeline

I have a patch that corrects this, but it caused other problems. The origin, centre and the corner points of the renderers matched, but the crosshair was not exactly in the middle of the voxels.

I found a simple workaround for the issue in our app that does not need modifications in MITK.

I leave this ticket open because I would be curious if you consider this as a bug, or the half voxel shift is intended. If the latter, it might be worth mentioning it in the Geometry Introduction page. Now it says that for non-image geometries the origin is the bottom-left-back corner of the bottom-left-back voxel, but for renderers it seems that it is point at the middle of the bottom-left edge of the bottom-left-back voxel, instead.

Any thoughts on this?

Do I think correctly that the centre point and the the eight corner points (not considering the order) should match in each render window and the image geometry that was used to initialise the renderers?

Pull request sent:

The commit:

The change compared to the previous patch is that the correct spacing is set for the transformation matrix before the offset is corrected.

The scaling was hard coded to 1, 1, -1 for flipped geometries, what probably did not cause any problem for image geometries, since there the origin of the first slice is the same as the origin of the 3D volume. This is not true for non-image geometries, though.

Please let me know if you can merge it, because we are in the process of an MITK upgrade, and if it gets merged quickly, I do not put it on the top of our fork.

Esther and Michel, could you please have a look at this bug and the related pull request?