OpenSeaDragon as the viewer

595 views
Skip to first unread message

MarkusR

unread,
Feb 8, 2018, 12:50:05 PM2/8/18
to Orthanc Users
I am trying Orthanc, out of the box. The included viewer works but I would like to be able to serve up images to an OpenSeaDragon viewer.

Orthanc is pretty nice in that it has a webapi to service up the tile requests. Has anyone used Orthanc and openseadragon?

What tile format is Orthanc using? Looks like their viewer is using openlayers.

Does anyone know how to define the tile source or written a custom tile source?


            viewer = OpenSeadragon({

                id: "openseadragon-DragonViewer",

                wrapHorizontal: false,

                zoomPerScroll: 2,

                tileSources: {

                    height: 67776,

                    width: 68224,

                    tileSize: 512,

                    getTileUrl: function (level, x, y) {

                        return "http://localhost:8042/wsi/tiles/cd4dd414-cb4eb9af-920bce0a-56defef8-8ed810cd/"level + "/" + x + "/" + y;

                    },

                    type: 'tiledmapservice'

                },


Thanks


-Markus


Sébastien Jodogne

unread,
Feb 9, 2018, 1:33:30 AM2/9/18
to Orthanc Users
Hello,

The WSI plugin for Orthanc serves the tiles as PNG or JPEG files (either in grayscale 8bpp or RGB 24bpp). If the underlying tile format is RAW or JPEG2000, the tiles are transparently transcoded to PNG/JPEG on-the-fly for compatibility with most Web browsers.

The tiles are grouped into DICOM instances, that are in turn grouped into DICOM series, as explained here:

As a consequence, the identifier of a WSI pyramid corresponds to the Orthanc identifier of its DICOM series:

Information about the structure of the WSI pyramid can be retrieved by the "/wsi/pyramids/{id}" URI in the Orthanc REST API. Here is a sample call to our demo server, for which the base URL of the Orthanc REST API is mapped at "http://wsi.orthanc-server.com/orthanc/":

{
   "ID" : "5ef75b16-b0e33f06-1671cd7a-e86cc3b0-88f41030",
   "Resolutions" : [ 1, 2, 4 ],
   "Sizes" : [
      [ 1616, 4668 ],
      [ 808, 2334 ],
      [ 404, 1167 ]
   ],
   "TileHeight" : 512,
   "TileWidth" : 512,
   "TilesCount" : [
      [ 4, 10 ],
      [ 2, 5 ],
      [ 1, 3 ]
   ],
   "TotalHeight" : 4668,
   "TotalWidth" : 1616
}

You have already found the URI to access the individual tile given their level, x, and y location. This should give all the structural information needed to replace OpenLayers by OpenSeaDragon.

Please share your findings and create an additional Orthanc plugin! This would be a great contribution for the community of digital pathology!

Regards,
Sébastien-

MarkusR

unread,
Mar 6, 2018, 3:32:08 PM3/6/18
to Orthanc Users
Thanks Sébastien!

Our viewer is independent of Orthanc but I will post any finding that may help (or changes to the api).

What module/files is the web api code in that serves up the tiles? The issue we are having is that the web api implementation appears to be based on layer 0 being the hi-res layer (OpenLayer?) where OpenSeaDragon dzi format is based on 7 (or 8+) being the highest res layer.

-Markus

Sébastien Jodogne

unread,
Mar 7, 2018, 7:54:54 AM3/7/18
to Orthanc Users
Hello Markus,

I guess you are looking for the "ServeTile()" function:

As a rough guess, in this function, you should replace "level" by "locker.GetPyramid().GetLevelCount() - 1 - level" in this function to reverse the order of the layers.

If you confirm this helps the integration with OpenSeaDrogen, I would happily introduce a new URI (say, "/wsi/tiles-reverse/.../.../.../...") in the REST API of the WSI plugin. Please let me know.

HTH,
Sébastien-

MarkusR

unread,
Mar 7, 2018, 8:39:46 PM3/7/18
to Orthanc Users
Thanks again Sébastien!

I will let you know. Hopefully our c++ developer and look at it in the next week or so.

-Markus
Reply all
Reply to author
Forward
0 new messages