InsightSoftwareConsortium / InsightSoftwareConsortium/ITKIOOMEZarrNGFF
ENH: Support different axis orders
- Dominant language
- C++
- Stars
- 10
- Forks
- 6
- PR merge metrics
- No merged PRs in 30d
Description
## Current Behavior
After https://github.com/InsightSoftwareConsortium/ITKIOOMEZarrNGFF/pull/43 ITKIOOMEZarrNGFF will support reading from OME-Zarr stores where spatial axes appear in the order `z,y,x`. For instance, the following are supported:
- `y,x`
- `z,y,x`
- `t,y,x`
- `t,c,z,y,x`
- `t,z,y,x,c`
etc.
OME-Zarr and ITK axis access conventions are reversed. A 3D ITK image represents data with x,y,z axes, where "x" is the fastest moving and "z" is the slowest moving image axis. A 3D OME-Zarr store with axes "z", "y", "x" equivalently represents data where "z" is the slowest moving image axis and 'x" is the fastest moving image axis.
EDIT: Note that the order of spatial axes is not explicitly enforced. In theory images with out-of-order spatial axes can be read out of order. However, spatial metadata in the resulting ITK image may similarly be out of order.
## Requested Behavior
Allow the user to specify the order in which OME-Zarr axes should permute to map to ITK axes. Handle spatial metadata (direction, origin, spacing) accordingly.
For instance:
```py
imageio = itk.OMEZarrNGFFImageIO.New()
imageio.SetNamedAxes(['x','y','z']) # equivalent to ITK default
# read, etc...
```
or:
```py
imageio = itk.OMEZarrNGFFImageIO.New()
imageio.SetNamedAxes(['x','z','y'])
# read, etc...
```
`NamedAxes` should default to the expected ITK spatial axes, i.e. [`x`,`y`,`z`].
## Enhancement 1
Allow the user to query what named axes are available and reconfigure accordingly.
```py
image_reader.SetImageIO(imageio)
image_reader.SetFileName(filename)
image_reader.UpdateOutputInformation()
print(imageio.GetNamedAxes()) # ['x','t','angle',etc]
```
## Enhancement 2
Consider mapping arbitrary axes to ITK dimensions:
```py
imageio.SetNamedAxes(['t','angle','z'])
imageio.SetNamedIndex('x', 5)
imageio.SetNamedIndex('y',10)
# read, etc...
```
Metadata may get tricky under this general approach.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.