changeset 1526:61023b0d39c8

Reverted the Stone Web Viewer plugin to rev. 307a805d0587 (mistakenly changed to serve the RT Viewer and make it available in the Orthanc Explorer while it should have been done in a separate plugin)
author Benjamin Golinvaux <bgo@osimis.io>
date Sun, 02 Aug 2020 13:53:48 +0200
parents 31b0449a163a
children 4c4b267e4004
files StoneWebViewer/Plugin/CMakeLists.txt StoneWebViewer/Plugin/OrthancExplorer.js StoneWebViewer/Plugin/Plugin.cpp StoneWebViewer/Plugin/docker-internal.sh
diffstat 4 files changed, 8 insertions(+), 130 deletions(-) [+]
line wrap: on
line diff
--- a/StoneWebViewer/Plugin/CMakeLists.txt	Sat Aug 01 14:42:31 2020 +0200
+++ b/StoneWebViewer/Plugin/CMakeLists.txt	Sun Aug 02 13:53:48 2020 +0200
@@ -14,8 +14,7 @@
 
 
 
-set(STONE_BINARIES_WEB_VIEWER CACHE PATH "Path to the binaries of the WebViewer \"../WebAssembly\" folder")
-set(STONE_BINARIES_RT_VIEWER CACHE PATH "Path to the binaries of the RtViewer \"../WebAssembly\" folder")
+set(STONE_BINARIES CACHE PATH "Path to the binaries of the \"../WebAssembly\" folder")
 
 # Parameters of the build
 set(STATIC_BUILD OFF CACHE BOOL "Static build of the third-party libraries (necessary for Windows)")
@@ -71,23 +70,15 @@
 
 
 EmbedResources(
-  # Web Viewer Folders
-  IMAGES                 ${STONE_BINARIES_WEB_VIEWER}/img/
+  # Folders
+  IMAGES                 ${STONE_BINARIES}/img/
   WEB_APPLICATION        ${CMAKE_SOURCE_DIR}/../WebApplication
 
-  # Explorer extension code
+  # Individual files
   ORTHANC_EXPLORER       ${CMAKE_SOURCE_DIR}/OrthancExplorer.js
-
-  # Web viewer individual files
-  STONE_WEB_VIEWER_JS    ${STONE_BINARIES_WEB_VIEWER}/StoneWebViewer.js
-  STONE_WEB_VIEWER_WASM  ${STONE_BINARIES_WEB_VIEWER}/StoneWebViewer.wasm
-  STONE_WRAPPER          ${STONE_BINARIES_WEB_VIEWER}/stone.js
-
-  # RtViewer folder
-  RT_VIEWER_WASM_JS      ${STONE_BINARIES_RT_VIEWER}/RtViewerWasm.js
-  RT_VIEWER_WASM         ${STONE_BINARIES_RT_VIEWER}/RtViewerWasm.wasm
-  RT_VIEWER_WASM_APP_JS  ${STONE_BINARIES_RT_VIEWER}/RtViewerWasmApp.js
-  RT_VIEWER_INDEX_HTML   ${STONE_BINARIES_RT_VIEWER}/index.html
+  STONE_WEB_VIEWER_JS    ${STONE_BINARIES}/StoneWebViewer.js
+  STONE_WEB_VIEWER_WASM  ${STONE_BINARIES}/StoneWebViewer.wasm
+  STONE_WRAPPER          ${STONE_BINARIES}/stone.js
   )
 
 add_library(StoneWebViewer SHARED
--- a/StoneWebViewer/Plugin/OrthancExplorer.js	Sat Aug 01 14:42:31 2020 +0200
+++ b/StoneWebViewer/Plugin/OrthancExplorer.js	Sun Aug 02 13:53:48 2020 +0200
@@ -55,91 +55,3 @@
     }
   });
 });
-
-$('#series').live('pagebeforecreate', function() {
-  var b = $('<a>')
-      .attr('data-role', 'button')
-      .attr('href', '#')
-      .attr('data-icon', 'search')
-      .attr('data-theme', 'e')
-      .text('Stone MPR RT Viewer');``
-
-  b.insertBefore($('#series-delete').parent().parent());
-  b.click(function() {
-    if ($.mobile.pageData) {
-      $.ajax({
-        url: '../series/' + $.mobile.pageData.uuid,
-        dataType: 'json',
-        cache: false,
-        success: function(series) {
-
-          // we consider that the imaging series to display is the 
-          // current one.
-          // we will look for RTDOSE and RTSTRUCT instances in the 
-          // sibling series from the same study. The first one of 
-          // each modality will be grabbed.
-          let ctSeries = $.mobile.pageData.uuid;
-
-          $.ajax({
-            url: '../studies/' + series.ParentStudy,
-            dataType: 'json',
-            cache: false,
-            success: function(study) {
-              // Loop on the study series and find the first RTSTRUCT and RTDOSE instances,
-              // if any.
-              let rtStructInstance = null;
-              let rtDoseInstance = null;
-              let rtPetInstance = null;
-              let seriesRequests = []
-
-              study.Series.forEach( function(studySeriesUuid) {
-                let request = $.ajax({
-                  url: '../series/' + studySeriesUuid,
-                  dataType: 'json',
-                  cache: false,
-                });
-                seriesRequests.push(request);
-              });
-
-              $.when.apply($,seriesRequests).then(function() {
-                [].forEach.call(arguments, function(response) {
-                  siblingSeries = response[0]
-                  if (siblingSeries.MainDicomTags.Modality == "RTDOSE") {
-                    // we have found an RTDOSE series. Let's grab the first instance
-                    if (siblingSeries.Instances.length > 0) {
-                      if(rtDoseInstance == null) {
-                        rtDoseInstance = siblingSeries.Instances[0];
-                      }
-                    }
-                  }
-                  if (siblingSeries.MainDicomTags.Modality == "PT") {
-                    // we have found an RTDOSE series. Let's grab the first instance
-                    if (siblingSeries.Instances.length > 0) {
-                      if(rtPetInstance == null) {
-                        rtPetInstance = siblingSeries.Instances[0];
-                      }
-                    }
-                  }
-                  if (siblingSeries.MainDicomTags.Modality == "RTSTRUCT") {
-                    // we have found an RTDOSE series. Let's grab the first instance
-                    if (siblingSeries.Instances.length > 0) {
-                      if(rtStructInstance == null) {
-                        rtStructInstance = siblingSeries.Instances[0];
-                      }
-                    }
-                  }
-                });
-                let mprViewerUrl = '../stone-rtviewer/index.html?ctseries=' + ctSeries + 
-                '&rtdose=' + rtDoseInstance + 
-                '&rtstruct=' + rtStructInstance;
-                //console.log("About to open: " + mprViewerUrl);
-                window.open(mprViewerUrl);
-              });
-            }
-          });      
-        }
-      });      
-    }
-  });
-});
-
--- a/StoneWebViewer/Plugin/Plugin.cpp	Sat Aug 01 14:42:31 2020 +0200
+++ b/StoneWebViewer/Plugin/Plugin.cpp	Sun Aug 02 13:53:48 2020 +0200
@@ -191,8 +191,6 @@
         explorer, Orthanc::EmbeddedResources::ORTHANC_EXPLORER);
       OrthancPluginExtendOrthancExplorer(OrthancPlugins::GetGlobalContext(), explorer.c_str());
       
-      // Stone Web Viewer files
-      // ---------------------
       OrthancPlugins::RegisterRestCallback
         <ServeEmbeddedFile<Orthanc::EmbeddedResources::STONE_WEB_VIEWER_WASM> >
         ("/stone-webviewer/StoneWebViewer.wasm", true);
@@ -213,28 +211,6 @@
         <ServeEmbeddedFolder<Orthanc::EmbeddedResources::WEB_APPLICATION> >
         ("/stone-webviewer/(.*)", true);
 
-      // RtViewer files below.
-      // ---------------------
-      // we do not serve the whole directory at once (with ServeEmbeddedFolder)
-      // because it contains uppercase characters that are forbidden by the
-      // resource embedding system
-
-      OrthancPlugins::RegisterRestCallback
-        <ServeEmbeddedFile<Orthanc::EmbeddedResources::RT_VIEWER_WASM_JS> >
-        ("/stone-rtviewer/RtViewerWasm.js", true);
-
-      OrthancPlugins::RegisterRestCallback
-        <ServeEmbeddedFile<Orthanc::EmbeddedResources::RT_VIEWER_WASM> >
-        ("/stone-rtviewer/RtViewerWasm.wasm", true);
-
-      OrthancPlugins::RegisterRestCallback
-        <ServeEmbeddedFile<Orthanc::EmbeddedResources::RT_VIEWER_WASM_APP_JS> >
-        ("/stone-rtviewer/RtViewerWasmApp.js", true);
-
-      OrthancPlugins::RegisterRestCallback
-        <ServeEmbeddedFile<Orthanc::EmbeddedResources::RT_VIEWER_INDEX_HTML> >
-        ("/stone-rtviewer/index.html", true);
-
       OrthancPluginRegisterOnChangeCallback(context, OnChangeCallback);
     }
     catch (...)
--- a/StoneWebViewer/Plugin/docker-internal.sh	Sat Aug 01 14:42:31 2020 +0200
+++ b/StoneWebViewer/Plugin/docker-internal.sh	Sun Aug 02 13:53:48 2020 +0200
@@ -20,8 +20,7 @@
       -DCMAKE_TOOLCHAIN_FILE=/tmp/orthanc/OrthancFramework/Resources/Toolchains/LinuxStandardBaseToolchain.cmake \
       -DORTHANC_FRAMEWORK_ROOT=/tmp/orthanc/OrthancFramework \
       -DSTATIC_BUILD=ON \
-      -DSTONE_BINARIES_WEB_VIEWER=/target/StoneWebViewer/ \
-      -DSTONE_BINARIES_RT_VIEWER=/target/RtViewer/ \
+      -DSTONE_BINARIES=/target/StoneWebViewer/ \
       -DUSE_LEGACY_JSONCPP=ON \
       -G Ninja