Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiscale method in write_images ignored (e.g. nearest vs gaussian) #254

Open
maweigert opened this issue Feb 22, 2023 · 1 comment
Open

Comments

@maweigert
Copy link

Hi,

It seems that writing an image pyramid always uses nearest downsampling even if a different method is provided (e.g. gaussian):

mip = scaler.nearest(image)

Changing this line to

mip = getattr(scaler, scaler.method)(image)

might already be enough.

Example:

import numpy as np
from ome_zarr.scale import Scaler
from ome_zarr.writer import write_image
import zarr
x = np.random.uniform(0,1,(100,100))

store = parse_url('foo1.zarr', mode="w").store
root = zarr.group(store=store)
write_image(image=x, group=root, axes="yx", storage_options=dict(overwrite=True), scaler=Scaler(method='nearest'))

store = parse_url('foo2.zarr', mode="w").store
root = zarr.group(store=store)
write_image(image=x, group=root, axes="yx", storage_options=dict(overwrite=True), scaler=Scaler(method='gaussian'))

print(np.abs(np.asarray(zarr.open('foo1.zarr/')[1])-np.asarray(zarr.open('foo2.zarr/')[1])).max())
@toloudis
Copy link
Contributor

There is also the use of order=1 in this line (used in the case of dask arrays): https://github.com/ome/ome-zarr-py/blob/master/ome_zarr/scale.py#L153

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants