Skip to content

Commit

Permalink
Add axis order zarr (#904)
Browse files Browse the repository at this point in the history
* Add script for debugging the creation of properties json file.

* Add axisOrder to zarr properties.

* Adapt zarr related test in wkcuber.

* Update Changelog.md.
  • Loading branch information
markbader authored May 23, 2023
1 parent 60e78be commit c9a00dc
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 4 deletions.
1 change: 1 addition & 0 deletions webknossos/Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
26 changes: 22 additions & 4 deletions webknossos/testdata/tiff/datasource-properties.zarr-fixture.json
Original file line number Diff line number Diff line change
Expand Up @@ -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
]
}
10 changes: 10 additions & 0 deletions webknossos/webknossos/dataset/layer.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
),
)
]

Expand Down Expand Up @@ -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()
Expand Down
1 change: 1 addition & 0 deletions webknossos/webknossos/dataset/properties.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit c9a00dc

Please sign in to comment.