Skip to content

Fix KLB data offset, FCS 3.2 and long TEXT, mzML model, BDV descending patterns (0.7.1) - #6

Merged
aaronkanzer merged 2 commits into
mainfrom
fix/klb-offset-bdv-descending
Oct 23, 2026
Merged

aaronkanzer merged 2 commits into
mainfrom
fix/klb-offset-bdv-descending

Conversation

@aaronkanzer

Copy link
Copy Markdown
Member

Bugs found by cross-checking these decoders against other readers. The FCS, mzML and BDV fixes match Scigantic/scigantic-edge#12.

KLB
dataOffset was 319, the end of the fixed header. The KLB header is followed by a uint64 offset table with one entry per block, so the blocks start at 319 + 8 x the block count. On the OME sample img.klb (2 x 2 x 4 = 16 blocks), that is 447. A bzip2 stream (BZh) starts at byte 447, and 447 plus the table's last end offset is the file size, 382,141 bytes. The golden fixture and test_real_sample_values asserted 319 and are updated.

FCS

  • FCS3.2 files were rejected.
  • A TEXT segment longer than the read returned None. The read is now 1 MiB. If TEXT still runs past it, the keywords that were read are decoded, the part the cut lands in is dropped, and textTruncated is set.

mzML
The instrument model was the first cvParam in the instrument configuration. In msconvert output that is the ion source ("electrospray ionization"), because msconvert keeps the model in a referenceableParamGroup. The decoder now follows the reference, skips the serial number and customization params, and never reads the model from the component list. On 54 real and test mzML files, 8 now report the right model, and none change otherwise.

BigDataViewer XML
A pattern range ending below its start, such as 9-4, counts down the way spimdata's IntegerPattern does, instead of reading as unknown. The existing 3-1 case asserted None and now expects 3.

Tests
tests/test_fcs.py ended with a module-level pytest.importorskip("flowio"), which skipped every FCS test in the file whenever flowio was missing. It isn't in the dev extras, so those tests did not run by default. The skip now covers only the flowio cross-check.

The suite goes from 452 to 479 passed (2 skipped). The 11 new or changed checks fail on main. With flowio installed, all 21 FCS tests pass.

CHANGELOG has an Unreleased entry. The version is not bumped.

…g patterns

- KLB: dataOffset now counts the block offset table (319 + 8 per block). On
  the OME sample img.klb it is 447, where the first bzip2 block starts.
- FCS: accept FCS3.2; read 1 MiB; decode a TEXT segment longer than the read
  as far as it goes and set textTruncated instead of returning None.
- mzML: follow referenceableParamGroupRef to the instrument model (msconvert
  output), skip the serial number, and never take the model from the
  component list, which reported the ion source as the instrument.
- BDV XML: a timepoint range ending below its start counts down, as spimdata
  does.
- tests: a module-level importorskip("flowio") skipped every FCS test when
  flowio was missing; it now skips only the flowio cross-check.
@aaronkanzer aaronkanzer changed the title Fix KLB data offset, FCS 3.2 and long TEXT, mzML model, BDV descending patterns Fix KLB data offset, FCS 3.2 and long TEXT, mzML model, BDV descending patterns (0.7.1) Oct 23, 2026
@aaronkanzer
aaronkanzer merged commit 557b1fe into main Oct 23, 2026
3 checks passed
@aaronkanzer
aaronkanzer deleted the fix/klb-offset-bdv-descending branch October 23, 2026 11:18
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