Operating system
Ubuntu 16.04.7 LTS
Platform
x86_64
OpenSlide Python version
openslide-python: 1.4.6
OpenSlide version
openslide=4.0.1
Slide format
TIFF
Issue details
I encountered a very strange issue where the import order of torch and openslide changes how OpenSlide detects the same WSI file.
The exact same Philips TIFF file is recognized correctly when openslide is imported first, but is detected as generic-tiff when torch is imported first.
This causes downstream applications (e.g. HoverNet) to fail because OpenSlide no longer exposes Philips-specific metadata such as openslide.mpp-x.
Environment:
Python: 3.12.13
openslide-python: 1.4.6
openslide: 4.0.1
torch: 2.12.1+cu126
OS: Ubuntu 16.04.7 LTS
Minimal Reproducible Example
Case 1 (works)
import openslide
slide = openslide.OpenSlide("patient_190_node_0.tif")
print(slide.properties["openslide.vendor"])
print("openslide.mpp-x" in slide.properties)
Case 1 Output:
Case 2 (works)
import openslide
import torch
slide = openslide.OpenSlide("patient_190_node_0.tif")
print(slide.properties["openslide.vendor"])
print("openslide.mpp-x" in slide.properties)
Case 2 Output:
Case 3 (fails)
import torch
import openslide
slide = openslide.OpenSlide("patient_190_node_0.tif")
print(slide.properties["openslide.vendor"])
print("openslide.mpp-x" in slide.properties)
Case 3 Output:
The WSI file used
https://github.com/0820LL/openslide-python-issue-file/releases/download/1.0/patient_190_node_0.tif
Operating system
Ubuntu 16.04.7 LTS
Platform
x86_64
OpenSlide Python version
openslide-python: 1.4.6
OpenSlide version
openslide=4.0.1
Slide format
TIFF
Issue details
I encountered a very strange issue where the import order of torch and openslide changes how OpenSlide detects the same WSI file.
The exact same Philips TIFF file is recognized correctly when openslide is imported first, but is detected as generic-tiff when torch is imported first.
This causes downstream applications (e.g. HoverNet) to fail because OpenSlide no longer exposes Philips-specific metadata such as openslide.mpp-x.
Environment:
Python: 3.12.13
openslide-python: 1.4.6
openslide: 4.0.1
torch: 2.12.1+cu126
OS: Ubuntu 16.04.7 LTS
Minimal Reproducible Example
Case 1 (works)
Case 1 Output:
Case 2 (works)
Case 2 Output:
Case 3 (fails)
Case 3 Output:
The WSI file used
https://github.com/0820LL/openslide-python-issue-file/releases/download/1.0/patient_190_node_0.tif