Skip to content

explicitly define the original coordinate system of an array #110

@d-v-b

Description

@d-v-b

Describe the issue

The spec claims that array coordinate systems do not need to be explicitly defined:

Every array has a default coordinate system whose parameters need not be explicitly defined.

But I don't think this is true. Since array coordinate systems are the input to all other coordinate systems, they very much need an explicit definition, as ambiguity will propagate.

For an array A with dimensionality N, where N >= 1, I would define A's array coordinate system C as follows:

  • C is an N-dimensional array with the same size as A.
  • The elements of C are N-tuples of integers
  • The first element of C is (0, ...) expanded to N dimensions.
  • All other elements of C are their array index relative to the origin.

For example, given an array with shape (2, 4), the array coordinate system defines the following 2-dimensional array of coordinates:

[
  [(0,0), (0, 1), (0, 2), (0, 3)],
  [(1,0), (1, 1), (1, 2), (1, 3)],
]

there's a more mathy way to say this but I don't think it's useful, and there's a less mathy way too: the array coordinate system is the set of array indices for the array, starting at (0, ...). Defining the origin explicitly is key. Different software packages disagree on where array indexing starts. This means different software would use the same transforms to generate images on different coordinate grids, which we don't want.

The spec does mention an origin here:

ngff-spec/index.md

Lines 340 to 350 in 990aeaa

**The pixel/voxel center is the origin of the continuous coordinate system.**
It is vital to consistently define relationship
between the discrete/array and continuous/interpolated coordinate systems.
A pixel/voxel is the continuous region (rectangle) that corresponds to a single sample in the discrete array, i.e.,
the area corresponding to nearest-neighbor (NN) interpolation of that sample.
The center of a 2d pixel corresponding to the origin `(0,0)` in the discrete array
is the origin of the continuous coordinate system `(0.0, 0.0)` (when the transformation is the identity).
The continuous rectangle of the pixel is given
by the half-open interval `[-0.5, 0.5) x [-0.5, 0.5)` (i.e., -0.5 is included, +0.5 is excluded).
See chapter 4 and figure 4.1 of the ITK Software Guide.

But it's not obvious that this claim defines the set of coordinates that all arrays start with. So I think the spec should be much more clear and define the origin in the context of the array coordinate system.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions