changeset 1692:e787b52d025f

"selectedStudies" argument to replace "selectedStudyIds" from Osimis Web viewer
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 25 Nov 2020 18:11:42 +0100
parents 4a49de03a419
children eafb10992e73
files Applications/StoneWebViewer/NOTES.txt Applications/StoneWebViewer/WebApplication/app.js
diffstat 2 files changed, 35 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/Applications/StoneWebViewer/NOTES.txt	Wed Nov 25 17:54:04 2020 +0100
+++ b/Applications/StoneWebViewer/NOTES.txt	Wed Nov 25 18:11:42 2020 +0100
@@ -20,11 +20,30 @@
   To open a single series:
   http://.../index.html?study=<StudyInstanceUID>&series=<SeriesInstanceUID>
 
-- The "pickableStudyIds" parameter in the URL (to specify a list of
-  studies to be displayed) is replaced by the single "study" GET
-  argument, that is allowed to contain a comma-separated list of
-  studies. The "series" parameter is ignored in this case.
+- In the Osimis Web viewer, the "pickableStudyIds" parameter in the
+  URL defines the list of studies that are available for display, and
+  that are listed in the dropdown at the top-left of the interface.
+
+  In the Stone Web viewer, "pickableStudyIds" is replaced by the
+  single "study" GET argument, that is allowed to contain a
+  comma-separated list of studies. The "series" parameter is ignored
+  in this case.
 
   To open a list of studies:
   http://.../index.html?study=<StudyInstanceUID1>,<StudyInstanceUID2>,...
   
+- In the Osimis Web viewer, the "selectedStudyIds" defines the list of
+  studies that are selected in the dropdown (and therefore displayed
+  when the viewer starts).
+
+  In the Stone Web viewer, "selectedStudyIds" is replaced by the
+  "selectedStudies" GET argument, that is allowed to contain a
+  comma-separated list of studies.
+
+  To make a list of studies available, but display only one of those
+  studies when the viewer starts:
+  http://.../index.html?study=<StudyInstanceUID1>,<StudyInstanceUID2>,...&selectedStudies=<StudyInstanceUID1>
+
+  If the "selectedStudies" is not provided, then all the studies are
+  displayed at the startup.
+
--- a/Applications/StoneWebViewer/WebApplication/app.js	Wed Nov 25 17:54:04 2020 +0100
+++ b/Applications/StoneWebViewer/WebApplication/app.js	Wed Nov 25 18:11:42 2020 +0100
@@ -303,6 +303,7 @@
       showWindowing: false,
       windowingPresets: [],
 
+      selectedStudies: [],
       series: [],
       studies: [],
       seriesIndex: {}  // Maps "SeriesInstanceUID" to "index in this.series"
@@ -398,12 +399,15 @@
             console.error('Twice the same study: ' + studyInstanceUid);
           } else {
             indexStudies[studyInstanceUid] = studies.length;
+
+            var isSelected = (this.selectedStudies.length == 0 ? true :
+                              this.selectedStudies.includes(studyInstanceUid));
             
             studies.push({
               'studyInstanceUid' : studyInstanceUid,
               'series' : [ ],
               'color' : COLORS[posColor],
-              'selected' : true,
+              'selected' : isSelected,
               'tags' : sourceStudies[i]
             });
 
@@ -723,9 +727,16 @@
   stone.SetSoftwareRendering(localStorage.settingSoftwareRendering == '1');
   console.warn('Stone properly initialized');
 
+  var selectedStudies = getParameterFromUrl('selectedStudies');
   var study = getParameterFromUrl('study');
   var series = getParameterFromUrl('series');
 
+  if (selectedStudies !== undefined) {
+    app.selectedStudies = selectedStudies.split(',');
+  } else {
+    app.selectedStudies = [];
+  }
+  
   if (study === undefined) {
     alert('No study was provided in the URL!');
   } else {