-
Notifications
You must be signed in to change notification settings - Fork 54
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
[WIP] Support plate loading for varying well sizes (ref #240) #241
base: master
Are you sure you want to change the base?
Conversation
for more information, see https://pre-commit.ci
Codecov ReportBase: 84.46% // Head: 82.94% // Decreases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## master #241 +/- ##
==========================================
- Coverage 84.46% 82.94% -1.52%
==========================================
Files 13 13
Lines 1474 1548 +74
==========================================
+ Hits 1245 1284 +39
- Misses 229 264 +35
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
Thanks for the PR: not having looked at the code yet, but one thought on how to choose the optimal loading mode... You could imagine an optional flag in the |
Thanks, great idea @will-moore on the Any idea why I would have tests failing on python 3.8 and 3.9 for parts that are not related to code changes I've made? Do you also see this in other places or should I dig through those tests to understand if there is any dependency (i.e. them using the plate writer somewhere?) |
From my side, there is definitely an argument for consolidating some metadata at the top-level especially for complex structures like plates. This echoes what was done for the
My primary issue is that this name is highly unspecific. Which dimensions are we talking about: all of the dimensions of each multiscale image? XY(Z) only? the channels? the number of fields of view per well? |
Good point. What I currently see is that if we can consolidate the pyramid shape informations on the plate level for each well, then I would not need to loop through all the wells and this implementation should be about as fast as the original one, just more general (i.e. handles the case when any of the dimensions aren't equal by padding).
Fair point. I'd see this as transitionary until we have the pyramid shape metadata at the plate level and thus this could become default loading behavior. I actually implement the checks for all the dimensions of an image (tczyx). If any well dimension is potentially unequal, one needs to load this metadata beforehand to figure it out. The expensive part is loading the additional metadata, then one can address any dimension that varies with padding. As such, it is actually a somewhat general solution to this. It doesn't address loading multi-field of view, as this also isn't a part of the current implementation for other reasons (and we switched to using single images for all field of views combined, see discussion here: ome/ngff#137). |
This pull request has been mentioned on Image.sc Forum. There might be relevant details there: https://forum.image.sc/t/napari-napari-ome-zarr-plugin-is-not-registered/78482/16 |
This pull request has been mentioned on Image.sc Forum. There might be relevant details there: https://forum.image.sc/t/napari-napari-ome-zarr-plugin-is-not-registered/78482/18 |
@jluethi : What's your plan with this PR? I moved it to milestone 0.8.0 to signify that it wasn't slotted for 0.7.0 but I don't want to put promises into your mouth :) |
Hey @joshmoore It does actually load the images though, instead of just crashing during loading. I see two options of how a cleaned-up version could actually be proposed to be merged: Either via a environment env flag set or with an optional flag set at the plate level. What's the rough 0.8.0 timeline anyway? |
There's no hard timeline for 0.8.0. It's more of on a need basis. But the metadata aggregation could require a spec change, no? |
Yes, I assume that would require a spec change. So I think a more performant version of this would only come after such a spec change. |
Seems like an environment flag is the easiest option (it doesn't need to be added to the plate data itself - good for old plates). Also it won't clash or be confused with future spec changes. |
Addresses #240, see there for a description of the issue
This PR adds a second code path to the
get_pyramid_lazy
function. Its goal is to load the metadata of each well to be able to check the pyramid sizes. It then handles varying well sizes by padding every well to the max well size.I kept the old code path in for the moment and added a
loading
parameter to theget_pyramid_lazy
where the user can specify "new" or "default" to make it easier to compare the two workflows. It's set to "new" at the moment, so this PR follows the new behavior by default for testing.What this PR should achieve:
Handles, but not optimal:
Downsides
The initial loading of a plate gets much slower with this PR. It introduces an overhead of ~1s per well in my setup. As such, if the assumptions hold that all wells have the same dimensions, this PR is a downgrade and thus should not be the default way to load plates.
2 thoughts on this:
get_plate_well_specs
, which is only called once.What this part would require is access to consolidate info about the image pyramid shapes.