Microscope slide images load as multiple small tile images using open layer

54 views Asked by At

I have larger sizes (more than 10GB) of microscope slides (ndpi, svs, tiff) images. To display that existing project member using the open layer 3 versions. While loading some images are converted into small multiple tiles(tileUrlFunction 40 API calls happening) and loading quickly, but the same type and size of images are not converted into small tiles(tileUrlFunction calling 1 time of the API images).

      var projection = new ol.proj.Projection({
      code: 'meters',
      units: 'm',
      getPointResolution: function (resolution) {
        return resolution * params.umperpixel[0];
      }
    });

    var extent = [params.left[0], -(params.totYpix[0] + params.bottom[0]), params.totXpix[0] + params.right[0], params.top[0]];

    var tilegrid = new ol.tilegrid.WMTS({
      matrixIds: resolutions,
      origins: origins,
      sizes: matrixSizes,
      tileSizes: sizes,
      resolutions: resolutions
    });

    var zoomTilegrid = new ol.tilegrid.WMTS({
      matrixIds: [resolutions[resolutions.length - 1]],
      origins: [origins[origins.length - 1]],
      sizes: [matrixSizes[matrixSizes.length - 1]],
      tileSizes: [sizes[sizes.length - 1]],
      resolutions: [resolutions[resolutions.length - 1]]
    });

    slide.source = new ol.source.TileImage({
      crossOrigin: 'anonymous',
      wrapX: false,
      projection: projection,
      tileGrid: tilegrid,
      tileUrlFunction: function (tileCoord) {
        return fetchTiles(slide, tileCoord, params);
      }
    });
    slide.zoomSource = new ol.source.TileImage({
      crossOrigin: 'anonymous',
      wrapX: false,
      projection: projection,
      tileGrid: zoomTilegrid,
      tileUrlFunction: function (tileCoord) {
        return fetchTiles(slide, tileCoord, params, true);
      }
    });
    function fetchTiles(slide, tileCoord, params, forZoom) {
      if (tileCoord !== null) {
        var res = angular.copy(slide.map.getView().getResolution());
        var key = params.resolutions.indexOf(res),
          x = tileCoord[1],
          y = -tileCoord[2] - 1,
          level = forZoom ?
            params[params.format[key] + 'level'].slice(-1) :
            params[params.format[key] + 'level'][key];
        return getTileUrl() + 'fetchimage.cgi?' + serializeData({
          'PATH': (params.prefix[key] === 'ndpi' ||
            params.prefix[key] === 'svs' ||
            params.prefix[key] === 'webslide') ?
            path :
            path + '.' + params.prefix[key],
          'SLIDEFORMAT': params.format[key],
          'X': x,
          'Y': y,
          'IMAGEFORMAT': params.type[key],
          'LEVEL': level
        });
      }

tileCoord array values which pass the combination of X and Y is below, for all fetchimage.cgi Level is 4,

1-1 (Level-4)
2-1
3-1
4-1
5-1
6-1
7-1
8-1
9-1
10-1
11-1
12-1
13-1

1-2 (Level-4)
2-2
3-2
4-2
5-2
6-2
8-2
7-2
9-2
10-2
11-2
12-2
13-2

1-3 (Level-4)
2-3
3-3
4-3
5-3
6-3
7-3
8-3
9-3
10-3
11-3
12-3
13-3

Ex. http://testdomain/fetchimage.cgi?PATH=fullfilename.ndpi&SLIDEFORMAT=ndpi&X=13&Y=1&IMAGEFORMAT=jpg&LEVEL=4

Am not sure how to consider all the slide images as small tiles.

0

There are 0 answers