openmicroscopy/bioformats — pull request #1353 by seb-berger (2014-09-24 13:57:02+00:00)
Title: KodakReader: Bugfix and file info metadata

This patch fixes a bug in KodakReader.findString(String marker) and provides file information text extraction.

1. Bugfix
KodakReader.findString(String marker) fails if marker lies within the last 8192 byte of the file. Fix: Take into account that file size is not necessarily a multiple of 8192.

2. Extracting file information text
BIP files can contain an user-defined information text. In order to have this text availiable when using BioFormats, I reverse-engineered the file format a little. Here's what I found:

- "DLFi" marks the beginning of a data chunk containing the information text
- At 20 bytes offset, a 4 byte big endian integer encodes the overall chunk size (including "DLFi")
- At 24 bytes offset, the actual text begins
- The text is padded by lots of leading and trailing zero bytes.

We successfully tested this implementation while analyzing a set of about 50 BIP images using ImageJ. I just uploaded an example image file via your QA system.

I'm still unsure about a few things, though:
- Is using MetadataStore.addGlobalMeta() the way to go?
- In absence of an "DLFi" tag: Should I export "FileInfo" with an empty string or export nothing at all?
- Should I call getMetadataOptions().getMetadataLevel() as seen in KodakReader.readExtraMetadata()?