sophmi / laya

Server implementation of IIIF Image API 3.0
Apache License 2.0
2 stars 2 forks source link

Optional feature for openslide images #10

Open jayvdb opened 3 weeks ago

jayvdb commented 3 weeks ago

Hiya, would this project be interested in https://crates.io/crates/openslide-rs support being added, probably as an optional feature?

I suggest optional as the underlying https://openslide.org/ is LGPL, so some people might want to disable that.

garyttierney commented 3 weeks ago

Hi!

Thanks for bringing OpenSlide to my attention, it's the first I've come across it. Currently I'm working on support for the RGB JPEG2000 -> JPEG path, but afterwards tiled TIFFs and other colorspaces will be on my radar.

OpenSlide seems like a good candidate to get the ball rolling on that, although from a look over the API it seems like it wants to be responsible for all IO (the only way to get an openslide_t* is by giving the API a path to open and then IO is done transparently on calls to get pixel data, is that right?).

My preference would be for a decoder we have a bit more control over (in terms of allocations and IO), but we'd be happy to carry an implementation that only supports filesystems and pulls stripes of image data from a decoder running in a blocking thread pool for OpenSlide users who'd be interested in that. If we want to get the most out of integrating Laya with OpenSlide (i.e. async IO, using alternative data sources like AWS S3, setting upper bounds on resource limits) then we can also look into patches on the OpenSlide side.

In the long-term we'll probably end up with a separate TIFF decoder, but there are a bunch of novel image formats supported by OpenSlide I haven't seen anywhere else that it's worth carrying the support for.

jayvdb commented 2 weeks ago

Hey Gary, this project will definitely want its own TIFF support, and will likely want to use a different strategy for standard formats like OME-TIFF and OME-NGFF, and DICOM.

But unfortunately for the extremely proprietary formats that this type of scanners use, there is only openslide (C, LGPL) and bio-formats (Java; GPL, but there is https://github.com/AzHicham/bioformats-rs , also by @AzHicham who is doing all the Rust stuff in this area). Due to how much reverse engineering is involved, creating a Rust project for handling these formats is going to be hard to sustain.

Having a custom openslide sounds like a good idea to get the most out of it. But good ideas are cheap ;-) IMO we'd want to do this in https://github.com/AzHicham/openslide-sys , if at all.