msalsbery / OpenSeadragonImagingHelper

MIT License
19 stars 13 forks source link

Asking you for help #25

Open linruicheng1997 opened 2 years ago

linruicheng1997 commented 2 years ago

The examples on the market are to load the image in advance, and generate the dzi file in advance, and finally be recognized and loaded by openSeadragon. Is there an example of being loaded by OpenSeadragon while generating the dzi file? I use Java

iangilman commented 2 years ago

This is probably a better question to ask over in the OpenSeadragon repository.

Anyway, yes, OpenSeadragon assumes the DZI has already been created by the time you open it. Why do you want to create it while it's getting loaded? Where do you want to create it (on the server or the client)? Answers to those questions may help us point you in the right direction…

linruicheng1997 commented 2 years ago

Thank you for your reply.Because loading in advance takes a lot of time and disk space, it is not so user-friendly. So I wonder if it can be recognized and displayed by OpenSeadragon while loading it on the server. Take this example: https://www.youtube.com/watch?v=W3-bYFBfJT4. Source code: https://github.com/openslide/openslide-python

linruicheng1997 commented 2 years ago

I want to view WSI images (20000 x 190000), so generating dzi files in advance and storing them locally will consume 10G of disk space, and it takes nearly 30 minutes to generate dzi files for each WSI, which is very unreasonable.

linruicheng1997 commented 2 years ago

I am a beginner to openSeadragon, do you have a better idea?

iangilman commented 2 years ago

You might look into the IIIF servers listed on http://openseadragon.github.io/examples/creating-zooming-images/. I believe some of them allow you to store the images in their original format, and then they serve the tiles you need, generating them on the fly. That sounds like the sort of thing you're looking for.

Another option would be to write your own server that basically does the same thing... whenever OSD asks for a tile, it would generate that tile (and then cache it to speed up next time). I'm not aware of any example code or prebuilt servers that do that, though you could look around at the options on the page above.

These options have the potential to be a little slower than prebuilt tiles, because it has to do extra work, but the savings in server hard drive space might be worth it.

That said, in theory, a DZI version of an image is just 1.333 times the size of the original (assuming they have the same file format and compression settings), so it's not a huge savings. As for the time it takes to generate, how frequently are you generating them? And what are you using to generate them?

linruicheng1997 commented 2 years ago

Okay, maybe I just need to figure out the OSD request principle. I haven't found out where the OSD request image code is. OSD is my next focus.

I use it to make a slide viewer. As for the generation frequency, it is very fast. The scanner we bought may scan dozens of slides in an hour, and view them immediately after each scan. Therefore, our time requirements are very high. If we follow the DZI format, it will take a long time to prepare DZI in advance, which is not in line with us, and the consumption of disks is also a huge expense.

iangilman commented 2 years ago

Sounds like a demanding scenario! I would definitely recommend either using an existing server that generates on-demand or writing your own that does so. You shouldn't need to customize OSD at all... just take the image requests that it sends to the server and generate the tile as needed right then.