Page MenuHomePhabricator

Inconsistent transformation of Vector3D and Point3D from Index- to World-Coordinates in Geometry3D
Closed, ResolvedPublic

Description

If you call the IndexToWorld(Vector3D, Vector3D) then the transformation's offset is ignored. Otherwise if you call IndexToWorld(Point3D, Point3D) the transformation's offset is added. This is confusing especially because this fact is mentioned nowhere. Not even in the documentation.

BUT this happens ITK-sided:

In the first case m_IndexToWorldTransform->TransformVector() is called. And in the second case ...->TransformPoint() is called.

Event Timeline

This is not a bug, but an intended behavior. (Well, maybe the bug is that the documentation should be more complete -> changing component to "Documentation".)

The idea in ITK of having different classes for points and vectors is that points change in a different way compared to vectors when being transformed:

  • a vector (=direction) does not care about the offset of a transform. Example: let v be a vector pointing to the right (e.g., v=(17,0,0)). Now move it by (0,8,15) ... it will still point to the right (v=(17,0,0), i.e., it did not change at all).
  • in contrast, a point (=position in space) does care about the offset. Example: let p be (17,0,0). After moving it by (0,8,15) it will, of course, change to (17,8,15).

BTW itk::Point has a method itk::Point<...>::GetVectorFromOrigin() returning an itk::Vector<...>.

Ok this makes sense. Then we definitely must update the documentation. It is pretty confusing at the moment.
Removed RFD Keyword

(In reply to comment #2)

Ok this makes sense. Then we definitely must update the documentation. It is
pretty confusing at the moment.
Removed RFD Keyword

Shall we add a general chapter on "points" and "vectors" somewhere?

Here are the current documentations of the two methods, which differ only in the word *point* vs *vector*:

IndexToWorld (const mitk::Point3D &pt_units, mitk::Point3D &pt_mm) const
Convert (continuous or discrete) index coordinates of a *point* to world coordinates (in mm) For further information about coordinates types, please see the Geometry documentation.

IndexToWorld (const mitk::Vector3D &vec_units, mitk::Vector3D &vec_mm) const
Convert (continuous or discrete) index coordinates of a *vector* vec_units to world coordinates (in mm) For further information about coordinates types, please see the Geometry documentation.

This might work as either a paragraph or even a subpage of the Geometry Oevrview.

http://docs.mitk.org/nightly-qt4/GeometryOverviewPage.html

Are there more concepts, that many are not aware of which should be added to that documentation?

(In reply to comment #4)

This might work as either a paragraph or even a subpage of the Geometry
Oevrview.

http://docs.mitk.org/nightly-qt4/GeometryOverviewPage.html

Very nice page!

Are there more concepts, that many are not aware of which should be added to
that documentation?

One idea: maybe the pragraph "2. Continuous index coordinates:" should explicitly mention that mitk::Point3D is used as a data type for this (see also T5282 comment #6) and - similar - "3. Index coordinates" might mention that in this case mitk::Index3D is used.

Andreas, as you know the matter, could you document this as well as the continuous problem discussed in T5282 comment #6

New remote branch pushed: bug-9075-UpdateDocumentationForVectorAndPoints

Pushed a version with updated documentation.

[ef19e7]: Merge branch 'bug-9075-UpdateDocumentationForVectorAndPoints'

Merged commits:

2013-10-09 16:11:41 Michael Goetz [ba714d]
Updated documentation to clearify difference between Points and Vectors