Closed martinschorb closed 7 months ago
It even accepts a list of empty strings for the pixel size. This leads to a crash in the viewer but still a properly validating source.
I think this is where it happens:
it's the *
operator acting on str
instead of a number.
@constantinpape I would suggest adding a conversion of a potential str
to float
maybe one level higher in write_format_metadata
and a type check throwing an error if that conversion does not succeed.
any objections? I will make a PR otherwise.
with the schema https://github.com/ome/ngff/blob/main/0.4/schemas/image.schema asking for a number:
"coordinateTransformations": {
"type": "array",
"minItems": 1,
"contains": {
"type": "object",
"properties": {
"type": {
"type": "string",
"enum": [
"scale"
]
},
"scale": {
"type": "array",
"minItems": 2,
"items": {
"type": "number"
}
}
it means that strings are not meant to end up in there anyway (even though the Fiji Viewer seems to load them).
Do you have any plans to include a metadata validation for the sources? This would probably have caught here.
@constantinpape I would suggest adding a conversion of a potential
str
tofloat
maybe one level higher inwrite_format_metadata
and a type check throwing an error if that conversion does not succeed.
Yes, that's a good idea. Please go ahead with a PR!
Do you have any plans to include a metadata validation for the sources? This would probably have caught here.
Yes, we should include it. I don't have time to look into this myself now, but a PR on that would be very welcome.
The best place to add it would be here: https://github.com/mobie/mobie-utils-python/blob/master/mobie/validation/metadata.py#L62
fixed with above PRs.
Hi @constantinpape ,
when I provide the pixel size as
list(str)
the downscaling workflow produces strange pixel size metadata:.zattrs
:The project validates correctly, but in the viewer things go nuts ;-)
Should we check for the pixel size being numeric? Or would you rather change the way it writes the downsampled scale? The array data is fine. It is really just the metadata that's screwed.