# HG changeset patch # User Sebastien Jodogne # Date 1688973708 -7200 # Node ID b9eab260a37241f14c157816993b73bdbda66f97 # Parent c72fbdecdc382876c14ce542538df1a15e6e8b50 serving Mirador diff -r c72fbdecdc38 -r b9eab260a372 ViewerPlugin/CMakeLists.txt --- a/ViewerPlugin/CMakeLists.txt Mon Jul 10 08:59:40 2023 +0200 +++ b/ViewerPlugin/CMakeLists.txt Mon Jul 10 09:21:48 2023 +0200 @@ -173,6 +173,7 @@ ORTHANC_EXPLORER ${CMAKE_SOURCE_DIR}/OrthancExplorer.js VIEWER_HTML ${CMAKE_SOURCE_DIR}/viewer.html VIEWER_JS ${CMAKE_SOURCE_DIR}/viewer.js + MIRADOR_HTML ${CMAKE_SOURCE_DIR}/mirador.html ) diff -r c72fbdecdc38 -r b9eab260a372 ViewerPlugin/OrthancExplorer.js --- a/ViewerPlugin/OrthancExplorer.js Mon Jul 10 08:59:40 2023 +0200 +++ b/ViewerPlugin/OrthancExplorer.js Mon Jul 10 09:21:48 2023 +0200 @@ -24,6 +24,7 @@ var seriesId = $.mobile.pageData.uuid; $('#wsi-button').remove(); + $('#mirador-button').remove(); // Test whether this is a whole-slide image by check the SOP Class // UID of one instance of the series @@ -51,6 +52,24 @@ }); } + + if (${SERVE_MIRADOR}) { + var b = $('') + .attr('id', 'mirador-button') + .attr('data-role', 'button') + .attr('href', '#') + .attr('data-icon', 'search') + .attr('data-theme', 'e') + .text('Open IIIF in Mirador') + .button(); + + b.insertAfter($('#series-info')); + b.click(function() { + if ($.mobile.pageData) { + window.open('../wsi/app/mirador.html?iiif-content=../iiif/' + seriesId + '/manifest.json'); + } + }); + } }); }); }); diff -r c72fbdecdc38 -r b9eab260a372 ViewerPlugin/Plugin.cpp --- a/ViewerPlugin/Plugin.cpp Mon Jul 10 08:59:40 2023 +0200 +++ b/ViewerPlugin/Plugin.cpp Mon Jul 10 09:21:48 2023 +0200 @@ -216,6 +216,11 @@ resource = Orthanc::EmbeddedResources::OPENLAYERS_CSS; mime = "text/css"; } + else if (f == "mirador.html") + { + resource = Orthanc::EmbeddedResources::MIRADOR_HTML; + mime = "text/html"; + } else { throw Orthanc::OrthancException(Orthanc::ErrorCode_UnknownResource); @@ -283,6 +288,13 @@ OrthancPlugins::RegisterRestCallback("/wsi/pyramids/([0-9a-f-]+)", true); OrthancPlugins::RegisterRestCallback("/wsi/tiles/([0-9a-f-]+)/([0-9-]+)/([0-9-]+)/([0-9-]+)", true); + bool serveMirador = true; // TODO => CONFIG + + if (serveMirador) + { + OrthancPlugins::RegisterRestCallback("/wsi/app/(mirador.html)", true); + } + { // TODO => CONFIG std::string url = "http://localhost:8042/wsi/iiif"; @@ -296,10 +308,18 @@ InitializeIIIF(url); } - // Extend the default Orthanc Explorer with custom JavaScript for WSI - std::string explorer; - Orthanc::EmbeddedResources::GetFileResource(explorer, Orthanc::EmbeddedResources::ORTHANC_EXPLORER); - OrthancPluginExtendOrthancExplorer(OrthancPlugins::GetGlobalContext(), explorer.c_str()); + { + // Extend the default Orthanc Explorer with custom JavaScript for WSI + + std::string explorer; + Orthanc::EmbeddedResources::GetFileResource(explorer, Orthanc::EmbeddedResources::ORTHANC_EXPLORER); + + std::map dictionary; + dictionary["SERVE_MIRADOR"] = (serveMirador ? "true" : "false"); + explorer = Orthanc::Toolbox::SubstituteVariables(explorer, dictionary); + + OrthancPluginExtendOrthancExplorer(OrthancPlugins::GetGlobalContext(), explorer.c_str()); + } return 0; } diff -r c72fbdecdc38 -r b9eab260a372 ViewerPlugin/mirador.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ViewerPlugin/mirador.html Mon Jul 10 09:21:48 2023 +0200 @@ -0,0 +1,27 @@ + + + + + + + Mirador + + + + +
+ + + +