openslide/openslide-python

OSError: -9

neu-null opened this issue · 2 comments

Operating system

windows11

Platform

64-bit

OpenSlide Python version

1.2.0

OpenSlide version

1.2.0

Slide format

NDPI

Issue details

Traceback (most recent call last):
  File "C:\Users\Desktop\Gleason\test3.py", line 50, in <module>
    img = np.array(img_slide.read_region((0, 0), 0, (patch_size, patch_size)).convert('RGB'))  # 切图
  File "C:\Users\.conda\envs\pytorch\lib\site-packages\openslide\__init__.py", line 410, in read_region
    crop = self._image.crop(image_topleft + [d + 1 for d in image_bottomright])
  File "C:\Users\.conda\envs\pytorch\lib\site-packages\PIL\Image.py", line 1175, in crop
    self.load()
  File "C:\Users\.conda\envs\pytorch\lib\site-packages\PIL\TiffImagePlugin.py", line 1130, in load
    return self._load_libtiff()
  File "C:\Users\.conda\envs\pytorch\lib\site-packages\PIL\TiffImagePlugin.py", line 1245, in _load_libtiff
    raise OSError(err)
OSError: -9

Line 410 is in the ImageSlide code, which means you used openslide.open_slide() and OpenSlide didn't recognize the slide file, so it tried to open the slide with Pillow instead.

What error do you get if you try opening the file with OpenSlide(path) instead of open_slide(path)?

Closing due to lack of response.