changeset 607:e447a2b8a8f2

added URL option "no-scaling" to disable conversion to physical units
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 09 Sep 2026 11:50:12 +0200
parents 9034e40dbbdd
children 93fa6d5f47e1
files NEWS ViewerPlugin/WebApplication/viewer.js
diffstat 2 files changed, 28 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- a/NEWS	Wed Sep 09 08:17:26 2026 +0200
+++ b/NEWS	Wed Sep 09 11:50:12 2026 +0200
@@ -11,15 +11,18 @@
 -------------
 
 * New configuration option "EnableAnnotations" to enable annotations
+  ("true" by default)
 * New configuration option "AuthenticationSource" to enable per-user annotations:
   - "None" uses the administrative Orthanc user (default)
   - "RegisteredUsers" relies on the HTTP basic authentication that is built in Orthanc
   - "HttpHeader" takes the user out of the HTTP header specified in "AuthenticationHttpHeader" option
-  - "Plugin" can be used if the "orthanc-education" plugin is installed
+  - "Plugin" to use authentication implemented by a plugin (notably for "orthanc-education")
 * New configuration option "Instructors" to distinguish between learners
   and instructors, only if the authentication source is "HttpHeader"
-* New configuration option "EnableAnnotationsSharing" to enable sharing of annotations
-* New configuration option "EnableLearnerToLearnerSharing" to enable sharing between learners
+* New configuration option "EnableAnnotationsSharing" to enable
+  sharing of annotations ("false" by default)
+* New configuration option "EnableLearnerToLearnerSharing" to enable
+  sharing between learners ("false" by default)
 
 Maintenance
 -----------
@@ -32,6 +35,7 @@
     by the measurement tools in the OHIF microscopy viewer
   - Support DICOM-ization of tiled TIFF with no compression
 * Viewer plugin:
+  - Added URL option "no-scaling" to disable conversion to physical units
   - Added CMake option "ORTHANC_SDK_VERSION"
 
 
--- a/ViewerPlugin/WebApplication/viewer.js	Wed Sep 09 08:17:26 2026 +0200
+++ b/ViewerPlugin/WebApplication/viewer.js	Wed Sep 09 11:50:12 2026 +0200
@@ -41,6 +41,7 @@
       userLayers: [],
       importedLayers: [],
       activeUserLayerId: null,
+      scaling: true,
 
       // UI state
       toolbarsVisible: false,
@@ -150,6 +151,10 @@
       this.imageDescription = params.get('description');
     }
 
+    if (params.has('no-scaling')) {
+      this.scaling = false;
+    }
+
     if (params.has('series')) {
       this.level = 'series';
       this.resourceId = params.get('series');
@@ -720,23 +725,25 @@
       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 (this.scaling) {
+        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 {
-            console.error('Anisotropic pixel spacing (may result from an inconsistency ' +
-                          'in the imaged volume size), not showing the scale');
+            // 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');
+            }
           }
         }
       }