BioImaging

Table of contents

Overview

TileDB provides a set of tools for working with multi-resolution whole-slide microscopy images.

  • TileDB Cloud BioImaging: integrated viewer, data management, access control, and computation for bioimaging datasets.

    • Includes support for fast batch ingestion of large image sets from AWS S3 or any supported storage system using TileDB Task Graphs.

  • TileDB-BioImg: Python package for ingesting images to TileDB image arrays.

    • Includes support for chunked ingestion of larger-than-memory images.

    • OpenSlide Python API: this package additionally provides an OpenSlide Python-compatible API which may be used with image-groups stored using any TileDB backend.

  • napari-tiledb-bioimg: Napari Plugin for loading TileDB BioImage arrays, supporting visualization of pyramidal images and analysis using Napari tools and plugins.

Ingestion

To get started with TileDB bioimaging, install the tiledb-bioimg package from the Python Package Index:

pip install tiledb-bioimg[full]

To use tiledb-bioimg in a Python program, import the converters from the tiledb.bioimg namespace:

# Python
from tiledb.bioimg.converters.ome_tiff import OMETiffConverter
from tiledb.bioimg.converters.openslide import OpenSlideConverter

Each converter provides a to_tiledb function taking a source path and storage destination for the converted TileDB multi-resolution image group. For example:

OMETiffConverter.to_tiledb(src, dest, level_min=0)
OpenSlideConverter(src, dest, level_min=0)

Large-scale Ingestion

Batched Ingestion using TileDB Cloud

Check out the demo notebook on TileDB Cloud.

TileDB Cloud includes utilities for large-scale ingestion from images stored in an AWS S3 bucket or other supported object store.

First, install the TileDB-Cloud-Py package, and :

pip install tiledb-cloud

Next, use the tiledb.cloud.bioimg.ingest function:

# `images` will be converted in bulk using
# `dest` as the base output path.
tiledb.cloud.bioimg.ingest(
    source=images,
    output=base_dest)

Chunked Ingestion for very large images

Check out the demo notebook on TileDB Cloud.

Reading Image Data

Image data may be read with either the OpenSlide Python-compatible API, or using the TileDB-Py API directly.

OpenSlide Python API

from tiledb.bioimg.openslide import TileDBOpenSlide

# Construct OpenSlide API wrapper
img = TileDBOpenSlide(tiledb_image_path)

# Read image data at `level`
#   from starting `(x0,y0)` location to
#   `(x + size_x, y + size_y)`
# Returns NumPy array
data = img.read_level((x0, y0), level, (size_x, size_y))

See the TileDBOpenSlide OpenSlide Python API documentation for all available commands on the

Visualization

TileDB Cloud

Please get in touch if you are interested in a demo! Public preview coming soon.

Napari

The napari-tiledb-bioimg plugin provides support for opening TileDB bioimage-arrays in the Napari visualization and analysis platform. (see the [demo video] on the repository README).

Install via the Napari plugin manager by searching for "TileDB", or install with pip inside of a Napari Python environment:

pip install napari-tiledb-bioimg

Something else?

Please get in touch if you are interested working with TileDB BioImages in other visualization software, or specific analysis tools.

Storage Format

TileDB-BioImg stores multi-resolution images as a group of arrays, with one dense array per resolution level. For example, given an input TIFF file with three resolution layer pages:

2132x2488
4266x4978
17068x19918

The following directory structure will be created:

Image.tdb      # TileDB Group
  |- l_0.tdb   # TileDB Array, 17068x19918
  |- l_1.tdb   # TileDB Array, 4266x4978
  |- l_2.tdb   # TileDB Array, 2132x2488

Image-level metadata is stored as TileDB Group metadata, and individual level metadata is stored with resolution-level array.

Utilities

Export to OME Formats

The TileDB BioImg library provides a utility function to export a TileDB BioImage to several OME formats.

# Export TileDB BioImg to an OME-TIFF file
OMETiffConverter.from_tiledb(tiledb_img_path, output_path)

# Export TileDB BioImg to an OME-Zarr directory
OMEZarrConverter.from_tiledb(tiledb_img_path, output_path)

Last updated