diff --git a/karma.conf.js b/karma.conf.js index 965318a2..ef030702 100644 --- a/karma.conf.js +++ b/karma.conf.js @@ -86,6 +86,12 @@ module.exports = function init(config) { served: true, included: false, }, + { + pattern: './dist/pipeline.worker.js', + watched: true, + served: true, + included: false, + }, { pattern: './src/UI/reference-ui/dist/referenceUIMachineOptions.js', watched: true, diff --git a/src/index.d.ts b/src/index.d.ts index 18c11a34..d47ea87f 100644 --- a/src/index.d.ts +++ b/src/index.d.ts @@ -7,7 +7,7 @@ declare type ndarray = { _rtype: 'ndarray' } -declare type LoadableImage = URL | Image | Store | ndarray +declare type LoadableImage = URL | Store | ndarray | Image declare type ViewerOptions = { image?: LoadableImage @@ -20,7 +20,7 @@ declare type ViewerOptions = { type Viewer = { setBackgroundColor(color: [number, number, number]): void - setImageColorMap(mapName: string, actor: number): void + setImageColorMap(mapName: string, actor?: number): void } declare namespace itkVtkViewer { @@ -51,3 +51,6 @@ declare namespace itkVtkViewer { type version = string } + +export as namespace itkVtkViewer +export = itkVtkViewer diff --git a/src/itkConfig.js b/src/itkConfig.js index fd4f0a09..5a711f96 100644 --- a/src/itkConfig.js +++ b/src/itkConfig.js @@ -1,8 +1,8 @@ const itkConfig = { - pipelineWorkerUrl: __webpack_public_path__ + 'itk/web-workers/min-bundles/pipeline.worker.js', // eslint-disable-line no-undef - imageIOUrl: __webpack_public_path__ + 'itk/image-io', // eslint-disable-line no-undef - meshIOUrl: __webpack_public_path__ + 'itk/mesh-io', // eslint-disable-line no-undef - pipelinesUrl: __webpack_public_path__ + 'itk/pipeline', // eslint-disable-line no-undef + pipelineWorkerUrl: 'pipeline.worker.js', + imageIOUrl: 'itk/image-io', + meshIOUrl: 'itk/mesh-io', + pipelinesUrl: 'itk/pipeline', } export default itkConfig diff --git a/webpack.config.js b/webpack.config.js index 7089a0a4..a6fd0681 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -73,6 +73,7 @@ module.exports = (env, argv) => [ devtool: argv.mode === 'development' ? 'eval-source-map' : 'source-map', output: { filename: 'itkVtkViewer.js', + publicPath: '', }, resolve: { alias: { @@ -94,6 +95,18 @@ module.exports = (env, argv) => [ ), to: path.join(__dirname, 'dist', 'itk', 'web-workers'), }, + { + from: path.join( + __dirname, + 'node_modules', + 'itk-wasm', + 'dist', + 'web-workers', + 'min-bundles', + 'pipeline.worker.js' + ), + to: path.join(__dirname, 'dist', 'pipeline.worker.js'), + }, { from: path.join(__dirname, 'node_modules', 'itk-image-io'), to: path.join(__dirname, 'dist', 'itk', 'image-io'),