Hi,
When packaging VolView in the Orthanc plugin, Orthanc serves VolView at http://localhost:8042/volview/.
In order for this to work, we actually need to patch VolView code with the below patch.
The way we patch it, VolView can then actually be hosted at any url (because it is actually quite often served at something like https://myserver.com/orthanc/volview/).
Could ease our life for future releases if you allow hosting at any url and might be useful for other people too. Or maybe we are wrong and there is already a configuration for this !
Thanks,
Alain.
diff -urEb VolView-4.3.0.orig/src/io/itk/itkConfig.js VolView-4.3.0/src/io/itk/itkConfig.js
--- VolView-4.3.0.orig/src/io/itk/itkConfig.js 2025-01-16 18:46:08.962374027 +0100
+++ VolView-4.3.0/src/io/itk/itkConfig.js 2025-01-17 11:10:48.362129043 +0100
@@ -2,8 +2,15 @@
const base = import.meta.env.BASE_URL;
-const fullUrl = (relative) =>
- new URL(join(base, relative), document.location.origin).href;
+const fullUrl = (relative) => { // ex: /itk/image-io
+ const u = new URL(document.location); // ex: http://localhost:8043/orthanc/volview/index.html
+ const origin = u.origin; // ex: http://localhost:8043
+ let pathParts = u.pathname.split('/'); // ex: ['', 'orthanc', 'volview', 'index.html']
+ pathParts.pop(); // ex: ['', 'orthanc', 'volview']
+
+ const url = origin + pathParts.join('/') + relative; // ex http://localhost:8043/orthanc/volview/itk/image-io
+ return url;
+}
const itkConfig = {
pipelineWorkerUrl: fullUrl('/itk/itk-wasm-pipeline.min.worker.js'),
diff -urEb VolView-4.3.0.orig/vite.config.ts VolView-4.3.0/vite.config.ts
--- VolView-4.3.0.orig/vite.config.ts 2025-01-16 18:46:08.862370324 +0100
+++ VolView-4.3.0/vite.config.ts 2025-01-16 19:12:29.866854537 +0100
@@ -114,6 +114,7 @@
},
],
},
+
−+ base: './',
plugins: [
{
name: 'virtual-modules',
Hi,
When packaging VolView in the Orthanc plugin, Orthanc serves VolView at http://localhost:8042/volview/.
In order for this to work, we actually need to patch VolView code with the below patch.
The way we patch it, VolView can then actually be hosted at any url (because it is actually quite often served at something like https://myserver.com/orthanc/volview/).
Could ease our life for future releases if you allow hosting at any url and might be useful for other people too. Or maybe we are wrong and there is already a configuration for this !
Thanks,
Alain.