-
Notifications
You must be signed in to change notification settings - Fork 10
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
load_image_wrapper returns 5D data with channel_axis:1 #14
Conversation
Codecov Report
@@ Coverage Diff @@
## master #14 +/- ##
======================================
Coverage 0.00% 0.00%
======================================
Files 11 11
Lines 724 723 -1
======================================
+ Misses 724 723 -1
Continue to review full report at Codecov.
|
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.
love it. will definitely make things easier.
left a couple comments. but you can merge once you're ready (let me know if the merge button isn't available for you)
|
||
|
||
@timer | ||
def get_data_lazy(image: ImageWrapper, c_index: int = 0) -> da.Array: | ||
"""Get n-dimensional dask array, with delayed reading from OMERO image.""" | ||
def get_data_lazy(image: ImageWrapper) -> da.Array: |
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.
proposal for trimming this down a bit?
@timer
def get_data_lazy(image: ImageWrapper) -> da.Array:
"""Get 5D dask array, with delayed reading from OMERO image."""
nt, nc, nz, ny, nx = [getattr(image, f'getSize{x}')() for x in 'TCZYX']
pixels = image.getPrimaryPixels()
dtype = PIXEL_TYPES.get(pixels.getPixelsType().value, None)
get_plane = delayed(timer(lambda idx: pixels.getPlane(*idx)))
def get_lazy_plane(zct):
return da.from_delayed(get_plane(zct), shape=(ny, nx), dtype=dtype)
# 5D stack: TCZXY
t_stacks = []
for t in range(nt):
c_stacks = []
for c in range(nc):
z_stack = []
for z in range(nz):
z_stack.append(get_lazy_plane((z, c, t)))
c_stacks.append(da.stack(z_stack))
t_stacks.append(da.stack(c_stacks))
return da.stack(t_stacks)
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.
will continue this discussion on ome/omero-py#227
'contrast_limits': contrast_limits, | ||
'name': names, | ||
'visible': visibles, | ||
'scale': scale, |
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.
while we're at it, we might want to add something to the {'metadata': ... }
field (in the met dict). That's a place where devs can put anything they want... we could drop the actual wrapper object there? or perhaps just the proxy string like "Image:1"?
Ultimately, I'm thinking down the road about saving ROIs and stuff back to the server. That's easy when we know we only have a single image open... but if we eventually allow multiple images to be open, we'll need to know which image the ROI corresponds to, and retaining some of the OMERO metadata will make it easier to know what our "options" are. thoughts?
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.
Created #16 so we don't have to decide before merging this
When loading OMERO image, instead of looping through Channels, getting metadata and lazy data for each in turn,
we now get the 5D data (regardless of whether this is a multi-Z or multi-T image) and a single dict with
channel_axis:1
This means that the data dimensions don't change and are consistent with the ome-zarr spec. Shape is
(t, c, z, y, x)
.