girder/large_image

Zarr axis order

Opened this issue · 0 comments

Prior to PR #1625, we always preferred to have the C axis have a stride of 1 if it was present. This changed with writing axes, but I don't think we want this for the general reading case. There are some users who expect the channel to be the inner mode frame axis.

This specifically is here: https://github.com/girder/large_image/blob/master/sources/zarr/large_image_source_zarr/__init__.py#L449-L452

We could make it conditional on whether we are editing or not, since while using the image as a sink reading back in a different axis order could be surprising. Specifically, we could do something like

        # If we aren't in editable mode, prefer the channel axis to have a
        # stride of 1, then the z axis, then the t axis, then sorted by the
        # axis name.
        axisOrder = ((-'tzc'.index(k) if k in 'tzc' else 1, k)
                     for k in self._axes if k not in 'xys')
        # In editable mode, prefer the order that the axes are being written.
        if self._editable:
            axisOrder = ((-self._axes.get(k, 'tzc'.index(k) if k in 'tzc' else -1), k)
                         for k in self._axes if k not in 'xys')
        for _, k in sorted(axisOrder):
            ...

Note that this will cause testFrameValues test in test_sink.py to fail.