Page MenuHomePhabricator

Geometry GetCenter method does not account for center based voxels
Closed, ResolvedPublic

Assigned To
Authored By
neher
Jan 30 2015, 12:06 PM
Referenced Files
F1223: pic3dRefLinear_Data.png
Oct 7 2015, 4:45 PM
F1222: Pic3dRef_Linear_neuRausgeschrieben.png
Oct 7 2015, 4:44 PM
F1221: Pic3dRefCubic_neuRausgeschrieben.png
Oct 7 2015, 4:40 PM
F1220: pic3dRefCubic_Data.png
Oct 7 2015, 4:40 PM

Description

Current code:
return this->GetIndexToWorldTransform()->TransformPoint(m_BoundingBox->GetCenter());

Proposed:
if (m_ImageGeometry)
{
Point3D c = m_BoundingBox->GetCenter();
c[0] -= 0.5;
c[1] -= 0.5;
c[2] -= 0.5;
IndexToWorld(c, c);
return c;
}

Event Timeline

This proposed code seems to be right, but there are a lot of work-arounds in other classes (e.g. BoundingObject.cpp for image cropper), which need to be found and fixed.

User wildes has pushed new remote branch:

bug-18695-AdaptGetCenterForImageGeometries

These tests are still failing - it might be wrong testing or wrong testing data. Has to be checked!

mitkImageVtkMapper2D_pic3dSwivel640x480 (Failed)
ResliceInterpolationIsLinear (Failed)
ResliceInterpolationIsCubic (Failed)

User wildes has pushed new remote branch:

bug-18695-AdaptGetCenterForImageGeometries_IntBranch

Core Change Request

Summary of problem description

GetCenter() returned wrong center of images with m_ImageGeometry == true (center based geometries).

Actual behavior

Center was shifted by 0.5.

Expected behavior

Return the correct center, no matter if the object is center or corner based.

Cause of the bug

No check for ImageGeometry variable.

Proposed solution

Shift the center by 0.5.

Affected classes

mitkBaseGeometry - correct the GetCenter method
mitkBoundingObject - here was a workaround for the problem
mitkGeometry3DTest - test did not cover the center check for center based images
Testing data for the following tests needed to be changed, as the rotation center was wrong:
mitkImageVtkMapper2D_pic3dSwivel640x480
ResliceInterpolationIsLinear
ResliceInterpolationIsCubic

How will the bugfix get tested?

Geometry3DTest - new if case in GetCenter Test method.

[85d7b9]: Merge branch 'bug-18695-AdaptGetCenterForImageGeometries_IntBranch'

Merged commits:

2015-09-30 15:30:58 Esther Wild [a7cf4c]
Create new MITK testing data

Images were rotated around wrong center, due to bug in GetCenter-method.


2015-09-30 13:23:21 Esther Wild [e03152]
Merge branch 'bug-18695-AdaptGetCenterForImageGeometries' into bug-18695-AdaptGetCenterForImageGeometries_IntBranch


2015-09-09 17:35:35 Esther Wild [dbfc57]
Correct GetCenter for image geometries.

[d88bef]: Merge branch 'bug-18695-AdaptGetCenterForImageGeometries_IntBranch'

Merged commits:

2015-10-05 11:32:06 Esther Wild [94dd70]
COMP: tests deactivated, because win 32 bit continuous renders images slightly different.

Rendering test fails on 32bin Win continuous. Deactivated. ToDo: Find out, why the rendering is different on 32 bit.

The rendering on the windows continuous is different and has always been different. However, with the old data, the differences were small enough to be below the threshold of 0.35. With the new data, the threshold needs to be something between 1 and 5...

Adapting the threshold is not the right solution, it would be better to add a second testing image.

Differences are not caused by 32 bit system. It might be the QT version (continuous qt5.3.0, local windows qt5.4.0), or the rendering in a virtual machine.

Spacing and Geometries (currentWorldPlaneGeometry and CurrentWOrldGeometry) are identical on both machines, therefore, it should be a rendering problem.

The image of the virtual machine looks like an interpolation filter was applied. However, we did not find such a difference yet.

Reference image of the ResliceInterpolationIsCubic test, passing on local machine or linux.

pic3dRefCubic_Data.png (480×640 px, 59 KB)

Reference image of the ResliceInterpolationIsCubic test, passing on the Windows continuous dartclient.

Pic3dRefCubic_neuRausgeschrieben.png (480×640 px, 120 KB)

Reference image of the ResliceInterpolationIsLinear test, passing on Windows continuous.

Pic3dRef_Linear_neuRausgeschrieben.png (480×640 px, 99 KB)

Reference image of the ResliceInterpolationIsLinear test, passing on linux or windows (local).

pic3dRefLinear_Data.png (480×640 px, 49 KB)

kislinsk claimed this task.