Skip to content

Do not store zero time increment values in coordinateTransforms#281

Merged
melissalinkert merged 3 commits intoglencoesoftware:masterfrom
sbesson:scale_time_positive
Aug 6, 2025
Merged

Do not store zero time increment values in coordinateTransforms#281
melissalinkert merged 3 commits intoglencoesoftware:masterfrom
sbesson:scale_time_positive

Conversation

@sbesson
Copy link
Copy Markdown
Member

@sbesson sbesson commented Aug 5, 2025

Fixes #280

While the OME model allows any floating point value for the time increment, a 0 value in the scale transformation in the coordinateTransforms can create confusion when interpreted as a downsampling factor between resolutions

Using the sample file provided in the corresponding issue, bioformats2raw should produce an OME-Zarr dataset where the scale transformation includes a 0.0 value for the time axis.
With this change included, PixelsTimeIncrement values of zero should be ignored and the scale arrays should use the default 1.0

While the OME model allows any floating point value for the time
increment, a 0 value in the scale transformation in the
coordinateTransforms can create confusion when interpreted as a
downsampling factor between resolutions
Copy link
Copy Markdown
Member

@melissalinkert melissalinkert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense to me (nitpicky comment aside 😄).

Separately, I am a little surprised that setting 0 was allowed, and wonder why TimeIncrement is xsd:float in OME-XML schema in the first place. All of the other units are PositiveFloat, and having TimeIncrement as PositiveFloat as well would have avoided this problem in the first place. I don't remember and can't easily find a reference to any discussion, but it would be interesting to know if there is a use case for non-positive TimeIncrement values that might have motivated that type difference. Or maybe it's just that time is the only non-physical dimension with units? In any case, that's outside the scope of this pull request.

return meta.getPixelsTimeIncrement(seriesIndex);
Quantity timeIncrement = meta.getPixelsTimeIncrement(seriesIndex);
if (timeIncrement != null && timeIncrement.value().doubleValue() > 0) {
return meta.getPixelsTimeIncrement(seriesIndex);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any reason not to just return timeIncrement here instead of calling the getter again?

@melissalinkert melissalinkert merged commit 530e28b into glencoesoftware:master Aug 6, 2025
4 checks passed
@sbesson sbesson deleted the scale_time_positive branch August 15, 2025 14:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Zeros output for coordinateTransforms time scale

2 participants