Mercurial > hg > orthanc-wsi
comparison ViewerPlugin/Plugin.cpp @ 263:14f182958ca7 iiif
added button to access IIIF manifest of series
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Mon, 10 Jul 2023 09:44:28 +0200 |
parents | b9eab260a372 |
children | 0040ce361d4c |
comparison
equal
deleted
inserted
replaced
262:b9eab260a372 | 263:14f182958ca7 |
---|---|
286 OrthancPlugins::RegisterRestCallback<ServeFile>("/wsi/app/(viewer.html)", true); | 286 OrthancPlugins::RegisterRestCallback<ServeFile>("/wsi/app/(viewer.html)", true); |
287 OrthancPlugins::RegisterRestCallback<ServeFile>("/wsi/app/(viewer.js)", true); | 287 OrthancPlugins::RegisterRestCallback<ServeFile>("/wsi/app/(viewer.js)", true); |
288 OrthancPlugins::RegisterRestCallback<ServePyramid>("/wsi/pyramids/([0-9a-f-]+)", true); | 288 OrthancPlugins::RegisterRestCallback<ServePyramid>("/wsi/pyramids/([0-9a-f-]+)", true); |
289 OrthancPlugins::RegisterRestCallback<ServeTile>("/wsi/tiles/([0-9a-f-]+)/([0-9-]+)/([0-9-]+)/([0-9-]+)", true); | 289 OrthancPlugins::RegisterRestCallback<ServeTile>("/wsi/tiles/([0-9a-f-]+)/([0-9-]+)/([0-9-]+)/([0-9-]+)", true); |
290 | 290 |
291 bool serveMirador = true; // TODO => CONFIG | 291 bool serveMirador; |
292 | 292 bool serveIIIF = true; // TODO => CONFIG |
293 if (serveMirador) | 293 std::string iiifPublicUrl; |
294 { | 294 |
295 OrthancPlugins::RegisterRestCallback<ServeFile>("/wsi/app/(mirador.html)", true); | 295 if (serveIIIF) |
296 } | |
297 | |
298 { | 296 { |
299 // TODO => CONFIG | 297 // TODO => CONFIG |
300 std::string url = "http://localhost:8042/wsi/iiif"; | 298 iiifPublicUrl = "http://localhost:8042/wsi/iiif"; |
301 | 299 |
302 if (url.empty() || | 300 if (iiifPublicUrl.empty() || |
303 url[url.size() - 1] != '/') | 301 iiifPublicUrl[iiifPublicUrl.size() - 1] != '/') |
304 { | 302 { |
305 url += "/"; | 303 iiifPublicUrl += "/"; |
306 } | 304 } |
307 | 305 |
308 InitializeIIIF(url); | 306 InitializeIIIF(iiifPublicUrl); |
307 | |
308 serveMirador = true; // TODO => CONFIG | |
309 | |
310 if (serveMirador) | |
311 { | |
312 OrthancPlugins::RegisterRestCallback<ServeFile>("/wsi/app/(mirador.html)", true); | |
313 } | |
314 } | |
315 else | |
316 { | |
317 serveMirador = false; | |
309 } | 318 } |
310 | 319 |
311 { | 320 { |
312 // Extend the default Orthanc Explorer with custom JavaScript for WSI | 321 // Extend the default Orthanc Explorer with custom JavaScript for WSI |
313 | 322 |
314 std::string explorer; | 323 std::string explorer; |
315 Orthanc::EmbeddedResources::GetFileResource(explorer, Orthanc::EmbeddedResources::ORTHANC_EXPLORER); | 324 Orthanc::EmbeddedResources::GetFileResource(explorer, Orthanc::EmbeddedResources::ORTHANC_EXPLORER); |
316 | 325 |
317 std::map<std::string, std::string> dictionary; | 326 std::map<std::string, std::string> dictionary; |
327 dictionary["SERVE_IIIF"] = (serveIIIF ? "true" : "false"); | |
318 dictionary["SERVE_MIRADOR"] = (serveMirador ? "true" : "false"); | 328 dictionary["SERVE_MIRADOR"] = (serveMirador ? "true" : "false"); |
329 dictionary["IIIF_PUBLIC_URL"] = iiifPublicUrl; | |
319 explorer = Orthanc::Toolbox::SubstituteVariables(explorer, dictionary); | 330 explorer = Orthanc::Toolbox::SubstituteVariables(explorer, dictionary); |
320 | 331 |
321 OrthancPluginExtendOrthancExplorer(OrthancPlugins::GetGlobalContext(), explorer.c_str()); | 332 OrthancPluginExtendOrthancExplorer(OrthancPlugins::GetGlobalContext(), explorer.c_str()); |
322 } | 333 } |
323 | 334 |