Skip to content

Commit

Permalink
coordinateTransformations with scale list
Browse files Browse the repository at this point in the history
  • Loading branch information
will-moore committed Jan 31, 2022
1 parent 9e3d194 commit ad3ac1e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/omero_zarr/raw_pixels.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ def planeGen() -> np.ndarray:

datasets: List[Dict[Any, Any]] = [{"path": path} for path in paths]
for dataset, transform in zip(datasets, transformations):
dataset["transformations"] = transform
dataset["coordinateTransformations"] = transform

write_multiscales_metadata(parent, datasets, axes=axes)

Expand Down
16 changes: 8 additions & 8 deletions src/omero_zarr/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,18 +96,18 @@ def marshal_transformations(

# Each path needs a transformations list...
transformations = []
zooms = {"x": 1.0, "y": 1.0, "z": 1.0}
zooms = {"x": 1.0, "y": 1.0, "z": 1.0, "c": 1.0, "t": 1.0}
for level in range(levels):
# {"type": "scale", "scale": {"x": 0.5, "y": 0.5, "z": 0.3}
scales = {}
# {"type": "scale", "scale": [1, 1, 0.3, 0.5, 0.5]
scales = []
for index, axis in enumerate(axes):
pixel_size = 1
if axis["name"] in pixel_sizes:
svalue = zooms[axis["name"]] * pixel_sizes[axis["name"]]["value"]
scales[axis["name"]] = svalue
pixel_size = pixel_sizes[axis["name"]].get("value", 1)
scales.append(zooms[axis["name"]] * pixel_size)
# ...with a single 'scale' transformation each
if len(scales) > 0:
transformations.append([{"type": "scale", "scale": scales}])
# NB we rescale X and Y for each level, but not Z
transformations.append([{"type": "scale", "scale": scales}])
# NB we rescale X and Y for each level, but not Z, C, T
zooms["x"] = zooms["x"] * multiscales_zoom
zooms["y"] = zooms["y"] * multiscales_zoom

Expand Down

0 comments on commit ad3ac1e

Please sign in to comment.