Backends
Backends#
Dlup supports several backends to read whole-slide images. Currently available are:
By default SlideImage, which represents a single whole slide image will read the image using openslide. Remember that you can instantiate it by using the path to the WSI file with:
import dlup
from dlup.experimental_backends import ImageBackends
wsi = dlup.SlideImage.from_file_path("checkerboard.svs", backend=ImageBackends.OPENSLIDE)
The other options are ImageBackends.PYVIPS, ImageBackends.TIFFFILE and ImageBackends.AUTODETECT.
In case AUTODETECT is selected and in case the image ends with .tif or .tiff dlup will try to read a region with pyvips and next with tifffile in case the previous fails. If not autodetect will continue by trying openslide and pyvips. The results of this computation are cached, so next time one tries to read the same WSI file, the same backend will be selected.
Warning
There are minor differences in how openslide and pyvips read the same files, and there might me minor pixel misalignments between the two at different levels. In addition, openslide will always return an RGBA image, regardless whether the original image has an alpha channel or not. pyvips on the other hand will output the data type of the underlying WSI. This can lead to differences in the number of channels depending on the backend.