Giter Club home page Giter Club logo

Comments (6)

jcupitt avatar jcupitt commented on May 17, 2024

dzsave writes all the tiles and all the layers in parallel as it scans the image, so it wouldn't actually be much faster to only write a single layer.

For example, to build an entire pyramid:

$ time vips dzsave 044TracheaEsophCat.svs x
real    7m54.842s
user    18m18.328s
sys 3m10.148s

Or to just scan the image and calculate some statistics:

$ time vips stats 044TracheaEsophCat.svs x.v
real    6m38.004s
user    15m6.848s
sys 2m23.220s

ie. the jpeg2000 decode dominates the whole calculation.

You could make something faster if you only wanted a few tiles. The code here could be a starting point:

https://github.com/jcupitt/tilesrv

I'll leave this issue open as a reminder to reconsider this.

from libvips.

mogadanez avatar mogadanez commented on May 17, 2024

in our use case we always render up to 12 level, all another renders by demand if user zoom to this part of document, many parts of image is not interesting by end user and never need to be tiled.
we have many images and render all of them to max level is overhead by cpu usage and disk space.

from libvips.

jcupitt avatar jcupitt commented on May 17, 2024

Ah, I understand. One option would be to use the options on file load to pick a level out. For example:

$ time vips dzsave 044TracheaEsophCat.svs[level=2] x
real    0m1.924s
user    0m3.972s
sys 0m0.680s

That makes levels 0 - 12, for this image anyway.

dzsave can make a pyramid from any image. If you give it an openslide image, you can give any openslide load options in square brackets after the filename. To see all openslide load options, try:

$ vips openslideload
usage:
   openslideload filename out
load file with OpenSlide
where:
   filename     - Filename to load from, input gchararray
   out          - Output image, output VipsImage
optional arguments:
   flags        - Flags for this file, output VipsForeignFlags
   disc         - Open to disc, input gboolean
   level        - Load this level from the file, input gint
   sequential   - Sequential read only, input gboolean
   associated   - Load this associated image, input gchararray

Online docs here:

http://www.vips.ecs.soton.ac.uk/supported/7.32/doc/html/libvips/VipsForeignSave.html#vips-openslideload

from libvips.

mogadanez avatar mogadanez commented on May 17, 2024

OpenSlide looks like a option.
can i convert any image (jpeg, png, etc) to OpenSlide format with vips?

from libvips.

jcupitt avatar jcupitt commented on May 17, 2024

Sorry, I assumed you were working from openslide source images. No, vips cannot write openslide, only read.

You could shrink your image before running dzsave. For example:

vipsthumbnail huge.tif -o medium.tif --size 1500
vips dzsave medium.tif x

Would first shrink the image to fit within 1500 x 1500, then run dzsave on that. This would then only generate the first 12 layers (roughly).

The 1500 is only an approximate number, you'd need to work out an exact figure for each image.

from libvips.

jcupitt avatar jcupitt commented on May 17, 2024

git master has a new feature which might be relevant: you can now save to a deepzoom pyramid with the .dz extension. This lets you do pre-extract or shrink as part of pyramid creation. For example:

vips shrink huge.tif pyramid.dz[layout=google] 10 10

will shrink huge.tif by a factor of 10, then write that shrunk image to a set of tiles using google layout. You could use extract_area to crop out just the centre of the image and tile that.

This will be in the next stable version, due in a couple of weeks.

from libvips.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.