changeset 85:6ac5d5c49a26

simplification
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 30 Jul 2026 12:50:37 +0200
parents 0c20ad09e34b
children 51b08038ff56
files Sources/EducationToolbox.cpp Sources/EducationToolbox.h
diffstat 2 files changed, 51 insertions(+), 69 deletions(-) [+]
line wrap: on
line diff
--- a/Sources/EducationToolbox.cpp	Thu Jul 30 12:37:40 2026 +0200
+++ b/Sources/EducationToolbox.cpp	Thu Jul 30 12:50:37 2026 +0200
@@ -52,80 +52,80 @@
 }
 
 
-namespace EducationToolbox
+static std::string GenerateStudyViewerUrl(ViewerType viewer,
+                                          const std::string& studyId,
+                                          const std::string& studyInstanceUid,
+                                          const std::string& title)
 {
-  std::string GenerateStudyViewerUrl(ViewerType viewer,
-                                     const std::string& studyId,
-                                     const std::string& studyInstanceUid,
-                                     const std::string& title)
+  switch (viewer)
   {
-    switch (viewer)
-    {
-      case ViewerType_StoneWebViewer:
-        return "stone-webviewer/index.html?study=" + studyInstanceUid;
+    case ViewerType_StoneWebViewer:
+      return "stone-webviewer/index.html?study=" + studyInstanceUid;
 
-      case ViewerType_VolView:
-        return "volview/index.html?names=[archive.zip]&urls=[../studies/" + studyId + "/archive]";
+    case ViewerType_VolView:
+      return "volview/index.html?names=[archive.zip]&urls=[../studies/" + studyId + "/archive]";
 
-      case ViewerType_OHIF_Basic:
-        return "ohif/viewer?StudyInstanceUIDs=" + studyInstanceUid;
+    case ViewerType_OHIF_Basic:
+      return "ohif/viewer?StudyInstanceUIDs=" + studyInstanceUid;
 
-      case ViewerType_OHIF_VolumeRendering:
-        return "ohif/viewer?hangingprotocolId=mprAnd3DVolumeViewport&StudyInstanceUIDs=" + studyInstanceUid;
+    case ViewerType_OHIF_VolumeRendering:
+      return "ohif/viewer?hangingprotocolId=mprAnd3DVolumeViewport&StudyInstanceUIDs=" + studyInstanceUid;
 
-      case ViewerType_OHIF_TumorVolume:
-        return "ohif/tmtv?StudyInstanceUIDs=" + studyInstanceUid;
+    case ViewerType_OHIF_TumorVolume:
+      return "ohif/tmtv?StudyInstanceUIDs=" + studyInstanceUid;
 
-      case ViewerType_OHIF_Segmentation:
-        return "ohif/segmentation?StudyInstanceUIDs=" + studyInstanceUid;
+    case ViewerType_OHIF_Segmentation:
+      return "ohif/segmentation?StudyInstanceUIDs=" + studyInstanceUid;
 
-      default:
-        throw Orthanc::OrthancException(Orthanc::ErrorCode_NotImplemented);
-    }
+    default:
+      throw Orthanc::OrthancException(Orthanc::ErrorCode_NotImplemented);
   }
+}
 
 
-  std::string GenerateSeriesViewerUrl(ViewerType viewer,
-                                      const std::string& seriesId,
-                                      const std::string& studyInstanceUid,
-                                      const std::string& seriesInstanceUid,
-                                      const std::string& title)
+static std::string GenerateSeriesViewerUrl(ViewerType viewer,
+                                           const std::string& seriesId,
+                                           const std::string& studyInstanceUid,
+                                           const std::string& seriesInstanceUid,
+                                           const std::string& title)
+{
+  switch (viewer)
   {
-    switch (viewer)
-    {
-      case ViewerType_StoneWebViewer:
-        return "stone-webviewer/index.html?study=" + studyInstanceUid + "&series=" + seriesInstanceUid;
+    case ViewerType_StoneWebViewer:
+      return "stone-webviewer/index.html?study=" + studyInstanceUid + "&series=" + seriesInstanceUid;
 
-      case ViewerType_WholeSlideImaging:
-        return "wsi/app/viewer.html?series=" + seriesId + FormatWSITitle(title);
+    case ViewerType_WholeSlideImaging:
+      return "wsi/app/viewer.html?series=" + seriesId + FormatWSITitle(title);
 
-      case ViewerType_VolView:
-        return "volview/index.html?names=[archive.zip]&urls=[../series/" + seriesId + "/archive]";
+    case ViewerType_VolView:
+      return "volview/index.html?names=[archive.zip]&urls=[../series/" + seriesId + "/archive]";
 
-      default:
-        throw Orthanc::OrthancException(Orthanc::ErrorCode_NotImplemented);
-    }
+    default:
+      throw Orthanc::OrthancException(Orthanc::ErrorCode_NotImplemented);
   }
+}
 
 
-  std::string GenerateInstanceViewerUrl(ViewerType viewer,
-                                        const std::string& instanceId,
-                                        const std::string& studyInstanceUid,
-                                        const std::string& seriesInstanceUid,
-                                        const std::string& sopInstanceUid,
-                                        const std::string& title)
+static std::string GenerateInstanceViewerUrl(ViewerType viewer,
+                                             const std::string& instanceId,
+                                             const std::string& studyInstanceUid,
+                                             const std::string& seriesInstanceUid,
+                                             const std::string& sopInstanceUid,
+                                             const std::string& title)
+{
+  switch (viewer)
   {
-    switch (viewer)
-    {
-      case ViewerType_WholeSlideImaging:
-        return "wsi/app/viewer.html?instance=" + instanceId + FormatWSITitle(title);
+    case ViewerType_WholeSlideImaging:
+      return "wsi/app/viewer.html?instance=" + instanceId + FormatWSITitle(title);
 
-      default:
-        throw Orthanc::OrthancException(Orthanc::ErrorCode_NotImplemented);
-    }
+    default:
+      throw Orthanc::OrthancException(Orthanc::ErrorCode_NotImplemented);
   }
+}
 
 
+namespace EducationToolbox
+{
   std::string GenerateViewerUrl(ViewerType viewer,
                                 const std::map<std::string, std::string>& resource)
   {
--- a/Sources/EducationToolbox.h	Thu Jul 30 12:37:40 2026 +0200
+++ b/Sources/EducationToolbox.h	Thu Jul 30 12:50:37 2026 +0200
@@ -29,24 +29,6 @@
 
 namespace EducationToolbox
 {
-  std::string GenerateStudyViewerUrl(ViewerType viewer,
-                                     const std::string& studyId,
-                                     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& 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& description);
-
   std::string GenerateViewerUrl(ViewerType viewer,
                                 const std::map<std::string, std::string>& resource);