The Open Microscopy Environment’s OME-TIFF specification is a TIFF-based format designed for whole-slide microscopy designed to replace various proprietary formats. It essentially consists of a standard TIFF file with one or more images to create a stack or time series of microscopy images. In addition, OME-TIFF defines an XML metadata structure which provides information on the images within and how they relate to each other.
The TIFF format allows multiple images to be stored within a single TIFF file through the use of IFDs (Image File Directories). This is the same mechanism that allows multiple pages (or subfiles) to be stored in a single multi-page TIFF file. This functionality can also be exploited to allow multiple resolutions to be stored to create a tiled multi-resolution TIFF. However, the two features cannot easily be combined as they both require the use of IFDs.
The TIFF format, however, defines two categories of IFD. There are the classic IFDs that form part of the main IFD multi-page sequence. But it’s possible for IFDs to exist outside of this main sequence. These IFDs are known as SubIFDs and are linked to an IFD within the main multi-page sequence. Each page within a multi-page TIFF can have a list of SubIFDs which are linked to it. It is, therefore, possible to use this SubIFD mechanism to store the sub-resolutions of the multi-resolution pyramid and keep the separate pages of the image stack within the multi-page IFD sequence. The figure to the right shows the difference between the classic multi-resolution pyramid IFD structure for a single image (left) and how SubIFDs can be used to combine multiple images and sub-resolutions (right).
A number of approaches were considered for multi-resolution storage of OME-TIFF images and the the use of SubIFDs was that which was finally adopted by the OME Consortium. This now forms part of version 6.0 of the official OME-TIFF specification.
IIPImage has long been used for high resolution whole-slide microscopy (or virtual nanoscopy as it’s also known as). This guest blog post from 2012, for example, describes the use of IIPImage for ultra-large high resolution electron microscopy.
The ability to handle OME-TIFF style SubIFD multi-resolution pyramid TIFF has recently been added to the IIPImage server providing OME-TIFF compatibility and allowing multi-resolution OME-TIFF whole-slide image stacks to be used directly by IIPImage and accessed through any of IIPImage’s supported image API’s (IIP, IIIF, Deepzoom or Zoomify). Note, however, that the support for image stacks is currently limited to stacks that contain slices that are all of the same size.
Image Access
If the OME-TIFF contains a image stack, iipsrv will read the first slice by default. If you use the IIP protocol, the SDS
command can be used to specify a particular slice within the stack. For example, to view an image of the 5th slice of an image stack (SDS=0
is the first slice) in WebP format with a width of 500px:
http://your.server/fcgi-bin/iipsrv.fcgi?FIF=image.ome.tif&SDS=4&WID=500&CVT=WEBP
IIPImage’s image processing functionality can also be applied to these images. For example, to apply contrast stretching, add the parameter CNT=ST
:
http://your.server/fcgi-bin/iipsrv.fcgi?FIF=image.ome.tif&SDS=4&WID=500&CNT=ST&CVT=WEBP
Metadata
This OME-TIFF XML metadata is stored within the ImageDescription TIFF tag. IIPImage does not make use of this metadata itself, but the raw XML can be obtained from the OME-TIFF file for use by a viewer via the OBJ
command, which provides access to file metadata. Although the XML is stored in the TIFF ImageDescription field, iipsrv maps field names to more standard Dublic Core field names, which in this case is “subject”. Thus, to extract the OME-TIFF XML metadata for an image named image.ome.tif:
http://your.server/fcgi-bin/iipsrv.fcgi?FIF=image.ome.tif&OBJ=subject
Creating OME-TIFF Images
OME’s bio-formats is a standalone Java library for reading and writing life sciences image file formats. The bfconvert tool can be used to create tiled multi-resolution TIFF from any supported microscopy format. For example to create a tiled pyramid TIFF with 5 resolution levels, a tile size of 256×256, lossless Deflate compression and SubIFDs:
bfconvert -noflat -pyramid-resolutions 5 -pyramid-scale 2 -tilex 256 -tiley 256 -compression zlib input.tif output.ome.tif
The -noflat
parameter is necessary to create SubIFD sub-resolutions and the output format is determined by the suffix, so to generate OME-TIFF, the output must have the suffix .ome.tif
. The number of sub-resolutions must be specified manually using the -pyramid-resolutions
variable. This value will depend on the size of your image: make sure you create enough to have the final smallest resolution fit within a single tile.
For very large images, a faster solution is to use vips, which from version 8.10 onwards can be used to create a tiled multi-resolution pyramid TIFF with sub-resolutions stored within SubIFDs. This can be enabled by using the –subifd parameter. For example, to create the same output as with the above bfconvert command:
vips tiffsave input.tif output.ome.tif --tile --pyramid --compression deflate --tile-width 256 --tile-height 256 --subifd
Demo
This demo uses the Leaflet viewer together with the IIP plugin to enable full native access to IIPImage. The image is a single slice of 96999 x 45667 pixels in size, which was converted to SubIFD multi-resolution pyramid OME-TIFF format using vips. The image is the 77917.svs example (credit: Paul Felts, Creative Commons Attribution 4.0 International License) taken from the OME-TIFF image repository.