changeset 1699:0598c87e1e88

"WindowingPresets" configuration option
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 27 Nov 2020 10:21:48 +0100
parents 8805a6a01655
children f1bd464dc3e1
files Applications/StoneWebViewer/WebApplication/app.js Applications/StoneWebViewer/WebApplication/configuration.json Applications/StoneWebViewer/WebApplication/index.html
diffstat 3 files changed, 23 insertions(+), 30 deletions(-) [+]
line wrap: on
line diff
--- a/Applications/StoneWebViewer/WebApplication/app.js	Fri Nov 27 10:13:15 2020 +0100
+++ b/Applications/StoneWebViewer/WebApplication/app.js	Fri Nov 27 10:21:48 2020 +0100
@@ -862,7 +862,6 @@
   axios.get(CONFIGURATION_SOURCE)
     .then(function(response) {
       app.globalConfiguration = ParseJsonWithComments(response.data);
-      console.log(app.globalConfiguration);
 
       // Option 1: Loading script using plain HTML
       
--- a/Applications/StoneWebViewer/WebApplication/configuration.json	Fri Nov 27 10:13:15 2020 +0100
+++ b/Applications/StoneWebViewer/WebApplication/configuration.json	Fri Nov 27 10:21:48 2020 +0100
@@ -10,6 +10,20 @@
    * replaced by the day, "MM" by the month, and "YYYY" by the year.
    **/
   // "DateFormat" : "DD/MM/YYYY",
+
+  /**
+   * This option allows you to define windowing presets.
+   * For each preset, you must provide a name, the window width
+   * and window center.
+   **/
+  "WindowingPresets" : [
+    {"Name": "CT Lung", "WindowCenter": -400, "WindowWidth": 1600},
+    {"Name": "CT Abdomen", "WindowCenter": 60, "WindowWidth": 400},
+    {"Name": "CT Bone", "WindowCenter": 300, "WindowWidth": 1500},
+    {"Name": "CT Brain", "WindowCenter": 40, "WindowWidth": 80},
+    {"Name": "CT Chest", "WindowCenter": 40, "WindowWidth": 400},
+    {"Name": "CT Angio", "WindowCenter": 300, "WindowWidth": 600}
+  ],
   
   /**
    * The allowed origin for messages corresponding to dynamic actions
--- a/Applications/StoneWebViewer/WebApplication/index.html	Fri Nov 27 10:13:15 2020 +0100
+++ b/Applications/StoneWebViewer/WebApplication/index.html	Fri Nov 27 10:21:48 2020 +0100
@@ -392,39 +392,19 @@
                     </p-->
 
                 <ul class="wvToolbar__windowingPresetList">
-                  <li v-for="preset in windowingPresets" class="wvToolbar__windowingPresetListItem">
+                  <li v-for="preset in windowingPresets"
+                      class="wvToolbar__windowingPresetListItem">
                     <a href="#" v-on:click="SetWindowing(preset.center, preset.width)">
                       {{ preset.name }} <small>({{ preset.info }})</small>
                     </a>
                   </li>
-                  <li class="wvToolbar__windowingPresetListItem">
-                    <a href="#" v-on:click="SetWindowing(-400, 1600)">
-                      CT Lung <small>(C -400, W 1600)</small>
-                    </a>
-                  </li>
-                  <li class="wvToolbar__windowingPresetListItem">
-                    <a href="#" v-on:click="SetWindowing(300, 1500)">
-                      CT Abdomen <small>(C 300, W 1500)</small>
-                    </a>
-                  </li>
-                  <li class="wvToolbar__windowingPresetListItem">
-                    <a href="#" v-on:click="SetWindowing(40, 80)">
-                      CT Bone <small>(C 40, W 80)</small>
-                    </a>
-                  </li>
-                  <li class="wvToolbar__windowingPresetListItem">
-                    <a href="#" v-on:click="SetWindowing(40, 400)">
-                      CT Brain <small>(C 40, W 400)</small>
-                    </a>
-                  </li>
-                  <li class="wvToolbar__windowingPresetListItem">
-                    <a href="#" v-on:click="SetWindowing(-400, 1600)">
-                      CT Chest <small>(C -400, W 1600)</small>
-                    </a>
-                  </li>
-                  <li class="wvToolbar__windowingPresetListItem">
-                    <a href="#" v-on:click="SetWindowing(300, 600)">
-                      CT Angio <small>(C 300, W 600)</small>
+                  <li v-for="preset in globalConfiguration.WindowingPresets"
+                      class="wvToolbar__windowingPresetListItem">
+                    <a href="#" v-on:click="SetWindowing(preset.WindowCenter, preset.WindowWidth)">
+                      {{ preset.Name }}
+                      <small>
+                        (C {{preset.WindowCenter}}, W {{preset.WindowWidth}})
+                      </small>
                     </a>
                   </li>
                 </ul>