diff --git a/CHANGELOG.md b/CHANGELOG.md index 749b4f036..1500e1880 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,10 @@ - Better handle images with signed pixel data ([#1695](../../pull/1695)) - Reduce loading geojs when switching views in Girder ([#1699](../../pull/1699)) +### Changes + +- Ensure reading non-editable zarr files the c axis, if present, has a stride of 1 ([#1702](../../pull/1702)) + ## 1.30.1 ### Improvements diff --git a/sources/zarr/large_image_source_zarr/__init__.py b/sources/zarr/large_image_source_zarr/__init__.py index dad83351c..638cef80a 100644 --- a/sources/zarr/large_image_source_zarr/__init__.py +++ b/sources/zarr/large_image_source_zarr/__init__.py @@ -446,10 +446,16 @@ def _validateZarr(self): stride = 1 self._strides = {} self._axisCounts = {} - for _, k in sorted( - (-self._axes.get(k, 'tzc'.index(k) if k in 'tzc' else -1), k) - for k in self._axes if k not in 'xys' - ): + # 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): self._strides[k] = stride self._axisCounts[k] = baseArray.shape[self._axes[k]] stride *= baseArray.shape[self._axes[k]] diff --git a/tox.ini b/tox.ini index 192af5c7d..517fa7b99 100644 --- a/tox.ini +++ b/tox.ini @@ -10,7 +10,7 @@ skip_missing_interpreters = true toxworkdir = {toxinidir}/build/tox [testenv] -passenv = PYTEST_*,COVERAGE_*,DICOMWEB_TEST_URL,DICOMWEB_TEST_TOKEN,GIRDER_BUILD_OPTIONS,PIP_*,CFLAGS +passenv = PYTEST_*,COVERAGE_*,DICOMWEB_TEST_*,REDIS_TEST_*,GIRDER_BUILD_OPTIONS,PIP_*,CFLAGS extras = memcached redis @@ -61,6 +61,8 @@ setenv = # Versions that do have all tile sources. Using the requirements-dev.txt file # installs in editable mode, which then includes results in coverage. [testenv:test-py{38,39,310,311,312,313}] +# Don't package for tests where we use editable modes +package=skip passenv = {[testenv:test]passenv} deps = -rrequirements-dev.txt