不支持的 TIFF 压缩

Unsupported TIFF Compression

我正在使用 openslide-python 打开一张 svs 图片,我 运行 遇到了以下问题:

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

产生错误

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

我无法在网上找到任何解决此问题的方法;我检查了 libopenjpeg 和任何其他相关库,以确保它们处于各自的最新版本。

如果您查看代码: 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;
}

您会看到它使用 libtiff:函数 TIFFIsCODECConfigured 由基础 libtiff 库提供(参见 man page)。

压缩标签设置为7;这是不常见的支持 JPEG ('new-style' JPEG) 压缩方案 - 有时也称为 JPEG-in-TIFF;您需要为其安装编解码器。

如果您还有幻灯片并使用过,例如Kodak Imaging,然后您可以使用不同的压缩方式再次扫描它们;但那将是一种来回走动的方式。尝试添加编解码器并在 libtiff.

中启用它可能更容易

来自 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/.

所以支持是可选的,您可能需要重建 libtiff(参见 instructions)。

By default JPEG support is not configured.

参考文献: