changeset 58:6d73737301c3

transmitting image title to wsi viewer
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 06 Nov 2025 15:38:22 +0100
parents 08a279251a4e
children 6196eaebf901
files Sources/OrthancDatabase.cpp Sources/OrthancDatabase.h
diffstat 2 files changed, 35 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/Sources/OrthancDatabase.cpp	Wed Oct 22 18:49:04 2025 +0200
+++ b/Sources/OrthancDatabase.cpp	Thu Nov 06 15:38:22 2025 +0100
@@ -435,11 +435,27 @@
 }
 
 
+static std::string FormatWSITitle(const std::string& title)
+{
+  if (title.empty())
+  {
+    return "";
+  }
+  else
+  {
+    std::string tmp;
+    Orthanc::Toolbox::UriEncode(tmp, title);
+    return "&description=" + tmp;
+  }
+}
+
+
 namespace OrthancDatabase
 {
   std::string GenerateStudyViewerUrl(ViewerType viewer,
                                      const std::string& studyId,
-                                     const std::string& studyInstanceUid)
+                                     const std::string& studyInstanceUid,
+                                     const std::string& title)
   {
     switch (viewer)
     {
@@ -470,7 +486,8 @@
   std::string GenerateSeriesViewerUrl(ViewerType viewer,
                                       const std::string& seriesId,
                                       const std::string& studyInstanceUid,
-                                      const std::string& seriesInstanceUid)
+                                      const std::string& seriesInstanceUid,
+                                      const std::string& title)
   {
     switch (viewer)
     {
@@ -478,7 +495,7 @@
         return "stone-webviewer/index.html?study=" + studyInstanceUid + "&series=" + seriesInstanceUid;
 
       case ViewerType_WholeSlideImaging:
-        return "wsi/app/viewer.html?series=" + seriesId;
+        return "wsi/app/viewer.html?series=" + seriesId + FormatWSITitle(title);
 
       case ViewerType_VolView:
         return "volview/index.html?names=[archive.zip]&urls=[../series/" + seriesId + "/archive]";
@@ -493,12 +510,13 @@
                                         const std::string& instanceId,
                                         const std::string& studyInstanceUid,
                                         const std::string& seriesInstanceUid,
-                                        const std::string& sopInstanceUid)
+                                        const std::string& sopInstanceUid,
+                                        const std::string& title)
   {
     switch (viewer)
     {
       case ViewerType_WholeSlideImaging:
-        return "wsi/app/viewer.html?instance=" + instanceId;
+        return "wsi/app/viewer.html?instance=" + instanceId + FormatWSITitle(title);
 
       default:
         throw Orthanc::OrthancException(Orthanc::ErrorCode_NotImplemented);
@@ -517,20 +535,23 @@
       case Orthanc::ResourceType_Study:
         return GenerateStudyViewerUrl(viewer,
                                       HttpToolbox::ReadMandatoryString(resource, "resource-id"),
-                                      HttpToolbox::ReadMandatoryString(resource, "study-instance-uid"));
+                                      HttpToolbox::ReadMandatoryString(resource, "study-instance-uid"),
+                                      HttpToolbox::ReadMandatoryString(resource, "title"));
 
       case Orthanc::ResourceType_Series:
         return GenerateSeriesViewerUrl(viewer,
                                        HttpToolbox::ReadMandatoryString(resource, "resource-id"),
                                        HttpToolbox::ReadMandatoryString(resource, "study-instance-uid"),
-                                       HttpToolbox::ReadMandatoryString(resource, "series-instance-uid"));
+                                       HttpToolbox::ReadMandatoryString(resource, "series-instance-uid"),
+                                       HttpToolbox::ReadMandatoryString(resource, "title"));
 
       case Orthanc::ResourceType_Instance:
         return GenerateInstanceViewerUrl(viewer,
                                          HttpToolbox::ReadMandatoryString(resource, "resource-id"),
                                          HttpToolbox::ReadMandatoryString(resource, "study-instance-uid"),
                                          HttpToolbox::ReadMandatoryString(resource, "series-instance-uid"),
-                                         HttpToolbox::ReadMandatoryString(resource, "sop-instance-uid"));
+                                         HttpToolbox::ReadMandatoryString(resource, "sop-instance-uid"),
+                                         HttpToolbox::ReadMandatoryString(resource, "title"));
 
       default:
         throw Orthanc::OrthancException(Orthanc::ErrorCode_NotImplemented);
--- a/Sources/OrthancDatabase.h	Wed Oct 22 18:49:04 2025 +0200
+++ b/Sources/OrthancDatabase.h	Thu Nov 06 15:38:22 2025 +0100
@@ -54,18 +54,21 @@
 
   std::string GenerateStudyViewerUrl(ViewerType viewer,
                                      const std::string& studyId,
-                                     const std::string& studyInstanceUid);
+                                     const std::string& studyInstanceUid,
+                                     const std::string& description);
 
   std::string GenerateSeriesViewerUrl(ViewerType viewer,
                                       const std::string& seriesId,
                                       const std::string& studyInstanceUid,
-                                      const std::string& seriesInstanceUid);
+                                      const std::string& seriesInstanceUid,
+                                      const std::string& description);
 
   std::string GenerateInstanceViewerUrl(ViewerType viewer,
                                         const std::string& instanceId,
                                         const std::string& studyInstanceUid,
                                         const std::string& seriesInstanceUid,
-                                        const std::string& sopInstanceUid);
+                                        const std::string& sopInstanceUid,
+                                        const std::string& description);
 
   std::string GenerateViewerUrl(ViewerType viewer,
                                 const std::map<std::string, std::string>& resource);