Biomedical Imaging
This section is under construction and will appear in Academy very soon. Please stay tuned and contact us if you have any questions we can answer in the meantime.
TileDB provides support for importing, visualizing, analyzing, and exporting multi-resolution whole-slide microscopy images. TileDB’s BioImaging features include:
- Integrated ingestion, viewer, data management, access control, and computation for bioimaging datasets within the TileDB user interface.
- Includes support for fast batch ingestion of large image sets from Amazon S3 or any supported storage system using TileDB Task Graphs.
- Python APIs for ingesting images to TileDB BioImage arrays, slicing them with NumPy array semantics, or reading them via an OpenSlide Python-compatible API. Unlike the canonical OpenSlide Python API implementation, the TileDB drop-in API may be used with images assets stored by TileDB on any supported object store.
Ingestion
To get started with bioimages on TileDB, start up a TileDB notebook with the Genomics
environment, and import the TileDB BioImage package:
import tiledb.bioimg
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:
=0) OMETiffConverter.to_tiledb(src, dest, level_min
=0) OpenSlideConverter(src, dest, level_min
Batched ingestion
TileDB includes functionality for large-scale ingestion from images stored in an Amazon S3 bucket or other supported object store.
import tiledb.bioimg
# `images` will be converted in bulk using
# `dest` as the base output path.
=images, output=base_dest) tiledb.cloud.bioimg.ingest(source
Chunked ingestion
Check out the demo notebook on TileDB Cloud.
Read image data
You may read image data with the TileDB Python Array API directly, or by using the OpenSlide Python-compatible API.
OpenSlide Python API
from tiledb.bioimg.openslide import TileDBOpenSlide
# Construct OpenSlide API wrapper
= TileDBOpenSlide(tiledb_image_path)
img
# Read image data at `level`
# from starting `(x0,y0)` location to
# `(x + size_x, y + size_y)`
# Returns NumPy array
= img.read_level((x0, y0), level, (size_x, size_y)) data
Visit the OpenSlide Python API documentation for all available commands.
Visualization
You can preview bioimaging assets within the built-in viewer in the TileDB user interface.
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 within the 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)
Integrations
TileDB maintains integrations with several related tools and libraries.
Machine learning
The TileDB ML library includes support for loading images into PyTorch and TensorFlow.
Napari
TileDB maintains an integration with Napari via the napari-tiledb-bioimg plugin. This plugin supports visualization and analysis of TileDB BioImage datasets using Napari tools, with datasets loaded from TileDB and any supported storage system. (see the [demo video] on the repository README).
Install via the Napari plugin manager by searching for “TileDB” in the Napari plugin manager, 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.