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
create and support a single-file file format for storing the image tiles #944
Comments
Interesting idea! There are already a number of image file formats that support progressive loading like this, for instance JPEG 2000 and JPEG XR ... what would you think about using one of those formats? |
I haven't looked into those formats, but I guess you then would limit yourself to only JPEG. What I would like to see is a file format that is
But at the time you need to download an image tile, you probably already would have downloaded the header anyway, because you would need the image_width, image_height, tile_size, tile_overlap information to pass to OpenSeadragon beforehand. |
Well, despite their names, JPEG 2000 and JPEG XR are not actually JPEG files... they are original formats that both have the feature of being able to access individual tiles directly. More information: https://en.wikipedia.org/wiki/JPEG_2000 The acronym JPEG just refers to the standards body that manages them. Anyway, I just bring them up because it's good to do your due diligence before inventing a new file format. Of course if those formats don't work for some reason, then there's a good reason to move forward with a new one! Either way, I'm interested in seeing what you come up with. |
Incidentally, this is a server not a file format, but you might also look into http://iipimage.sourceforge.net/. |
Funny comic! I like XKCD. I would like to have a file format that could be converted back and forth from the DZI directory file structure. I must confess I haven't spent much time looking into Another thing is that Anyway, I have an example of an experimental file format that I made with protobuf.js that contains both image tiles and some scientific measurement data. Unfortunately, I don't have any public experiment data files to show yet. Those software projects are very much in a flux right now. They will probably change a lot. https://github.com/eriksjolund/osd-spot-viewer/tree/master/from_layout |
I just added the C++ code that creates the experiment data files. For instance: The file Note that the same ordering needs to be implemented on the JavaScript side. Anyway, the approach seems to work. I can use a slightly modified OpenSeadragon (eriksjolund@d7bacf3) to display the high-resolution photo together with some scientific measurement data painted as circles. Right now the web browser reads the experiment file with the File API but I plan to add support for remote file access too. |
Very cool! Looks like you're making great progress. I don't know that it makes sense for the OpenSeadragon org (such as it is) to adopt ownership of this new format, but we can certainly point people to it as appropriate (on the "creating zoomable images" page, for instance). Perhaps the reader can be a plugin for OSD. Of course if OSD needs to be modified to support such kinds of plugins, that sounds good too. If you're interested in getting more people involved in the project, you might post on https://gitter.im/openseadragon/openseadragon and I'm happy to post on Twitter as well; let me know. |
I think the single file format would be more valuable if it would come together with a command line image conversion tool and a desktop viewer tool (nw.js/electron). Something that would be installable with "apt-get install" on my Ubuntu Linux desktop. It would of course require quite some work to write and package such software, but such a combination of tools would be quite useful to me. Anyway, I think you have a point that it is not self-evident that OpenSeadragon should adopt ownership of such a file format. Regarding software code integration to OpenSeadragon, this is my maybe naive understanding of it: I made a post on Gitter. Thanks for your offer to post on Twitter. I'll get back to you regarding that. I think we could wait a bit until there is a demo example to show. |
I don't have time right now but maybe in the future. |
Cool. Well, perhaps someone will pick it up in the meantime! |
@eriksjolund People have been asking about this kind of tech... can you post here on your progress? |
For a quick demo open the web page To try the web page out you could also open an It can either be opened directly as a remote URL or first be downloaded and then opened as a local file. Note that the image tiles will be downloaded as byte ranges from the data file as they are needed. Right now a data file contains both image tiles and gene expression measurement data. |
Awesome, thank you for sharing the info! |
Note that #1055 may help with this by providing the means to load ranges from the server. |
Regarding
It will write an uncompressed zip file (zip64, if necessary) containing all of the pyramid. You can copy this to a server and unzip, or (as you say) you can have a small piece of JS to read the zip header (the last chunk of the file) to get the filenames, sizes and offsets, then do a simple http range to pull out each tile. |
Just spotted this thread. We've already been doing this since about 2012 - see https://zif.photo. |
Cool! What do you think it might take to support it in OpenSeadragon? Is there a reference implementation for viewing it? |
@KempWatson, any progress so far with ZIF format? |
Hi all, very interesting reads on the possibility to store and stream in OSD, SZI (uncompressed, zipped dzis) or ZIF. Coming from GIS, the geospatial community has worked out in the recent years a standard way for storing massive georeferenced images, named Cloud Optimized Geotiff (Cog or cogeo). This format is indeed just a standard and agreed upon way to store pyramids within a tiff file, each pyramid level being written by blocks of a given number of pixel for data adjacency, stored in contiguous memory blocks. This file format is meant to be streamed to web clients using range requests (although I am not aware of a direct implementation of this, client-side, yet, which instead happens using middleware in the form of TiTiler. Maybe this titiler can be of help to the osd team? Would this COGeo standard be easier to implement inside OSD instead of SZI or ZIF (without any support for geotags of course)? Subscribing to the feed as the discussion is really interesting. |
Another option is to use an AWS Lambda function to translate Deep Zoom or IIIF requests to byte range fetches against S3 objects in their native format. As an example, I created a function that uses a modified version of OpenSlide to fetch directly from Aperio SVS (TIFF) files stored in S3. Viewing performance is comparable to using the Aperio viewer and server, once the Lambda instances are warmed up. |
Hi Rob, that's the core of our image server, supporting pretty much any
digital pathology slide format. We've dynamically translated DeepZoom or
Zoomify (but not IIIF) requests to either local filesystem (since 2002) or
S3 byte range requests (since 2008). Azure blobs were recently added as
well. We've got about a half petabyte of whole slide images under
management in this fashion.
Kemp Watson
…On Tue, Jul 27, 2021 at 10:56 AM Rob Montroy ***@***.***> wrote:
Another option is to use an AWS Lambda function to translate Deep Zoom or
IIIF requests to byte range fetches against S3 objects in their native
format. As an example, I created a function that uses a modified version of
OpenSlide to fetch directly from Aperio SVS (TIFF) files stored in S3.
Viewing performance is comparable to using the Aperio viewer and server,
once the Lambda instances are warmed up.
S3VS (S3 Virtual Slide) <https://github.com/VanAndelInstitute/s3vs>
The advantage to this approach is that you don't need to preprocess the
source files, just upload them to S3 as-is.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#944 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AC2OM5ISDV5LBFXEMIEUNSDTZ3CKDANCNFSM4CEEVVTQ>
.
|
@rmontroy very nice. I will definitely try this. |
@ap-- Nice. I might try out tiffslide. That looks like a much simpler approach. OpenSlide was a real pain to modify and build for Lambda. And the lead maintainer won't accept my contributions unless I create an entirely new interface for it, which I don't have time for. |
@KempWatson I would have happily paid you to implement our pathology viewer for us except for the fact that we're a U.S. federal gov't contractor (NIH) and need to be FISMA authorized. Creating a serverless app in AWS made it much easier to do that by myself. |
I'm unclear skimming this thread if Zoomify ZIF support is something OSD will get in (the near) future? Is there a plugin in development? Thanks! |
@alhuber1502 there's nothing I'm aware of for ZIF, but there certainly seems to be a lot of interest (judging by this thread)... hopefully someone will make it happen! You might try following up with some of the people who have posted about ZIF above. |
Any news about possible ZIF format support in OSD? My hosting provider is getting annoyed about the amount of inodes that I am using. |
Hi Alex, yes, we've got it working, but not fully tested. I'm gunning for a
release in March.
Note that our plugin will be free, but not open source.
Kemp Watson
Objective Pathology Services
…On Tue, Feb 7, 2023 at 9:13 AM alexp-nl ***@***.***> wrote:
Any news about possible ZIF format support in OSD? My hosting provider is
getting annoyed about the amount of inodes that I am using.
—
Reply to this email directly, view it on GitHub
<#944 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AC2OM5MOLWU7LV5MNWVZESDWWJKCDANCNFSM4CEEVVTQ>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Great, thanks Kemp! |
@KempWatson Awesome! Once it's ready, let's add it to the plugin list :) |
@KempWatson Checking in to see if there is any progress for zip/zif/szi etc.? We are struggling with the operating system memory constraints of having millions of image tiles on our webserver. |
Also interested in OSD support for zipped-dzi/zif/szi. On a similar note, Titiler is a middleware initially made to provide TMS tile url endpoints from COG images (Cloud Optimized Geotiffs). COG is a great addition to the geospatial community as a single file format standard to store massive, tiled imagery, and has been an OGC standard for a few years. [realized I already talked about it earlier in the thread] A new addition, a few months back, TiTiler started implementing an ImageReader for non-geo files, which handles images similar to COG, tiff pyramids with all zoom levels stored within a single file with block memory contigency. Not the ideal solution, but storing large single file images and using TiTiler as a middleware can be a step in the good direction for people wanting to avoid massive tile file counts. Plus correctly caching titiler requests allow for a real-time tile viewing experience. |
@jo-chemla Cool! That's good to know. Seems like the sort of information we might want to add to the website somehow... I'm not sure exactly where would be best. Maybe somewhere on https://openseadragon.github.io/examples/creating-zooming-images/? |
Another interesting possibility: https://github.com/pearcetm/GeoTIFFTileSource from @pearcetm. |
I don't do much with js and I am new to hosting, so I'm not quite sure what to do with the info here. But if I understand correctly, the current status of things is:
Sorry about the length of the comment, I just don't want to take for granted things that are false. |
Like @iangilman mentioned, you can check out https://github.com/pearcetm/GeoTIFFTileSource (demo page: https://pearcetm.github.io/GeoTIFFTileSource/demo.html). The plugin is based on the geotiff.js library. Large image pyramids can be stored as pyramidal TIFF files (
You can use OSD as the viewer for IIIF - there's already a tile source for that - and plenty of discussion and documentation around here as well as the documentation pages. |
Ok, well I did manage to view a IIIF3 in OSD, but now I am back to the original issue of deciding between a .zip vs a byte range vs giving up on object storage. I am still feeling pretty clueless reading the related threads. Maybe I will try a pyramidal tiff. I was hoping to have some compression but maybe it will be ok. Also with IIIF3 files, I was unable to view ones composed of PNGs, as it kept looking for jpg files. Not sure is the issue there is OSD or the way I created the tiles with libvips. |
@jbhanks I've been using my custom zipped format (uses 2 files, a zip file an a reference file) for a year at our company on DO spaces without any issue. master...PolCPP:openseadragon:master You just need to apply those changes to the last version of OSD and compile it. Original comment: #944 (comment) |
Thanks. I see that was made three years ago. Is there a reason why it hasn't been included in the main branch yet? |
@PolCPP To be clear, your zipped format doesn't do any further compression beyond what was originally done on the images themselves, correct? (I believe that's what you said before). I ask just because @jbhanks commented about "hoping to have some compression" but I don't think that is compatible with any of these range-based request techniques.
@jbhanks My understanding is that custom functionality like this would typically be implemented as a plugin rather than being integrated into the main OpenSeadragon code base, unless there is a solid case for really widespread usage that would justify bundling it into the main project. |
@pearcetm, by "hoping to have some compression, I meant (lossless) image compression from the png format. Also re the plugin: That makes sense, but shouldn't it have it's own repo then (or be included but the import commented out by default)? @PolCPP I built the current version of OSD with your plugin, but js throws errors when I go to my page using the modified OSD.
and
Just to be clear, all I should need to do is:
Update: I was able to build it, I didn't realize that order mattered in list of sources. Update2: I've built OSD with @PolCPP's plugin, but I still can't load the .zip. More details in my comment on the page for the plugin code |
Thanks! I did get a bit further just using your whole branch, but still not loading with errors like: |
It's up to @PolCPP to make such a thing, but yes, it would be lovely! @PolCPP If you do, please add it to the plugins list: https://openseadragon.github.io/#plugins. You can do so by making a PR against: https://github.com/openseadragon/site-build/blob/a5aa76024c139fa467f9d09d28ef9e13e1c23ea9/www/index.html#L193 Either way, thank you for helping @jbhanks! |
Also if it's not too much trouble, if @PolCPP can provide a known working test .edz file, then I can investigate whether my issue might be with the file I generated using the dzi2edz script (I had to modify it a little to get it to run). I'm happy to do anything I can with my limited JS skills to help get it working and then up to date with the current release. |
Reading byte ranges from files is supported in many cases in a web browser:
A byte range of a local file can be read by the File API.
A byte range of a file stored on a web server can be downloaded if the web server supports the
HTTP Range header.
A byte range of a file stored on AWS S3 can be downloaded through the Amazon S3 REST API.
I think it would be a good idea to create a simple file format that would have a header section in the beginning of the file and then have all the image tiles after it.
The header would store information about
image width
image height
tile size
tile overlap
and maybe image file format (JPEG/PNG)
and an list of the byte ranges of all the image tiles
What do you think?
What are the advantages and disadvantages of such a single-file format instead of using the multiple-file DZI format?
One advantage would be that system administration is simplified as you only need to handle one file per image instead of possibly thousands of files per image.
To simplify the handling and storing of the image tiles, I would suggest
we create a unique ordering of all the image tiles, in other words a
function tile_id(x_coord, y_coord, level, width, height, tile_size)
that returns an integer number between 0 and N - 1, where N is the number of tiles.
The unique ordering makes it easy to design the file header, because the image tile byte range start positions (and maybe end positions) could be stored as just an array of numbers.
Such a function could be implemented something like this:
Actually I've already tried out this approach, i.e. storing all the image tiles in one file and using the File API to open a local file with a slightly modified OpenSeadragon. It worked. Sorry I don't have that published on the web yet, but I plan to in the coming weeks.
The text was updated successfully, but these errors were encountered: