From c9a00dc4c9a82c489b9df296d1c93fb52cd421c6 Mon Sep 17 00:00:00 2001 From: Mark Bader Date: Tue, 23 May 2023 12:28:31 +0200 Subject: [PATCH] Add axis order zarr (#904) * Add script for debugging the creation of properties json file. * Add axisOrder to zarr properties. * Adapt zarr related test in wkcuber. * Update Changelog.md. --- webknossos/Changelog.md | 1 + .../datasource-properties.zarr-fixture.json | 26 ++++++++++++++++--- webknossos/webknossos/dataset/layer.py | 10 +++++++ webknossos/webknossos/dataset/properties.py | 1 + 4 files changed, 34 insertions(+), 4 deletions(-) diff --git a/webknossos/Changelog.md b/webknossos/Changelog.md index 50194ec17..d3e28b281 100644 --- a/webknossos/Changelog.md +++ b/webknossos/Changelog.md @@ -23,6 +23,7 @@ For upgrade instructions, please check the respective _Breaking Changes_ section ### Fixed - Fixed poetry build backend for new versions of Poetry. [#899](https://github.com/scalableminds/webknossos-libs/pull/899) +- Added axis_order fields for Zarr data format. [#902](https://github.com/scalableminds/webknossos-libs/issues/902) ## [0.12.3](https://github.com/scalableminds/webknossos-libs/releases/tag/v0.12.3) - 2023-02-22 diff --git a/webknossos/testdata/tiff/datasource-properties.zarr-fixture.json b/webknossos/testdata/tiff/datasource-properties.zarr-fixture.json index a4900b3b4..e2fb5a896 100644 --- a/webknossos/testdata/tiff/datasource-properties.zarr-fixture.json +++ b/webknossos/testdata/tiff/datasource-properties.zarr-fixture.json @@ -11,17 +11,35 @@ "elementClass": "uint8", "mags": [ { - "mag": [1, 1, 1] + "mag": [ + 1, + 1, + 1 + ], + "axisOrder": { + "x": 1, + "y": 2, + "z": 3, + "c": 0 + } } ], "numChannels": 1, "boundingBox": { - "topLeft": [0, 0, 0], + "topLeft": [ + 0, + 0, + 0 + ], "width": 265, "height": 265, "depth": 257 } } ], - "scale": [11.24, 11.24, 25.0] -} + "scale": [ + 11.24, + 11.24, + 25.0 + ] +} \ No newline at end of file diff --git a/webknossos/webknossos/dataset/layer.py b/webknossos/webknossos/dataset/layer.py index bc4d8e06d..1be8ffdce 100644 --- a/webknossos/webknossos/dataset/layer.py +++ b/webknossos/webknossos/dataset/layer.py @@ -415,6 +415,11 @@ def add_mag( if mag_array_info.data_format == DataFormat.WKW else None ), + axis_order=( + {"x": 1, "y": 2, "z": 3, "c": 0} + if mag_array_info.data_format == DataFormat.Zarr + else None + ), ) ] @@ -447,6 +452,11 @@ def add_mag_for_existing_files( if mag_array_info.data_format == DataFormat.WKW else None ), + axis_order=( + {"x": 1, "y": 2, "z": 3, "c": 0} + if mag_array_info.data_format == DataFormat.Zarr + else None + ), ) ) self.dataset._export_as_json() diff --git a/webknossos/webknossos/dataset/properties.py b/webknossos/webknossos/dataset/properties.py index b04df0305..49fcf605a 100644 --- a/webknossos/webknossos/dataset/properties.py +++ b/webknossos/webknossos/dataset/properties.py @@ -121,6 +121,7 @@ class LayerViewConfiguration: class MagViewProperties: mag: Mag cube_length: Optional[int] = None + axis_order: Optional[Dict[str, int]] = None @property def resolution(self) -> Mag: