changeset 452:70c93cedf4f1

moving web application to a separate folder
author Sebastien Jodogne <s.jodogne@gmail.com>
date Sat, 01 Aug 2026 20:46:54 +0200
parents 14daf4d0eb96
children b716ddddf170 c81ed7e69dba
files ViewerPlugin/CMakeLists.txt ViewerPlugin/Plugin.cpp ViewerPlugin/WebApplication/mirador.html ViewerPlugin/WebApplication/openseadragon.html ViewerPlugin/WebApplication/viewer.html ViewerPlugin/WebApplication/viewer.js ViewerPlugin/mirador.html ViewerPlugin/openseadragon.html ViewerPlugin/viewer.html ViewerPlugin/viewer.js
diffstat 10 files changed, 346 insertions(+), 346 deletions(-) [+]
line wrap: on
line diff
--- a/ViewerPlugin/CMakeLists.txt	Thu Jul 30 13:39:55 2026 +0200
+++ b/ViewerPlugin/CMakeLists.txt	Sat Aug 01 20:46:54 2026 +0200
@@ -158,8 +158,8 @@
 if (STANDALONE_BUILD)
   add_definitions(-DORTHANC_STANDALONE=1)
   set(VIEWER_RESOURCES
-    VIEWER_HTML          ${CMAKE_SOURCE_DIR}/viewer.html
-    VIEWER_JS            ${CMAKE_SOURCE_DIR}/viewer.js
+    VIEWER_HTML          ${CMAKE_SOURCE_DIR}/WebApplication/viewer.html
+    VIEWER_JS            ${CMAKE_SOURCE_DIR}/WebApplication/viewer.js
     )
 else()
   add_definitions(
@@ -172,8 +172,8 @@
   ${VIEWER_RESOURCES}
   JAVASCRIPT_LIBS      ${JAVASCRIPT_LIBS_DIR}
   ORTHANC_EXPLORER     ${CMAKE_SOURCE_DIR}/OrthancExplorer.js
-  MIRADOR_HTML         ${CMAKE_SOURCE_DIR}/mirador.html
-  OPEN_SEADRAGON_HTML  ${CMAKE_SOURCE_DIR}/openseadragon.html
+  MIRADOR_HTML         ${CMAKE_SOURCE_DIR}/WebApplication/mirador.html
+  OPEN_SEADRAGON_HTML  ${CMAKE_SOURCE_DIR}/WebApplication/openseadragon.html
   )
 
 
--- a/ViewerPlugin/Plugin.cpp	Thu Jul 30 13:39:55 2026 +0200
+++ b/ViewerPlugin/Plugin.cpp	Sat Aug 01 20:46:54 2026 +0200
@@ -459,7 +459,7 @@
   }
 
   const boost::filesystem::path path = Orthanc::SystemToolbox::InterpretRelativePath(
-    Orthanc::SystemToolbox::PathFromUtf8(PLUGIN_SOURCE_DIR), filename);
+    Orthanc::SystemToolbox::PathFromUtf8(PLUGIN_SOURCE_DIR) / "WebApplication", filename);
   const char* mime = Orthanc::EnumerationToString(Orthanc::SystemToolbox::AutodetectMimeType(filename));
 
   std::string content;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ViewerPlugin/WebApplication/mirador.html	Sat Aug 01 20:46:54 2026 +0200
@@ -0,0 +1,35 @@
+<!DOCTYPE html>
+<html lang="en">
+  <head>
+    <meta charset="utf-8">
+    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
+    <meta name="theme-color" content="#000000">
+    <title>Mirador</title>
+    <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,400,500">
+    <!--link rel="shortcut icon" type="image/svg" href="/img/mirador-logo.svg"/-->
+  </head>
+  <body>
+    <div id="mirador" style="position: absolute; top: 0; bottom: 0; left: 0; right: 0;"></div>
+
+    <!--
+
+        WARNING: Mirador v4.0.0 can sometimes request regions of negative
+        width or height. We thus stick to Mirador v3.3.0 for the moment.
+        https://github.com/openseadragon/openseadragon/issues/2379
+
+      -->
+    <script>document.write("<script type='text/javascript' src='https://unpkg.com/mirador@3.3.0/dist/mirador.min.js'><\/script>");</script>
+    <script type="text/javascript">
+      var params = new URL(document.location).searchParams;
+      var manifest = params.get('iiif-content') || params.get('manifest');
+      var windows = [];
+      if (manifest) {
+        windows.push({ manifestId: manifest});
+      }
+      var miradorInstance = Mirador.viewer({
+        id: 'mirador',
+        windows: windows
+      });
+    </script>
+  </body>
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ViewerPlugin/WebApplication/openseadragon.html	Sat Aug 01 20:46:54 2026 +0200
@@ -0,0 +1,32 @@
+<html>
+  <head>
+    <meta charset="utf-8">
+    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
+    <meta name="theme-color" content="#000000">
+    <title>OpenSeadragon</title>
+
+    <!--
+
+        WARNING: OpenSeadragon v4.1.0 can sometimes request regions of negative
+        width or height. We thus stick to OSD v4.0.0 for the moment.
+        https://github.com/openseadragon/openseadragon/issues/2379
+
+      -->
+    <script src="https://unpkg.com/openseadragon@4.0.0/build/openseadragon/openseadragon.js"></script>
+  </head>
+
+  <body>
+    <div id="osd" style="width: 100%; height: 100%;"></div>
+    <script type="text/javascript">
+      var params = new URL(document.location).searchParams;
+      OpenSeadragon({
+      id:                 'osd',
+      prefixUrl:          'https://unpkg.com/openseadragon@4.0.0/build/openseadragon/images/',
+      preserveViewport:   true,
+      visibilityRatio:    1,
+      sequenceMode:       true,
+      tileSources:        [params.get('image')]
+      });
+    </script>
+  </body>
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ViewerPlugin/WebApplication/viewer.html	Sat Aug 01 20:46:54 2026 +0200
@@ -0,0 +1,63 @@
+<!DOCTYPE html>
+
+<html lang="en">
+  <head>
+    <meta charset="UTF-8">
+    <meta name="viewport" content="width=device-width, initial-scale=1.0">
+    <title>Orthanc for Whole-Slide Imaging</title>
+
+    <link rel="stylesheet" href="../libs/css/bootstrap.min.css" type="text/css">
+    <link rel="stylesheet" href="../libs/css/ol.css" type="text/css">
+
+    <style>
+      html,
+      body {
+          margin: 0;
+          height: 100%;
+      }
+
+      #map {
+          position: absolute;
+          top: 0;
+          bottom: 0;
+          width: 100%;
+      }
+
+      .ol-rotate {
+          top: 4em;
+          left: .5em;
+          right: initial;
+      }
+    </style>
+
+  </head>
+  <body>
+    <div id="map">
+    </div>
+
+    <div style="display:none">
+      <div id="popover-content">
+        <div class="container">
+          <div class="row mb-2">
+            <div class="btn-group btn-group-sm" role="group">
+              <button type="button" class="btn btn-outline-dark" id="rotation-reset">Reset</button>
+              <button type="button" class="btn btn-outline-dark" id="rotation-plus90">+90&deg;</button>
+              <button type="button" class="btn btn-outline-dark" id="rotation-minus90">-90&deg;</button>
+            </div>
+          </div>
+          <div class="row">
+            <input type="range" class="form-range" min="-180" max="180" id="rotation-slider">
+          </div>
+        </div>
+      </div>
+    </div>
+
+    <!-- This is the version of jQuery that is used by Orthanc Explorer -->
+    <script src="../../app/libs/jquery.min.js"></script>
+
+    <script src="../libs/js/popper.min.js"></script>
+    <script src="../libs/js/bootstrap.min.js"></script>
+    <script src="../libs/js/ol.js"></script>
+    <script src="viewer.js"></script>
+  </body>
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ViewerPlugin/WebApplication/viewer.js	Sat Aug 01 20:46:54 2026 +0200
@@ -0,0 +1,211 @@
+/**
+ * Orthanc - A Lightweight, RESTful DICOM Store
+ * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
+ * Department, University Hospital of Liege, Belgium
+ * Copyright (C) 2017-2023 Osimis S.A., Belgium
+ * Copyright (C) 2024-2026 Orthanc Team SRL, Belgium
+ * Copyright (C) 2021-2026 Sebastien Jodogne, ICTEAM UCLouvain, Belgium
+ *
+ * This program is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU Affero General Public License
+ * as published by the Free Software Foundation, either version 3 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Affero General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ **/
+
+
+function IsNear(a, b)
+{
+  return Math.abs(a - b) <= 0.01;
+}
+
+
+function InitializePyramid(pyramid, tilesBaseUrl)
+{
+  $('#map').css('background', pyramid['BackgroundColor']);  // New in WSI 2.1
+
+  var width = pyramid['TotalWidth'];
+  var height = pyramid['TotalHeight'];
+  var countLevels = pyramid['Resolutions'].length;
+
+  var metersPerUnit = null;
+  var imagedVolumeWidth = pyramid['ImagedVolumeWidth'];  // In millimeters
+  var imagedVolumeHeight = pyramid['ImagedVolumeHeight'];
+  if (imagedVolumeWidth !== undefined &&
+      imagedVolumeHeight !== undefined) {
+    var metersPerUnitX = parseFloat(imagedVolumeWidth) / (1000.0 * parseFloat(width));
+    var metersPerUnitY = parseFloat(imagedVolumeHeight) / (1000.0 * parseFloat(height));
+    if (IsNear(metersPerUnitX / metersPerUnitY, 1)) {
+      metersPerUnit = metersPerUnitX;
+    } else {
+      // Backward compatibility with OrthancWSIDicomizer <= 3.2, where X/Y were swapped
+      metersPerUnitX = parseFloat(imagedVolumeWidth) / (1000.0 * parseFloat(height));
+      metersPerUnitY = parseFloat(imagedVolumeHeight) / (1000.0 * parseFloat(width));
+      if (IsNear(metersPerUnitX / metersPerUnitY, 1)) {
+        metersPerUnit = metersPerUnitX;
+      } else {
+        console.error('Anisotropic pixel spacing (may result from an inconsistency ' +
+                      'in the imaged volume size), not showing the scale');
+      }
+    }
+  }
+
+  // Maps always need a projection, but Zoomify layers are not geo-referenced, and
+  // are only measured in pixels.  So, we create a fake projection that the map
+  // can use to properly display the layer.
+  var proj = new ol.proj.Projection({
+    code: 'pixel',
+    units: 'pixel',
+    metersPerUnit: metersPerUnit,
+    extent: [0, 0, width, height]
+  });
+
+  var extent = [0, -height, width, 0];
+
+  var rotateControl = new ol.control.Rotate({
+    autoHide: false,  // Show the button even if rotation is 0
+    resetNorth: function() {  // Disable the default action
+    }
+  });
+
+  new bootstrap.Popover(rotateControl.element, {
+    placement: 'right',
+    container: 'body',
+    html: true,
+    content: $('#popover-content')
+  });
+
+  // Disable the rotation of the map, and inertia while panning
+  // http://stackoverflow.com/a/25682186
+  var interactions = ol.interaction.defaults.defaults({
+    //pinchRotate : false,
+    dragPan: false  // disable kinetics
+    //shiftDragZoom: false  // disable zoom box
+  }).extend([
+    new ol.interaction.DragPan(),
+    new ol.interaction.DragRotate({
+      //condition: ol.events.condition.shiftKeyOnly  // Rotate only when Shift key is pressed
+    })
+  ]);
+
+  var controls = ol.control.defaults.defaults({
+    attribution: false
+  }).extend([
+    rotateControl,
+    new ol.control.ScaleLine({
+      minWidth: 100
+    })
+  ]);
+
+  const params = new URLSearchParams(document.location.search);
+  if (params.has('description')) {
+    controls.extend([
+      new ol.control.Attribution({
+        attributions: params.get('description'),
+        collapsible: false
+      })
+    ]);
+  }
+
+
+  var layer = new ol.layer.Tile({
+    extent: extent,
+    source: new ol.source.TileImage({
+      projection: proj,
+      tileUrlFunction: function(tileCoord, pixelRatio, projection) {
+        return (tilesBaseUrl + (countLevels - 1 - tileCoord[0]) + '/' + tileCoord[1] + '/' + tileCoord[2]);
+      },
+      tileGrid: new ol.tilegrid.TileGrid({
+        extent: extent,
+        resolutions: pyramid['Resolutions'].reverse(),
+        tileSizes: pyramid['TilesSizes'].reverse()
+      })
+    }),
+    wrapX: false,
+    projection: proj
+  });
+
+
+  var map = new ol.Map({
+    target: 'map',
+    layers: [ layer ],
+    view: new ol.View({
+      projection: proj,
+      center: [width / 2, -height / 2],
+      zoom: 0,
+      minResolution: 0.1   // "1" means "do not interpelate over pixels"
+    }),
+    interactions: interactions,
+    controls: controls
+  });
+
+  map.getView().fit(extent, map.getSize());
+
+
+  $('#rotation-slider').on('input change', function() {
+    map.getView().setRotation(this.value / 180 * Math.PI);
+  });
+
+  $('#rotation-reset').click(function() {
+    $('#rotation-slider').val(0).change();
+  });
+
+  $('#rotation-minus90').click(function() {
+    var angle = parseInt($('#rotation-slider').val()) - 90;
+    if (angle < -180) {
+      angle += 360;
+    }
+    $('#rotation-slider').val(angle).change();
+  });
+
+  $('#rotation-plus90').click(function() {
+    var angle = parseInt($('#rotation-slider').val()) + 90;
+    if (angle > 180) {
+      angle -= 360;
+    }
+    $('#rotation-slider').val(angle).change();
+  });
+}
+
+
+$(document).ready(function() {
+  const params = new URLSearchParams(document.location.search);
+
+  if (params.has('series')) {
+    var seriesId = params.get('series');
+    $.ajax({
+      url : '../pyramids/' + seriesId,
+      error: function() {
+        alert('Error - Cannot get the pyramid structure of series: ' + seriesId);
+      },
+      success : function(pyramid) {
+        InitializePyramid(pyramid, '../tiles/' + seriesId + '/');
+      }
+    });
+  } else if (params.has('instance')) {
+    var frameNumber = 0;
+    if (params.has('frame')) {
+      frameNumber = params.get('frame');
+    }
+
+    var instanceId = params.get('instance');
+    $.ajax({
+      url : '../frames-pyramids/' + instanceId + '/' + frameNumber,
+      error: function() {
+        alert('Error - Cannot get the pyramid structure of frame ' + frameNumber + ' of instance: ' + instanceId);
+      },
+      success : function(pyramid) {
+        InitializePyramid(pyramid, '../frames-tiles/' + instanceId + '/' + frameNumber + '/');
+      }
+    });
+  } else {
+    alert('Error - No series ID and no instance ID specified!');
+  }
+});
--- a/ViewerPlugin/mirador.html	Thu Jul 30 13:39:55 2026 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,35 +0,0 @@
-<!DOCTYPE html>
-<html lang="en">
-  <head>
-    <meta charset="utf-8">
-    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
-    <meta name="theme-color" content="#000000">
-    <title>Mirador</title>
-    <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,400,500">
-    <!--link rel="shortcut icon" type="image/svg" href="/img/mirador-logo.svg"/-->
-  </head>
-  <body>
-    <div id="mirador" style="position: absolute; top: 0; bottom: 0; left: 0; right: 0;"></div>
-
-    <!--
-
-        WARNING: Mirador v4.0.0 can sometimes request regions of negative
-        width or height. We thus stick to Mirador v3.3.0 for the moment.
-        https://github.com/openseadragon/openseadragon/issues/2379
-
-      -->
-    <script>document.write("<script type='text/javascript' src='https://unpkg.com/mirador@3.3.0/dist/mirador.min.js'><\/script>");</script>
-    <script type="text/javascript">
-      var params = new URL(document.location).searchParams;
-      var manifest = params.get('iiif-content') || params.get('manifest');
-      var windows = [];
-      if (manifest) {
-        windows.push({ manifestId: manifest});
-      }
-      var miradorInstance = Mirador.viewer({
-        id: 'mirador',
-        windows: windows
-      });
-    </script>
-  </body>
-</html>
--- a/ViewerPlugin/openseadragon.html	Thu Jul 30 13:39:55 2026 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,32 +0,0 @@
-<html>
-  <head>
-    <meta charset="utf-8">
-    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
-    <meta name="theme-color" content="#000000">
-    <title>OpenSeadragon</title>
-
-    <!--
-
-        WARNING: OpenSeadragon v4.1.0 can sometimes request regions of negative
-        width or height. We thus stick to OSD v4.0.0 for the moment.
-        https://github.com/openseadragon/openseadragon/issues/2379
-
-      -->
-    <script src="https://unpkg.com/openseadragon@4.0.0/build/openseadragon/openseadragon.js"></script>
-  </head>
-
-  <body>
-    <div id="osd" style="width: 100%; height: 100%;"></div>
-    <script type="text/javascript">
-      var params = new URL(document.location).searchParams;
-      OpenSeadragon({
-      id:                 'osd',
-      prefixUrl:          'https://unpkg.com/openseadragon@4.0.0/build/openseadragon/images/',
-      preserveViewport:   true,
-      visibilityRatio:    1,
-      sequenceMode:       true,
-      tileSources:        [params.get('image')]
-      });
-    </script>
-  </body>
-</html>
--- a/ViewerPlugin/viewer.html	Thu Jul 30 13:39:55 2026 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,63 +0,0 @@
-<!DOCTYPE html>
-
-<html lang="en">
-  <head>
-    <meta charset="UTF-8">
-    <meta name="viewport" content="width=device-width, initial-scale=1.0">
-    <title>Orthanc for Whole-Slide Imaging</title>
-
-    <link rel="stylesheet" href="../libs/css/bootstrap.min.css" type="text/css">
-    <link rel="stylesheet" href="../libs/css/ol.css" type="text/css">
-
-    <style>
-      html,
-      body {
-          margin: 0;
-          height: 100%;
-      }
-
-      #map {
-          position: absolute;
-          top: 0;
-          bottom: 0;
-          width: 100%;
-      }
-
-      .ol-rotate {
-          top: 4em;
-          left: .5em;
-          right: initial;
-      }
-    </style>
-
-  </head>
-  <body>
-    <div id="map">
-    </div>
-
-    <div style="display:none">
-      <div id="popover-content">
-        <div class="container">
-          <div class="row mb-2">
-            <div class="btn-group btn-group-sm" role="group">
-              <button type="button" class="btn btn-outline-dark" id="rotation-reset">Reset</button>
-              <button type="button" class="btn btn-outline-dark" id="rotation-plus90">+90&deg;</button>
-              <button type="button" class="btn btn-outline-dark" id="rotation-minus90">-90&deg;</button>
-            </div>
-          </div>
-          <div class="row">
-            <input type="range" class="form-range" min="-180" max="180" id="rotation-slider">
-          </div>
-        </div>
-      </div>
-    </div>
-
-    <!-- This is the version of jQuery that is used by Orthanc Explorer -->
-    <script src="../../app/libs/jquery.min.js"></script>
-
-    <script src="../libs/js/popper.min.js"></script>
-    <script src="../libs/js/bootstrap.min.js"></script>
-    <script src="../libs/js/ol.js"></script>
-    <script src="viewer.js"></script>
-  </body>
-</html>
--- a/ViewerPlugin/viewer.js	Thu Jul 30 13:39:55 2026 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,211 +0,0 @@
-/**
- * Orthanc - A Lightweight, RESTful DICOM Store
- * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
- * Department, University Hospital of Liege, Belgium
- * Copyright (C) 2017-2023 Osimis S.A., Belgium
- * Copyright (C) 2024-2026 Orthanc Team SRL, Belgium
- * Copyright (C) 2021-2026 Sebastien Jodogne, ICTEAM UCLouvain, Belgium
- *
- * This program is free software: you can redistribute it and/or
- * modify it under the terms of the GNU Affero General Public License
- * as published by the Free Software Foundation, either version 3 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Affero General Public License for more details.
- * 
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- **/
-
-
-function IsNear(a, b)
-{
-  return Math.abs(a - b) <= 0.01;
-}
-
-
-function InitializePyramid(pyramid, tilesBaseUrl)
-{
-  $('#map').css('background', pyramid['BackgroundColor']);  // New in WSI 2.1
-
-  var width = pyramid['TotalWidth'];
-  var height = pyramid['TotalHeight'];
-  var countLevels = pyramid['Resolutions'].length;
-
-  var metersPerUnit = null;
-  var imagedVolumeWidth = pyramid['ImagedVolumeWidth'];  // In millimeters
-  var imagedVolumeHeight = pyramid['ImagedVolumeHeight'];
-  if (imagedVolumeWidth !== undefined &&
-      imagedVolumeHeight !== undefined) {
-    var metersPerUnitX = parseFloat(imagedVolumeWidth) / (1000.0 * parseFloat(width));
-    var metersPerUnitY = parseFloat(imagedVolumeHeight) / (1000.0 * parseFloat(height));
-    if (IsNear(metersPerUnitX / metersPerUnitY, 1)) {
-      metersPerUnit = metersPerUnitX;
-    } else {
-      // Backward compatibility with OrthancWSIDicomizer <= 3.2, where X/Y were swapped
-      metersPerUnitX = parseFloat(imagedVolumeWidth) / (1000.0 * parseFloat(height));
-      metersPerUnitY = parseFloat(imagedVolumeHeight) / (1000.0 * parseFloat(width));
-      if (IsNear(metersPerUnitX / metersPerUnitY, 1)) {
-        metersPerUnit = metersPerUnitX;
-      } else {
-        console.error('Anisotropic pixel spacing (may result from an inconsistency ' +
-                      'in the imaged volume size), not showing the scale');
-      }
-    }
-  }
-
-  // Maps always need a projection, but Zoomify layers are not geo-referenced, and
-  // are only measured in pixels.  So, we create a fake projection that the map
-  // can use to properly display the layer.
-  var proj = new ol.proj.Projection({
-    code: 'pixel',
-    units: 'pixel',
-    metersPerUnit: metersPerUnit,
-    extent: [0, 0, width, height]
-  });
-
-  var extent = [0, -height, width, 0];
-
-  var rotateControl = new ol.control.Rotate({
-    autoHide: false,  // Show the button even if rotation is 0
-    resetNorth: function() {  // Disable the default action
-    }
-  });
-
-  new bootstrap.Popover(rotateControl.element, {
-    placement: 'right',
-    container: 'body',
-    html: true,
-    content: $('#popover-content')
-  });
-
-  // Disable the rotation of the map, and inertia while panning
-  // http://stackoverflow.com/a/25682186
-  var interactions = ol.interaction.defaults.defaults({
-    //pinchRotate : false,
-    dragPan: false  // disable kinetics
-    //shiftDragZoom: false  // disable zoom box
-  }).extend([
-    new ol.interaction.DragPan(),
-    new ol.interaction.DragRotate({
-      //condition: ol.events.condition.shiftKeyOnly  // Rotate only when Shift key is pressed
-    })
-  ]);
-
-  var controls = ol.control.defaults.defaults({
-    attribution: false
-  }).extend([
-    rotateControl,
-    new ol.control.ScaleLine({
-      minWidth: 100
-    })
-  ]);
-
-  const params = new URLSearchParams(document.location.search);
-  if (params.has('description')) {
-    controls.extend([
-      new ol.control.Attribution({
-        attributions: params.get('description'),
-        collapsible: false
-      })
-    ]);
-  }
-
-
-  var layer = new ol.layer.Tile({
-    extent: extent,
-    source: new ol.source.TileImage({
-      projection: proj,
-      tileUrlFunction: function(tileCoord, pixelRatio, projection) {
-        return (tilesBaseUrl + (countLevels - 1 - tileCoord[0]) + '/' + tileCoord[1] + '/' + tileCoord[2]);
-      },
-      tileGrid: new ol.tilegrid.TileGrid({
-        extent: extent,
-        resolutions: pyramid['Resolutions'].reverse(),
-        tileSizes: pyramid['TilesSizes'].reverse()
-      })
-    }),
-    wrapX: false,
-    projection: proj
-  });
-
-
-  var map = new ol.Map({
-    target: 'map',
-    layers: [ layer ],
-    view: new ol.View({
-      projection: proj,
-      center: [width / 2, -height / 2],
-      zoom: 0,
-      minResolution: 0.1   // "1" means "do not interpelate over pixels"
-    }),
-    interactions: interactions,
-    controls: controls
-  });
-
-  map.getView().fit(extent, map.getSize());
-
-
-  $('#rotation-slider').on('input change', function() {
-    map.getView().setRotation(this.value / 180 * Math.PI);
-  });
-
-  $('#rotation-reset').click(function() {
-    $('#rotation-slider').val(0).change();
-  });
-
-  $('#rotation-minus90').click(function() {
-    var angle = parseInt($('#rotation-slider').val()) - 90;
-    if (angle < -180) {
-      angle += 360;
-    }
-    $('#rotation-slider').val(angle).change();
-  });
-
-  $('#rotation-plus90').click(function() {
-    var angle = parseInt($('#rotation-slider').val()) + 90;
-    if (angle > 180) {
-      angle -= 360;
-    }
-    $('#rotation-slider').val(angle).change();
-  });
-}
-
-
-$(document).ready(function() {
-  const params = new URLSearchParams(document.location.search);
-
-  if (params.has('series')) {
-    var seriesId = params.get('series');
-    $.ajax({
-      url : '../pyramids/' + seriesId,
-      error: function() {
-        alert('Error - Cannot get the pyramid structure of series: ' + seriesId);
-      },
-      success : function(pyramid) {
-        InitializePyramid(pyramid, '../tiles/' + seriesId + '/');
-      }
-    });
-  } else if (params.has('instance')) {
-    var frameNumber = 0;
-    if (params.has('frame')) {
-      frameNumber = params.get('frame');
-    }
-
-    var instanceId = params.get('instance');
-    $.ajax({
-      url : '../frames-pyramids/' + instanceId + '/' + frameNumber,
-      error: function() {
-        alert('Error - Cannot get the pyramid structure of frame ' + frameNumber + ' of instance: ' + instanceId);
-      },
-      success : function(pyramid) {
-        InitializePyramid(pyramid, '../frames-tiles/' + instanceId + '/' + frameNumber + '/');
-      }
-    });
-  } else {
-    alert('Error - No series ID and no instance ID specified!');
-  }
-});