diff Applications/StoneWebViewer/WebApplication/app.js @ 1964:2034ae383cfd deep-learning

integration default->deep-learning
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 28 Oct 2022 07:47:55 +0200
parents 060d61913e39 889892e51545
children 963f28eb40cb
line wrap: on
line diff
--- a/Applications/StoneWebViewer/WebApplication/app.js	Tue Aug 16 15:05:51 2022 +0200
+++ b/Applications/StoneWebViewer/WebApplication/app.js	Fri Oct 28 07:47:55 2022 +0200
@@ -1123,8 +1123,6 @@
     if (localStorage.settingSoftwareRendering) {
       this.settingSoftwareRendering = (localStorage.settingSoftwareRendering == '1');
     }
-    
-    this.modalNotDiagnostic = this.settingNotDiagnostic;
 
     var that = this;
     
@@ -1157,6 +1155,11 @@
 
 
 window.addEventListener('StoneInitialized', function() {
+  /**
+   * Do NOT modify the order of the calls to "stone.XXX()" in this
+   * section, otherwise the HTTP headers might not be properly set.
+   **/
+
   stone.Setup(Module);
   stone.SetDicomWebRoot(app.globalConfiguration.DicomWebRoot,
                         true /* assume "/rendered" is available in DICOMweb (could be a configuration option) */);
@@ -1166,17 +1169,37 @@
     stone.SetDicomCacheSize(app.globalConfiguration.DicomCacheSize);
   }
 
-  if ('SkipSeriesFromModalities' in app.globalConfiguration) {
-    stone.SetSkipSeriesFromModalities(JSON.stringify(app.globalConfiguration.SkipSeriesFromModalities));
+  // Calls to "stone.AddHttpHeader()" must be after "stone.SetDicomWebRoot()",
+  // and before "stone.SetSkipSeriesFromModalities()"
+  for (var header in app.globalConfiguration.DicomWebHttpHeaders) {
+    stone.AddHttpHeader(header, app.globalConfiguration.DicomWebHttpHeaders[header]);
   }
   
   // Bearer token is new in Stone Web viewer 2.0
   var token = getParameterFromUrl('token');
-  if (token !== undefined)
-  {
+  if (token !== undefined) {
     stone.AddHttpHeader('Authorization', 'Bearer ' + token);
   }
+
+
+  /**
+   * Calls to "stone.XXX()" can be reordered after this point.
+   **/
   
+  if ('SkipSeriesFromModalities' in app.globalConfiguration) {
+    stone.SetSkipSeriesFromModalities(JSON.stringify(app.globalConfiguration.SkipSeriesFromModalities));
+  }
+  
+  if (app.globalConfiguration.ShowInfoPanelAtStartup == 'Always') {
+    app.modalNotDiagnostic = true;
+  } else if (app.globalConfiguration.ShowInfoPanelAtStartup == 'Never') {
+    app.modalNotDiagnostic = false;
+  } else if (app.globalConfiguration.ShowInfoPanelAtStartup == 'User') {
+    app.modalNotDiagnostic = app.settingNotDiagnostic;
+  } else {
+    alert('Bad value for option "ShowInfoPanelAtStartup": ' + app.globalConfiguration.ShowInfoPanelAtStartup);
+  }
+
   console.warn('Stone properly initialized');
 
   app.stoneWebViewerVersion = stone.GetStoneWebViewerVersion();