changeset 309:8594f9bcd556 refactoring

links to Orthanc Explorer
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 19 Jun 2019 07:21:27 +0200
parents 78c9a7d207b8
children dcaf234698a3
files Plugin/Plugin.cpp WebApplication/app.js WebApplication/index.html
diffstat 3 files changed, 74 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/Plugin/Plugin.cpp	Tue Jun 18 19:08:02 2019 +0200
+++ b/Plugin/Plugin.cpp	Wed Jun 19 07:21:27 2019 +0200
@@ -149,6 +149,56 @@
 
 
 
+void GetClientInformation(OrthancPluginRestOutput* output,
+                          const char* /*url*/,
+                          const OrthancPluginHttpRequest* request)
+{
+  OrthancPluginContext* context = OrthancPlugins::GetGlobalContext();
+
+  if (request->method != OrthancPluginHttpMethod_Get)
+  {
+    OrthancPluginSendMethodNotAllowed(context, output, "GET");
+  }
+  else
+  {
+    std::string root = OrthancPlugins::Configuration::GetRoot();
+    std::vector<std::string> tokens;
+    Orthanc::Toolbox::TokenizeString(tokens, root, '/');
+    int depth = 0;
+    for (size_t i = 0; i < tokens.size(); i++)
+    {
+      if (tokens[i].empty() ||
+          tokens[i] == ".")
+      {
+        // Don't change the depth
+      }
+      else if (tokens[i] == "..")
+      {
+        depth--;
+      }
+      else
+      {
+        depth++;
+      }
+    }
+
+    std::string orthancRoot = "./";
+    for (int i = 0; i < depth; i++)
+    {
+      orthancRoot += "../";
+    }
+
+    Json::Value info = Json::objectValue;
+    info["DicomWebRoot"] = root;
+    info["OrthancRoot"] = orthancRoot;
+
+    std::string answer = info.toStyledString();
+    OrthancPluginAnswerBuffer(context, output, answer.c_str(), answer.size(), "application/json");
+  }
+}
+
+
+
 void QidoClient(OrthancPluginRestOutput* output,
                 const char* /*url*/,
                 const OrthancPluginHttpRequest* request)
@@ -655,6 +705,7 @@
           (root + "app/libs/(.*)", true);
 
         OrthancPlugins::RegisterRestCallback<ServeDicomWebClient>(root + "app/client/(.*)", true);
+        OrthancPlugins::RegisterRestCallback<GetClientInformation>(root + "app/info", true);
 
         std::string uri = root + "app/client/index.html";
         OrthancPluginSetRootUri(context, uri.c_str());
--- a/WebApplication/app.js	Tue Jun 18 19:08:02 2019 +0200
+++ b/WebApplication/app.js	Wed Jun 19 07:21:27 2019 +0200
@@ -22,6 +22,7 @@
     }
   },
   data: {
+    orthancExplorerUri: '../../../',
     previewFailure: true,
     preview: DEFAULT_PREVIEW,
     showTruncatedStudies: false,
@@ -123,7 +124,12 @@
         app.serversInfo = response.data;
         app.servers = Object.keys(response.data).map(i => i);
         app.Clear();
-      })
+      });
+    axios
+      .get('../info')
+      .then(response => {
+        app.orthancExplorerUri = response.data.OrthancRoot + '../../';
+      });
   },
   methods: {
     ScrollToRef: function(refName) {
--- a/WebApplication/index.html	Tue Jun 18 19:08:02 2019 +0200
+++ b/WebApplication/index.html	Wed Jun 19 07:21:27 2019 +0200
@@ -33,17 +33,28 @@
           <div class="col-sm-8">
             <h1 class="display-4">DICOMweb client</h1>
             <p class="lead">
-              This is a simple interface to the DICOMweb servers that are
-              configured in Orthanc.
+              This is a simple client interface to the DICOMweb
+              servers that are configured in Orthanc. From this page,
+              you can search the content of remote DICOMweb servers
+              (QIDO-RS), then locally retrieve the DICOM
+              studies/series of interest
+              (WADO-RS). <a :href="orthancExplorerUri"
+              target="_blank">Orthanc Explorer</a> can be used to send
+              DICOM resources to remote DICOMweb servers (STOW-RS).
             </p>
             <p>
               <a class="btn btn-primary btn-lg"
                  href="https://book.orthanc-server.com/plugins/dicomweb.html"
                  target="_blank" role="button">Open documentation</a>
+              <a class="btn btn-primary btn-lg"
+                 :href="orthancExplorerUri"
+                 target="_blank" role="button">Open Orthanc Explorer</a>
             </p>
           </div>
           <div class="col-sm-4">
-            <img class="img-fluid" alt="Orthanc" src="../libs/img/OrthancLogo.png" />
+            <a href="http://www.orthanc-server.com/" target="_blank">
+              <img class="img-fluid" alt="Orthanc" src="../libs/img/OrthancLogo.png" />
+            </a>
           </div>
         </div>
       </div>
@@ -82,13 +93,11 @@
           </p>
         </b-form>
       </div>
-      <hr/>
 
 
       <!-- STUDIES -->
 
-      <div ref="studies-top"></div>
-
+      <hr  v-show="showStudies" ref="studies-top" />
       <div class="row" v-show="showStudies">
         <h1>Studies</h1>
       </div>
@@ -140,8 +149,7 @@
 
       <!-- SERIES -->
 
-      <div ref="series-top"></div>
-
+      <hr  v-show="showSeries" ref="series-top" />
       <div class="row" v-show="showSeries">
         <h1>Series</h1>
       </div>