Skip to content

Commit

Permalink
Merge pull request #131 from will-moore/units_unit_fix
Browse files Browse the repository at this point in the history
Fix units -> unit
  • Loading branch information
will-moore authored Nov 3, 2022
2 parents 9b0b559 + 12fda8d commit de7a530
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# 0.5.1 (November 2022)

- Fix axes "units" to "unit" ([#131](https://github.com/ome/omero-cli-zarr/pull/131))
10 changes: 5 additions & 5 deletions src/omero_zarr/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,17 +46,17 @@ def marshal_pixel_sizes(image: ImageWrapper) -> Dict[str, Dict]:
# All OMERO units.lower() are valid UDUNITS-2 and therefore NGFF spec
if pix_size_x is not None:
pixel_sizes["x"] = {
"units": str(pix_size_x.getUnit()).lower(),
"unit": str(pix_size_x.getUnit()).lower(),
"value": pix_size_x.getValue(),
}
if pix_size_y is not None:
pixel_sizes["y"] = {
"units": str(pix_size_y.getUnit()).lower(),
"unit": str(pix_size_y.getUnit()).lower(),
"value": pix_size_y.getValue(),
}
if pix_size_z is not None:
pixel_sizes["z"] = {
"units": str(pix_size_z.getUnit()).lower(),
"unit": str(pix_size_z.getUnit()).lower(),
"value": pix_size_z.getValue(),
}
return pixel_sizes
Expand All @@ -77,12 +77,12 @@ def marshal_axes(image: ImageWrapper) -> List[Dict]:
if size_z > 1:
axes.append({"name": "z", "type": "space"})
if pixel_sizes and "z" in pixel_sizes:
axes[-1]["units"] = pixel_sizes["z"]["units"]
axes[-1]["unit"] = pixel_sizes["z"]["unit"]
# last 2 dimensions are always y and x
for dim in ("y", "x"):
axes.append({"name": dim, "type": "space"})
if pixel_sizes and dim in pixel_sizes:
axes[-1]["units"] = pixel_sizes[dim]["units"]
axes[-1]["unit"] = pixel_sizes[dim]["unit"]

return axes

Expand Down

0 comments on commit de7a530

Please sign in to comment.