Skip to content

Fix LIF row padding with mixed memory blocks#4447

Open
cgohlke wants to merge 1 commit into
ome:developfrom
cgohlke:patch-1
Open

Fix LIF row padding with mixed memory blocks#4447
cgohlke wants to merge 1 commit into
ome:developfrom
cgohlke:patch-1

Conversation

@cgohlke

@cgohlke cgohlke commented Jun 29, 2026

Copy link
Copy Markdown

This PR improves plane reading robustness especially for LIF files where non-image memory blocks (for example, timestamps) are interleaved with image data:

  • Prefer explicit per-row stride from BytesInc metadata when available, instead of inferring row padding from adjacent memory block offsets.
  • Keep inferred-gap logic only as a legacy fallback when row stride metadata is unavailable.
  • Restrict fallback padding inference to rows that are not naturally 4-byte aligned (based on row bytes, not pixel width).
  • Clamp inferred fallback padding to non-negative values.

See https://forum.image.sc/t/problems-reading-some-widefield-leica-lif-files-with-bioformats-in-fiji/121584 for the original bug report and a test file.

@cgohlke

cgohlke commented Jun 29, 2026

Copy link
Copy Markdown
Author

Note that I have changed the fallback condition from getSizeX() % 4 to (getSizeX() * bpp) % 4. I didn't quite understand the original intent, neither am I sure if the fallback is still necessary...

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.

1 participant