import cornerstoneWADOImageLoader from 'cornerstone-wado-image-loader';

/**
 *
 * @param {String} baseDirectory
 * @param {String} webWorkScriptsPath
 */
export default function(baseDirectory, webWorkScriptsPath) {
  const scriptsPath = `${window.location.protocol}//${
    window.location.host
  }${baseDirectory}/${webWorkScriptsPath}`;
  const config = {
    maxWebWorkers: Math.max(navigator.hardwareConcurrency - 1, 1),
    startWebWorkersOnDemand: true,
    webWorkerPath: `${scriptsPath}/cornerstoneWADOImageLoaderWebWorker.min.js`,
    taskConfiguration: {
      decodeTask: {
        loadCodecsOnStartup: true,
        initializeCodecsOnStartup: false,
        codecsPath: `${scriptsPath}/cornerstoneWADOImageLoaderCodecs.min.js`,
        usePDFJS: false,
        strict: false,
      },
    },
  };

  cornerstoneWADOImageLoader.webWorkerManager.initialize(config);
}

@@ -171,17 +171,35 @@
 function
-(
+ initWebWorkers(%0A  
 baseDire
@@ -203,17 +203,25 @@
 irectory
-,
+ = '/',%0A 
  webWork
@@ -235,18 +235,22 @@
 Path
+ = ''%0A
 ) %7B%0A  
-cons
+le
 t sc
@@ -338,17 +338,16 @@
 rectory%7D
-/
 $%7BwebWor
@@ -362,16 +362,141 @@
 Path%7D%60;%0A
+%0A  // Ensure the last character is a slash%0A  if (scriptsPath%5BscriptsPath.length - 1%5D !== '/') %7B%0A    scriptsPath += '/';%0A  %7D%0A%0A
   const 
@@ -634,33 +634,32 @@
  %60$%7BscriptsPath%7D
-/
 cornerstoneWADOI
@@ -844,17 +844,16 @@
 ptsPath%7D
-/
 cornerst

Fix duplicate slashes for web worker paths (#527)