Skip to main content

Crate openreadout_ometiff

Crate openreadout_ometiff 

Source
Expand description

OME-TIFF writer: BigTIFF container (via the tiff crate) plus an OME-XML 2016-06 document in the first IFD’s ImageDescription. Every export is written to a temporary file, read back plane by plane and hash-compared to the source before it is renamed into place. The source file is never opened for writing.

OME-TIFF is the open microscopy exchange format: an ordinary (here: Big)TIFF file with one page per plane and the full acquisition metadata as OME-XML, readable by Fiji, napari, QuPath, Bio-Formats and most image software.

§Example

use std::path::Path;

use openreadout_core::{Dataset, Result};
use openreadout_ometiff::{Codec, ExportOptions, export_ome_tiff};

/// Write channel 0 of every image of an opened file as LZW-compressed OME-TIFF.
fn channel0_to_ome_tiff(dataset: &mut dyn Dataset, input: &Path) -> Result<()> {
    let mut options = ExportOptions::default();
    options.select = vec!["c=0".into()];
    options.codec = Codec::Lzw;
    let report = export_ome_tiff(dataset, input, Path::new("channel0.ome.tiff"), &options)?;
    assert!(report.verified); // every plane was read back and hash-compared
    Ok(())
}

Re-exports§

pub use omexml::WrittenImage;
pub use omexml::build_ome_xml;
pub use omexml::build_ome_xml_metadata_only;
pub use pyramid::PyramidMode;

Modules§

omexml
OME-XML (schema 2016-06) document builder for the ImageDescription tag. Spec: https://www.openmicroscopy.org/Schemas/OME/2016-06 (open standard).
pyramid
Streaming multi-resolution export: a plane (or a rectangle of it) is read block by block and handed to a BlockSink level by level, so an image of any size is written in bounded memory.

Structs§

ExportOptions
Export options.
ExportReport
What export reports.
WrittenLevels
Resolution levels written for one image by a tiled export.

Enums§

Codec
Compression codec for the TIFF strips.

Constants§

DEFAULT_TILE
Default tile edge of tiled OME-TIFF output.

Functions§

export_ome_tiff
Export ds (already opened from input) to an OME-TIFF at output.
export_ome_tiff_with
export_ome_tiff with parallel plane decoding and progress reporting: planes are decoded by worker threads (extra handles from ctx.opener) and written sequentially in the same order, so the file is byte-identical whatever the number of threads.
no_images_error
The error for an image export of a file that holds no images (a VSI without its folder of .ets pixel files, for example). writer names the export, as in Error::unsupported. The file’s first note usually says why, so it goes in the message.
refused_images
Without --image, the images whose planes the reader refuses (Dataset::pixels_refused): they are left out of the export and listed. When that would leave nothing, none are left out, so the reader’s error says why.