Skip to main content

Crate kfb2zarr

Crate kfb2zarr 

Source
Expand description

Read KFBio whole-slide image files (.kfb, .kfbf) and convert them to OME-Zarr v0.4 (Zarr v2).

Two entry points:

  • KfbReader — opens a KFBio file and exposes its header, tile index, and associated images.
  • convert_to_zarr — decodes all JPEG tiles in parallel and writes a multi-resolution OME-Zarr v0.4 store.

Pure Rust, no C dependencies. JPEG decoding via zune_jpeg. Physical coordinate transforms come from the MPP value in the file header.

§Examples

§Convert a KFBio file to OME-Zarr

use std::path::Path;
use kfb2zarr::convert_to_zarr;

convert_to_zarr(Path::new("slide.kfb"), Path::new("slide.ome.zarr"))?;

§Inspect metadata without converting

use std::path::Path;
use kfb2zarr::KfbReader;

let reader = KfbReader::open(Path::new("slide.kfb"))?;
let header = reader.header();
println!("dimensions: {}x{}", header.base_width(), header.base_height());
println!("mpp: {}", header.mpp());
println!("tiles: {}", reader.tiles().len());

Re-exports§

pub use error::KfbError;
pub use reader::KfbReader;
pub use types::AssociatedImage;
pub use types::AssociatedImageKind;
pub use types::ChannelMetadata;
pub use types::KfbHeader;
pub use types::TileInfo;

Modules§

error
reader
types

Functions§

convert_to_zarr
Read a .kfb file and write an OME-Zarr v0.4 hierarchy to output.