Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How to handle huge images with level-of-detail in QGraphicsView?
QtWS25 Last Chance

How to handle huge images with level-of-detail in QGraphicsView?

Scheduled Pinned Locked Moved General and Desktop
5 Posts 2 Posters 3.3k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    G Offline
    GeertLitjens
    wrote on last edited by
    #1

    Hi all,

    First a tiny bit of background. I am working with huge tiled images which are stored in a multi-resolution pyramid (image sizes of around 50000 x 50000 pixels). The lowest level of the pyramid contains the full version of the image, and each subsequent level a 2x downsampled version. Images are stored with 512x512 tiles.

    My idea was to subclass QGraphicsItem and reimplement the paint function to only visualize the part of the image that is in view and use the level-of-detail to determine which level to load. However, I am running into some problems.

    I implemented boudingRect to return the full image size (50000 x 50000) and my idea was that when I put such an item into a scene, then the level-of-detail would be QGraphicsView size / QGraphicsItem size. However, the levelOfDetail passed to the paint function is simply 1, forcing the loader to load the full resolution image (which of course does not work). I looked at the 40000 chips example, which uses the WorldTransform to determine the correct scale. This does work for loading the right level and data, however, when I then draw the obtained pixmap, it is much to small (as the painter also takes the world matrix into account). Does anyone have any ideas on how to best handle this? Thanks!

    1 Reply Last reply
    0
    • P Offline
      P Offline
      pmh4514
      wrote on last edited by
      #2

      If you already have an image pyramid, you may want to look at using a QWebView (an embedded WebKit browser) and "Open Seadragon" to embed "deep zoom" functions in your app. You'll get blazing fast viewing of any sized image without having to worry about "how" to do it.

      1 Reply Last reply
      0
      • G Offline
        G Offline
        GeertLitjens
        wrote on last edited by
        #3

        Thanks for answering. I am familiar with OpenSeadragon, however, we need users to be able to interact with the image from the application (e.g. making annotations). As such, we prefer a Qt-based solution

        1 Reply Last reply
        0
        • P Offline
          P Offline
          pmh4514
          wrote on last edited by
          #4

          That's the beauty of QtWebKitBridge - you can really have a hybrid solution. I had to solve this very problem already and to me, the Open Seadragon "deep zoom viewer" was so amazingly fast and fluid for zipping around very large image pyramids that it made no sense to try to reinvent that, even with all the high quality features of Qt.

          Using a javascript framework like fabric.js you can implement nice annotation tools over the seadragon layer within the HTML environment. Data sharing is very straight-forward with the WebKitBridge so you can serialize your annotations using JSON or XML and embed any other kind of interactions between the Qt and WebView layers.

          1 Reply Last reply
          0
          • G Offline
            G Offline
            GeertLitjens
            wrote on last edited by
            #5

            Thanks again for answering, well, we have a lot of the functionality that is in OpenSeadragon already in place (interfacing with the image, caching of tiles, prefetching). I would still prefer a QGraphicsView based solution, as this is just more straightforward to implement. Additionally, I have the feeling that it should be that hard to implement using a QGraphicsView.

            1 Reply Last reply
            0

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved