Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OpenSlide bytes object #310

Closed
linatakemaru opened this issue Nov 20, 2024 · 1 comment
Closed

OpenSlide bytes object #310

linatakemaru opened this issue Nov 20, 2024 · 1 comment
Labels

Comments

@linatakemaru
Copy link

Operating system

Platform

OpenSlide Python version

1.1.2

OpenSlide version

3.4.1

Slide format

SVS

Issue details

I have SVS files stored on a Google Cloud Storage server, and would like to reference these files without creating a local copy of the object. To do this, I've successfully read the object as a stream and converted it from a BytesIO object to a bytes object using object.getvalue(). However, when I pass this bytes object into openslide.OpenSlide(bytes_object), I get the OpenSlideUnsupportedFormatError. From the documentation, it sounds like a str, bytes, or PathLike object is accepted, but I can't seem to get it to work. Any help is appreciated, thank you!

@bgilbert
Copy link
Member

The bytes object accepted by openslide.OpenSlide() is the path to the file, pre-encoded to bytes. This is useful for bypassing the default str -> bytes conversion if the filesystem path isn't encoded as UTF-8.

OpenSlide requires slide files to be accessible in the local filesystem. You could try mounting a FUSE filesystem that exposes Google Cloud Storage objects as local files. Without fairly aggressive prefetching and caching, though, you may find the I/O performance to be unacceptable.

@bgilbert bgilbert closed this as not planned Won't fix, can't repro, duplicate, stale Nov 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

2 participants