openzoom / deepzoom.py

Python Deep Zoom Tools
http://openzoom.org/
Other
176 stars 73 forks source link

Single tiling from multiple images #16

Closed dmattek closed 2 years ago

dmattek commented 4 years ago

I've got ~6000 images at 1000x1000 pixels. I'm first making a large montage of 6Gpixels and then apply deepzoom.py. Everything works great but I'm wondering whether it's possible at all to omit the step of making the big montage and make a single tiling from individual images?

mpizenberg commented 2 years ago

Hi, I'm interested in a similar scenario. My images are all aligned on a horizontal panorama, but each may be of different width. Currently I'm concatenating them with

convert *.png +append panorama.jpg

Slightly related, @dmattek I'm also interested in the tool / command you're using for the montage if you don't mind sharing.

dmattek commented 2 years ago

Hi, you can checkout my approach here: https://github.com/dmattek/dzPlateViewer

I'm concatenating the images in Python. As for the original question, I haven't really found an off-the-shelf solution. In principle it should be doable but would require a lot of clever temporary concatenations and cropping. Still, you'd need a big montage to create first few levels of the pyramid.

mpizenberg commented 2 years ago

Interesting, I see you create a big canvas and paste subimages onto their correct locations.

locImWell.paste(locIm8fin, locBbox)

Out of curiosity, how much memory is needed for this to run with your data?

In principle it should be doable but would require a lot of clever temporary concatenations and cropping

Yeah, I agree, I don't have much time to invest now into understanding the dzi format to be able to generate the tiles myself.

darwinjob commented 2 years ago

Hi Just an (silly?) idea. What if you try use OpenSeadragon collection mode with 0 gap between the images? https://openseadragon.github.io/examples/tilesource-collection/

mpizenberg commented 2 years ago

@darwinjob That's a good idea. The issue is I'm actually using the sequence mode with images in different modalities (daylight, infrared, ultraviolet, ...) to be able to switch. So I can't use both at the same time sequence mode and collection mode ^^.

dmattek commented 2 years ago

Out of curiosity, how much memory is needed for this to run with your data?

The biggest pyramid I create is from a 6Gpx image at 8-bit resolution. So the image takes 6GB. When I process it on a cluster I allocate 16GB and usually 12-14GB suffice.

gasi commented 2 years ago

@dmattek Technically, it could be possible to create a tiling from individual images but as you point out, it does require quite a bit of clever math and image manipulation.

These days, there is a great alternative to deepzoom.py, namely VIPS: It is a high-performance image manipulation tool and can create DZI image pyramids. See: https://www.libvips.org/API/current/Making-image-pyramids.md.html

I’m closing the issue for now but feel free to submit a PR with your suggested changes 👍

mpizenberg commented 2 years ago

@dmattek in case it's of interest to you, I've created a small rust program called zoomtiler to generate a single tiling dzi from multiple images. It's not exactly your usecase since it's the specific case of all images are on a single horizontal row but maybe it can be of help if you ever want to adapt it.

Here it is https://github.com/mpizenberg/zoomtiler

figure