-
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
Add image-label convenience functions #178
Conversation
Codecov Report
@@ Coverage Diff @@
## master #178 +/- ##
==========================================
+ Coverage 83.99% 84.08% +0.09%
==========================================
Files 12 12
Lines 1362 1376 +14
==========================================
+ Hits 1144 1157 +13
- Misses 218 219 +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.
Thanks. That's a great starting point to introducing some functionalities allowing to write label images. A couple of inline design questions mostly about the new label writing.
Thinking of other use case, @will-moore we also have some code in omero-cli-zarr
writing label images from OMERO masks. Would the new API be flexible enough to e.g. delegate some of the label creation logic to ome_zarr.writer
?
As suggested by the codecov report, I think we want to introduce some unit tests covering the semantics of the new API and testing the metadata is correctly stored.
…ome-zarr-py into more-convenience
for more information, see https://pre-commit.ci
@sbesson I have changed a few things based on your review:
I decided not to implement What's left to do:
One more question: |
Follow up for
|
Not at the moment. The steps to unlock this would be:
|
Looks good. I've started to consume this with |
I have added a test now and fixed the pre-commit. This is good to go from my side. Please let me now if you see the need for any more changes, @sbesson @will-moore.
Thanks for the pointers, @sbesson. I had a look at the two referenced issues and left comments. It would be great to get this in (and then use it in the tests or directly in the writers), but since the PRs seem to be stalled a bit it's probably better to go ahead and merge this issue first. |
Thanks for adding tests and fixing the linting issue. I agree not tie the API addition to this work and focus on getting it released so that we can gain experience consuming. I'll review the tests and the API more thoroughly tomorrow. |
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.
A few questions regarding the inferred types of arguments. Otherwise, I think the new API makes sense and allows to support the writing of extended metadata. The new API should already populate the recommended name
attribute. We can add additional tests covering more advanced scenarios such as examples compliant with the recommended specification in a follow-up PR.
The default test should cover the basic scenario of creating an image and an associated label image. Could we add another minimal scenario that creates two labels and checks that the attributes are correctly created e.g. the labels
attributes register both labels?
Similarly as above, follow-up PRs can add coverage for advanced image-label
properties such as colors
and properties
.
Thanks for the review, @sbesson.
I see two options for this: (i) add
Sounds good, I will add it now. For some reason I can't comment under the code comments you made (seems to be some github issue), so I will respond to the relevant ones here:
Adding
This is considered bad practice in python: https://docs.quantifiedcode.com/python-anti-patterns/correctness/mutable_default_value_as_argument.html |
I have extended the tests, the Test Coverage CI fails with "Server Error (500)", so most likely unrelated to the changes here. |
@constantinpape: I found codecov/codecov-action#557 which led to https://github.com/marketplace/actions/codecov
https://github.com/marketplace/actions/codecov#migration-from-v1-to-v2 Opened: #180 |
see testing in ome#180
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.
All looks good to me and I am inclined to have this new functionality available sooner rather than later so that we can start consuming it and potentially amending it based on real use cases.
Should we aim to release this immediately as ome-zarr 0.4.0
?
Thanks! I agree that we should have this out as soon as possible. But I think it would be a good idea to have a look at fixing and simplifying the
|
Fixes #176 and #171
This PR:
**metadata
acrosswrite_image
,write_multiscale
andwrite_multiscales_metadata
write_multiscale_image_labels
to createimage-label
data.For a usage example see https://github.com/ome/ome-ngff-prototypes/blob/update-ome-zarr-py/workflows/spatial-transcriptomics-example/convert_transcriptomics_data_to_ngff.py.
Still TODO:
Add(leave this for a follow-up todo and also clean upwrite_image_labels
(analogue towrite_image
) that useswrite_multiscale_image_labels
internallywrite_image
...)I will address the TODOs if we decide to go forward with these changes.
Side-note: some confusing / unclear things I noticed in the
image-labels
spec while working on this.