Converting to a TIFF image

Converting to a TIFF image

Tagged Image File Format, abbreviated TIFF or TIF, is a computer file format for storing raster graphics images.Also it is a flexible, adaptable file format for handling images and data within a single file, by including the header tags.
A TIFF file can contain a sequence of images (IFD). Typically, all the images are related but represent different data, such as the pages of a document.
This allows the images to be defined along a tree structure. Each image can have a sequence of children, each child being itself an image. The typical usage is to provide thumbnails or several resolutions of an image(pyramid).
A TIFF image may also be composed of a number of tiles. All tiles in the same image have the same dimensions and may be compressed independently of the entire image. More information at Wikipedia

Using the API of PMA.start, one can convert a digital slide to a tiled and pyramidical Tiff file, where each pyramid level is stored as a different TIFF directory.

You can try this yourself by downloading an example python program that converts a slide to an TIFF image file.

Before you run the program, make sure that the following packages have been installed using the pip command:

  • numpy
  • requests
  • gdal
  • PIL

To install gdal on windows easily you can download the appropriate wheel file from the Unofficial Windows Binaries for Python Extension Packages.

Make sure you have selected the file corresponding to your python version and architecture e.x. GDAL‑2.2.4‑cp36‑cp36m‑win_amd64.whl for a Python 3.6.1 running on Windows x64.

You can install the wheel file with the familiar pip command:

pip install pathtodownloadfolder/GDAL‑2.2.4‑cp36‑cp36m‑win_amd64.whl

where `pathtodownloadfolder` is the folder where the wheel file is located.

To run the script issue the following command:
python totiff.py "D:/MySlides/slide.mrxs"
Once conversion is complete, you can even see the final tiff using PMA.start of course