-
Notifications
You must be signed in to change notification settings - Fork 7
Description
Describe the issue
The spec claims that array coordinate systems do not need to be explicitly defined:
Line 292 in 990aeaa
| 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:
Cis anN-dimensional array with the same size asA.- The elements of
CareN-tuples of integers - The first element of
Cis(0, ...)expanded toNdimensions. - All other elements of
Care 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:
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.