Skip to main content

Crate openreadout_oif

Crate openreadout_oif 

Source
Expand description

Clean-room reader for Olympus FluoView OIF and OIB data sets (FV1000/FV1200/FV10i).

An OIF data set is a main .oif settings file (UTF-16 INI text) plus a <name>.oif.files folder of plane TIFFs, per-plane .pty property files, LUTs, ROIs and a thumbnail. An OIB file packs the same files into one OLE2 compound file (MS-CFB, read with the shared openreadout-core::cfb reader) with an OibInfo.txt stream mapping stream names to file names. Planes are decoded by the TIFF reader (openreadout-tiff).

Derived from hex dumps of corpus files and from the documentation and source of oiffile (BSD-3-Clause, Christoph Gohlke); Bio-Formats is run only as a black-box oracle. Layout and vocabulary: docs/formats/oif.md. Provenance: docs/provenance/oif.md.

§Example

Every reader implements openreadout_core::FormatReader: descriptor says what it reads, sniff recognises a file from its first bytes, and open returns a openreadout_core::Dataset with a header-only info() summary and lazy data access.

use openreadout_core::FormatReader;
use openreadout_oif::{OibReader, OifReader};

for format in [OibReader.descriptor(), OifReader.descriptor()] {
    println!("{} ({}): .{}", format.name, format.family, format.extensions.join(", ."));
}
assert_eq!(OibReader.descriptor().id, openreadout_oif::OIB_FORMAT_ID);

Reading a file:

use std::path::Path;

use openreadout_core::{FormatReader, PlaneIndex};
use openreadout_oif::OibReader;

let mut dataset = OibReader.open(Path::new("cells.oib"))?;
let info = dataset.info()?; // headers only
for image in &info.images {
    println!(
        "image {}: {} x {} px, {} channel(s), {} plane(s)",
        image.index, image.size_x, image.size_y, image.size_c, image.plane_count
    );
}
// Pixels are read one plane at a time: image 0, channel 0, first Z slice, first time point.
let plane = dataset.read_plane(0, PlaneIndex { c: 0, z: 0, t: 0 })?;
assert_eq!(plane.data.len(), plane.expected_len());

Applications that accept any instrument file usually register every reader in an openreadout_core::Registry and let it detect the format; that is what the openreadout command-line tool does.

§API stability

The supported API is what this page documents. The parser modules are public only so that tests and fuzz targets can reach them: they are hidden from this documentation and may change in any release.

Structs§

OibReader
The OIB (compound file) reader.
OifReader
The OIF (settings file plus data folder) reader.

Constants§

OIB_FORMAT_ID
Format id of OIB (single compound file) data sets.
OIF_FORMAT_ID
Format id of OIF (settings file plus .oif.files folder) data sets.

Functions§

looks_like_settings
Does this look like a FluoView settings file (UTF-16LE with a byte-order mark, then [)?