Python: display the images contained in the different directories inside a TIFF image

102 Views Asked by At

How can I display the image (pixel data) of the different directories inside a single tiff file?

I have several tiff-based files (of format ndpi, svs, bif, etc these are digital pathology images) each of which contain a pyramidal-like structure of Image File Directories. When I run tiffinfo or tiffdump on these images I am informed of the different directories present. e.g.

when running tiffinfo my_file I get the following output

TIFF Directory at offset 0x898b0f0 (144224496)
  Subfile Type: (0 = 0x0)
  Image Width: 6473 Image Length: 6296 Image Depth: 1
  Tile Width: 240 Tile Length: 240
  Bits/Sample: 8
  Compression Scheme: 33005 (0x80ed)
  Photometric Interpretation: RGB color
  Samples/Pixel: 3
  Planar Configuration: single image plane
  ImageDescription: Aperio Image Library v12.0.15 
26416x25286 [0,100 25895x25186] (240x240) -> 6473x6296 J2K/KDU Q=70
TIFF Directory at offset 0x89d39e4 (144521700)
  Subfile Type: (0 = 0x0)
  Image Width: 1618 Image Length: 1574 Image Depth: 1
  Tile Width: 240 Tile Length: 240
  Bits/Sample: 8
  Compression Scheme: 33005 (0x80ed)
  Photometric Interpretation: RGB color
  Samples/Pixel: 3
  Planar Configuration: single image plane
  ImageDescription: Aperio Image Library v12.0.15 
26416x25286 [0,100 25895x25186] (240x240) -> 1618x1574 J2K/KDU Q=70
TIFF Directory at offset 0x8a87fc0 (145260480)
  Subfile Type: reduced-resolution image (1 = 0x1)
  Image Width: 739 Image Length: 704 Image Depth: 1
  Bits/Sample: 8
  Compression Scheme: LZW
  Photometric Interpretation: RGB color
  Samples/Pixel: 3
  Rows/Strip: 3
  Planar Configuration: single image plane
  ImageDescription: Aperio Image Library v12.0.15 
label 739x704
  Predictor: horizontal differencing 2 (0x2)

How can I now use a Python library to visually inspect the images of each TIFF directories?

0

There are 0 best solutions below