Page MenuHomePhabricator

Inconsistent handling of pixel and voxel centers
Closed, ResolvedPublic

Assigned To
None
Authored By
nolden
Jul 14 2010, 2:11 PM
Referenced Files
F562: centerbased.png
Sep 1 2010, 3:57 PM
F561: geometry3d.patch
Sep 1 2010, 2:38 PM
F560: Quickfix.patch
Jul 30 2010, 7:18 PM
F559: consistentCenterBasedCoordinatesPatch.patch
Jul 27 2010, 8:04 PM
F558: consistentCenterBasedCoordinatesPatch.patch
Jul 27 2010, 7:53 PM

Description

ITK changed to consistent center-based indices and physical coordinates. MITK still has some inconsistencies.

Event Timeline

Are you sure with consistent center-based?
They changed to edge-based index coords just in 3.16.

(In reply to comment #1)

Are you sure with consistent center-based?
They changed to edge-based index coords just in 3.16.

Can you please give a reference where you read this?

There is a variable ITK_USE_CENTERED_PIXEL_COORDINATES_CONSISTENTLY in the main CMakeLists.txt of ITK, which is set to ON since release 3.16. The name rather suggests that ITK uses center-based coordinates (hopefully) everywhere since then, doesn't it?

See
http://www.itk.org/cgi-bin/viewcvs.cgi/CMakeLists.txt?view=annotate&root=Insight
(currently line 267, changed in rev. 1.350, rel 3.16 is 1.353).

All info I had were from:

There has been quite a discussion about this in ITK bug tracker
(http://www.itk.org/Bug/view.php?id=6558).

This even lead to a Wiki page on this topic
(http://www.itk.org/Wiki/Proposals:Refactoring_Index_Point_Coordinate_System).

Patch as decribed on wiki page.

Patch as decribed on wiki page.

The attached patch solves the issue according to the description on the wiki page. The patch includes testing code to check that the ITK coordinate system is indeed center-based (included in mitkGeometry3DTest).

[SVN revision 24988]
FIX (#4692): consistently use center-based pixels/voxels

[SVN revision 25020]
COMP (#4692): Replaced templated call to itk::Math::RoundHalfIntegerUp with non templated one to fix compiler errors.

Added Quickfix to sandbox compile errors introduced by ivos last comitt

[SVN revision 25025]
COMP (#4692): mitk::Image::GetPixelValueByIndex takes an mitk::Index3D instead of mitk::Point3D now

(In reply to comment #9)

[SVN revision 25020]
COMP (#4692): Replaced templated call to itk::Math::RoundHalfIntegerUp with non
templated one to fix compiler errors.

According to the ITK docu one should use the templated versions:

"These methods have been deprecated as of ITK 3.16. Please use the templated methods of the form itk::Math::XXX<TReturn,TINput(TInput x) instead." (itkMath.h)

So to finally fix this bug, we should replace it by the templated variant (in a way that gcc and vc2005 understands...).

attached a patch, that should correct the IsIndexInside function, when it is an image geometry

As the IsIndexInside methods get longer and longer...
-> Please move implementation to .cpp file.

Little graphic to make the coherence of coordinates more comprehensible

centerbased.png (1×1 px, 62 KB)

[SVN revision 26151]
FIX (#4692): Added if-check for imagegeometries to the function mitkGeometry3D::IsIndexInside, so it can produce correct output

All geometry changes have been committed and tested successfully.