-
Notifications
You must be signed in to change notification settings - Fork 6
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
Extract attributes from ome-zarr rather than from metadata
(whenever possible)
#351
Comments
metadata
(whenever possible)
metadata
(whenever possible)metadata
(whenever possible)
Some notes, based on recent discussion on this issue. When looking at #212 (comment), the current issue concerns this item
What are the parameters that we'll need to extract?
Other
Note: this issue should also make the scope of |
Another note, about how to extract The zattrs file could look like {
"multiscales": [
{
"axes": [
{
"name": "c",
"type": "channel"
},
{
"name": "z",
"type": "space",
"unit": "micrometer"
},
{
"name": "y",
"type": "space",
"unit": "micrometer"
},
{
"name": "x",
"type": "space",
"unit": "micrometer"
}
],
"datasets": [
{
"coordinateTransformations": [
{
"scale": [
1,
1.0,
0.1625,
0.1625
],
"type": "scale"
}
],
"path": "0"
},
{
"coordinateTransformations": [
{
"scale": [
1,
1.0,
0.325,
0.325
],
"type": "scale"
}
],
"path": "1"
},
{
"coordinateTransformations": [
{
"scale": [
1,
1.0,
0.65,
0.65
],
"type": "scale"
}
],
"path": "2"
},
{
"coordinateTransformations": [
{
"scale": [
1,
1.0,
1.3,
1.3
],
"type": "scale"
}
],
"path": "3"
},
{
"coordinateTransformations": [
{
"scale": [
1,
1.0,
2.6,
2.6
],
"type": "scale"
}
],
"path": "4"
}
],
"version": "0.4"
}
],
"omero": {
"channels": [
{
"color": "00FFFF",
"label": "DAPI",
"wavelength_id": "A01_C01",
"window": {
"end": 800,
"max": 65535,
"min": 0,
"start": 110
}
}
],
"id": 1,
"name": "TBD",
"version": "0.4"
}
} The parameter extraction then should proceed as follows:
This kind of function should belong to |
A final note, which is just a reminder: this kind of operations (reading ome-ngff metadata and extracting a few parameters) would greatly benefit from a structured model, ref |
Great summary!
Wouldn't that be for num_levels=1? num_levels=0 should probably raise an error, no? Then also num_levels>1 And on coarsening: Do we round to nearest integer? I wonder whether there's a potential for floating point imprecision here. Or at least make the check for homogeneous values robust again minor differences. |
Of course, thanks. This comes the bias of 0-based indexing.. ;)
It clearly must be an integer, and I don't see obvious problem with the "nearest" rounding (e.g. via Python If we make some (reasonable, I'd say) assumptions that:
then I don't see room for ambiguity. Note, for instance, that in #76 we introduced a floating point imprecision of 3e-17 (relative to 0.1625). Let's hugely exaggerate this, and make it 1e-3 (which is a huge 0.6% imprecision on the pixel size); even in this case, we are still safe:
|
Sounds good. Rules 1 & 3 make a lot of sense.
I have no idea how generalizable this will be in the OME-Zarrs. Would always work for ours. But is there a strong need to have such a constraint? Or can we just have a warning here? |
To clarify: I am not in proposing to enforce any of these assumptions 1-2-3 as an actual constraint (although we could choose to raise some warnings when appropriate). I was rather listing a set of assumptions on "typical" use cases that remove any doubt on rounding robustness.
This is not a Fractal issue, but a general one. If we express the pixel size with a huge number of relevant digits which are all meant to be there (e.g. the pixel size is 1 light year plus one micrometer), we cannot always expect arithmetic to work. In our case, we perform a single floating-point operation here (taking the ratio of two pixel sizes) and then only use integers for comparisons, so that I don't expect any issue even in the light-year-plus-micrometer scenario, but I was just saying that if pixel sizes are in a "reasonable" range then we are even safer. |
Sounds good. Happy with warnings for some of those scenarios :) |
Main part: Read the relevant metadata from the .zattrs files into the metadata dictionary, should require very little compute.
Having it as a separate task may be the easiest first implementation. But longer-term, would be neat to have this more abstract, e.g. that any task that takes an OME-Zarr as its input can use that functionality if not metadata dictionary is provided.
The text was updated successfully, but these errors were encountered: