8

I'm using openslide-python to open a svs image, and I have run into the following issue:

>> import openslide as osi
>> a = osi.OpenSlide('image.svs')

yields the error

TIFFReadDirectory: Warning, Unknown field with tag 347 (0x15b) encountered.
image.svs: JPEG compression support is not configured.
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/manan/anaconda/lib/python2.7/site-packages/openslide/__init__.py", line 154, in __init__
    self._osr = lowlevel.open(filename)
  File "/home/manan/anaconda/lib/python2.7/site-packages/openslide/lowlevel.py", line 178, in _check_open
    raise OpenSlideError(err)
openslide.lowlevel.OpenSlideError: Unsupported TIFF compression: 7

I haven't been able to find any solutions online for this issue; I've checked libopenjpeg and any additional relevant libraries to ensure they are at their latest respective versions.

NoDataDumpNoContribution
  • 10,591
  • 9
  • 64
  • 104
manan
  • 1,385
  • 13
  • 23
  • You might want to file an issue at [their issue tracker](https://github.com/openslide/openslide-python/issues). – NoDataDumpNoContribution Jun 16 '16 at 12:20
  • 2
    It appears the svs format is a variation of standard TIFF. If that's the case, TIFF files can contain images of various compression types. If other svs files work but not this one, the problem could be related to compression. For more details on TIFF compression sub-types, see the answer to this post: http://stackoverflow.com/questions/28355389 – LEADTOOLS Support Jun 17 '16 at 21:15
  • 2
    Please provide the running environment means operating system, and libtiff, libjpeg versions – Renjith Thankachan Nov 28 '16 at 06:30
  • _Should_ be as simple as obtaining the TIFFlib source and compiling with all desired options configured. – greybeard Dec 02 '16 at 09:55
  • If you don't mind sharing the slide (if you have the rights to it) that could help too. – dnozay Dec 02 '16 at 16:07

1 Answers1

8

If you look at the code: https://github.com/openslide/openslide/blob/7b99a8604f38280d14a34db6bda7a916563f96e1/src/openslide-vendor-generic-tiff.c#L222-L226

if (!TIFFIsCODECConfigured(compression)) {
  g_set_error(err, OPENSLIDE_ERROR, OPENSLIDE_ERROR_FAILED,
              "Unsupported TIFF compression: %u", compression);
  goto FAIL;
}

You will see that it uses libtiff: the function TIFFIsCODECConfigured is provided by the underlying libtiff library (see man page).

The compression tag is set to 7; this is the uncommonly supported JPEG ('new-style' JPEG) compression scheme - sometimes also referred as JPEG-in-TIFF; which you need to install a codec for.

If you still have the slides and used e.g. Kodak Imaging, then you may be able to scan them again with a different compression; but that would be a back-and-around way. It probably is easier to try and add the codec and enable it in libtiff.

From libtiff documentation:

Support for JPEG compression is controlled by JPEG_SUPPORT. The JPEG codec that comes with libtiff is designed for use with release 5 or later of the Independent JPEG Group's freely available software distribution. This software can be retrieved from the directory ftp.uu.net:/graphics/jpeg/.

So the support is optional, and you may need to rebuild libtiff (see instructions).

By default JPEG support is not configured.

References:

dnozay
  • 23,846
  • 6
  • 82
  • 104