-
Notifications
You must be signed in to change notification settings - Fork 43
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
Zarr Tile Sink #1446
Zarr Tile Sink #1446
Conversation
I was playing with this a little, trying to replace a custom data collector with this branch. I was expecting the class properties |
…`_framecount` in `addTile`
…cessary usage of `create_dataset`
# Edit OME metadata | ||
self._zarr.attrs.update({ | ||
'multiscales': [{ | ||
'version': '0.5-dev', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I haven't checked ome zarr docs for version information. Are we more conformant to a dev version than the latest official version?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was just following what I found here: https://ngff.openmicroscopy.org/latest/#multiscale-md, but I'm not entirely confident that this is all correct.
With #1477, there are now some tests that can be enabled. Uncomment the two parametered tests on lines |
axes[0:0] = [k] | ||
self._axes = {k: i for i, k in enumerate(axes)} | ||
while len(tile.shape) < len(axes): | ||
tile = np.expand_dims(tile, axis=0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It occurred to me this could be done without an explicit while loop. I think the equivalent would be:
if len(tile.shape) < len(axes):
tile = np.expand_dims(tile, axis=tuple(range(len(axes) - len(tile.shape))))
if mask is not None and len(mask.shape) < len(axes):
mask = np.expand_dims(mask, axis=tuple(range(len(axes) - len(mask.shape))))
I'm not sure that is clearer, though.
self._addLock = threading.RLock() | ||
self._framecount = 0 | ||
self._mm_x = 0 | ||
self._mm_y = 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should probably add self._levels = []
here and a test that just does
sink = large_image_source_zarr.new()
assert sink.metadata['levels'] == 0
assert sink.getRegion(format=TILE_FORMAT_NUMPY)[0].shape[:2] == (0, 0)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, added in 157c731
axes = [x.lower() for x in axes] | ||
if axes[-1] != 's': | ||
axes.append('s') | ||
if mask is not None and len(axes) - 1 == len(mask.shape): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs to be outdented (not in the if axes[-1]
clause).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. Moved in 62e6572
Let's add a mask test:
This will fail because of caching. In the vips source we have and do |
This PR makes changes to the Zarr tile source to allow the user to write new N-dimensional files. This includes the addition of
new
,addTile
, andwrite
methods.This PR also rewrites
test/test_sink
to copy data fromTestFileTileSource
rather than randomly generate data.TODOs:
Future Work:
large_image.new()
picks the most preferred one installed