diff --git a/wasm/elastix-wasm.cxx b/wasm/elastix-wasm.cxx index 6f35a84d..79e79d95 100644 --- a/wasm/elastix-wasm.cxx +++ b/wasm/elastix-wasm.cxx @@ -54,7 +54,7 @@ class PipelineFunctor pipeline.add_option("-m,--moving", movingImage, "Moving image")->type_name("INPUT_IMAGE"); std::string initialTransformFile; - pipeline.add_option("-i,--initial-transform", initialTransformFile, "Initial transform to apply before registrtion ")->type_name("INPUT_BINARY_FILE"); + pipeline.add_option("-i,--initial-transform", initialTransformFile, "Initial transform to apply before registration")->type_name("INPUT_BINARY_FILE"); itk::wasm::InputTextStream parameterObjectJson; pipeline.add_option("parameter-object", parameterObjectJson, "Elastix parameter object representation") diff --git a/wasm/python/itkwasm-elastix-emscripten/itkwasm_elastix_emscripten/elastix_async.py b/wasm/python/itkwasm-elastix-emscripten/itkwasm_elastix_emscripten/elastix_async.py index 1124295e..629816f9 100644 --- a/wasm/python/itkwasm-elastix-emscripten/itkwasm_elastix_emscripten/elastix_async.py +++ b/wasm/python/itkwasm-elastix-emscripten/itkwasm_elastix_emscripten/elastix_async.py @@ -36,7 +36,7 @@ async def elastix_async( :param moving: Moving image :type moving: Image - :param initial_transform: Initial transform to apply before registrtion + :param initial_transform: Initial transform to apply before registration :type initial_transform: os.PathLike :return: Resampled moving image diff --git a/wasm/python/itkwasm-elastix-wasi/itkwasm_elastix_wasi/elastix.py b/wasm/python/itkwasm-elastix-wasi/itkwasm_elastix_wasi/elastix.py index 6fc239e8..fa200701 100644 --- a/wasm/python/itkwasm-elastix-wasi/itkwasm_elastix_wasi/elastix.py +++ b/wasm/python/itkwasm-elastix-wasi/itkwasm_elastix_wasi/elastix.py @@ -36,7 +36,7 @@ def elastix( :param moving: Moving image :type moving: Image - :param initial_transform: Initial transform to apply before registrtion + :param initial_transform: Initial transform to apply before registration :type initial_transform: os.PathLike :return: Resampled moving image diff --git a/wasm/python/itkwasm-elastix-wasi/itkwasm_elastix_wasi/wasm_modules/elastix.wasi.wasm b/wasm/python/itkwasm-elastix-wasi/itkwasm_elastix_wasi/wasm_modules/elastix.wasi.wasm index bb152ccf..81ab220f 100755 Binary files a/wasm/python/itkwasm-elastix-wasi/itkwasm_elastix_wasi/wasm_modules/elastix.wasi.wasm and b/wasm/python/itkwasm-elastix-wasi/itkwasm_elastix_wasi/wasm_modules/elastix.wasi.wasm differ diff --git a/wasm/python/itkwasm-elastix/itkwasm_elastix/elastix.py b/wasm/python/itkwasm-elastix/itkwasm_elastix/elastix.py index 647d99f3..85ccc2de 100644 --- a/wasm/python/itkwasm-elastix/itkwasm_elastix/elastix.py +++ b/wasm/python/itkwasm-elastix/itkwasm_elastix/elastix.py @@ -26,7 +26,7 @@ def elastix( :param moving: Moving image :type moving: Image - :param initial_transform: Initial transform to apply before registrtion + :param initial_transform: Initial transform to apply before registration :type initial_transform: os.PathLike :return: Resampled moving image diff --git a/wasm/python/itkwasm-elastix/itkwasm_elastix/elastix_async.py b/wasm/python/itkwasm-elastix/itkwasm_elastix/elastix_async.py index 16eb467e..b7672d90 100644 --- a/wasm/python/itkwasm-elastix/itkwasm_elastix/elastix_async.py +++ b/wasm/python/itkwasm-elastix/itkwasm_elastix/elastix_async.py @@ -26,7 +26,7 @@ async def elastix_async( :param moving: Moving image :type moving: Image - :param initial_transform: Initial transform to apply before registrtion + :param initial_transform: Initial transform to apply before registration :type initial_transform: os.PathLike :return: Resampled moving image diff --git a/wasm/typescript/cypress/e2e/write-parameter-files.cy.ts b/wasm/typescript/cypress/e2e/write-parameter-files.cy.ts index 218505e3..ca4edff9 100644 --- a/wasm/typescript/cypress/e2e/write-parameter-files.cy.ts +++ b/wasm/typescript/cypress/e2e/write-parameter-files.cy.ts @@ -17,12 +17,13 @@ describe('writeParameterFiles', () => { it('Write parameter files from a parameter object representation', function () { cy.get('sl-tab[panel="writeParameterFiles-panel"]').click() - const parametersFile = { contents: new Uint8Array(this['parameters_multiple.json']), fileName: 'parameters_multiple.json' } - cy.get('#writeParameterFilesInputs input[name="parameter-object-file"]').selectFile([parametersFile,], { force: true }) + cy.get('#writeParameterFilesInputs sl-button[name="loadSampleInputs"]').click() cy.get('#writeParameterFiles-parameter-object-details').should('contain', '"AutomaticScalesEstimation"') + // cy.get returns a jquery object -- invoke to get the underlying element + cy.get('#writeParameterFilesInputs [name="parameter-files"]').invoke('get', '0').its('value').should('contain', 'translation') cy.get('#writeParameterFilesInputs sl-button[name="run"]').click() - cy.get('#writeParameterFiles-parameter-files-details').should('contain', '"AutomaticScalesEstimation"') + cy.get('#writeParameterFiles-parameter-files-details').should('contain', 'AutomaticScalesEstimation') }) }) diff --git a/wasm/typescript/dist/pipelines/elastix.wasm b/wasm/typescript/dist/pipelines/elastix.wasm index 97a72905..64d94949 100755 Binary files a/wasm/typescript/dist/pipelines/elastix.wasm and b/wasm/typescript/dist/pipelines/elastix.wasm differ diff --git a/wasm/typescript/package-lock.json b/wasm/typescript/package-lock.json index fd8aa186..ff652404 100644 --- a/wasm/typescript/package-lock.json +++ b/wasm/typescript/package-lock.json @@ -9,7 +9,7 @@ "version": "0.1.0", "license": "Apache-2.0", "dependencies": { - "itk-wasm": "^1.0.0-b.140" + "itk-wasm": "^1.0.0-b.142" }, "devDependencies": { "@rollup/plugin-commonjs": "^24.0.0", @@ -22,7 +22,7 @@ "ava": "^5.3.1", "cypress": "^13.2.0", "debug": "^4.3.4", - "itk-image-io": "^1.0.0-b.140", + "itk-image-io": "^1.0.0-b.142", "rollup": "^3.9.0", "rollup-plugin-copy": "^3.4.0", "rollup-plugin-ignore": "^1.0.10", @@ -37,9 +37,9 @@ } }, "node_modules/@babel/runtime": { - "version": "7.22.15", - "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.22.15.tgz", - "integrity": "sha512-T0O+aa+4w0u06iNmapipJXMV4HoUir03hpx3/YqXXhu9xim3w+dVphjFWl1OH8NbZHw5Lbm9k45drDkgq2VNNA==", + "version": "7.23.1", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.23.1.tgz", + "integrity": "sha512-hC2v6p8ZSI/W0HUzh3V8C5g+NwSKzKPtJwSpTjwl0o297GP9+ZLQSkdvHz46CM3LqyoXxq+5G9komY+eSqSO0g==", "dependencies": { "regenerator-runtime": "^0.14.0" }, @@ -3148,18 +3148,18 @@ "dev": true }, "node_modules/itk-image-io": { - "version": "1.0.0-b.141", - "resolved": "https://registry.npmjs.org/itk-image-io/-/itk-image-io-1.0.0-b.141.tgz", - "integrity": "sha512-OdJ/pfZrncoB73mXXeP2qq0GcDbXOnDQ2Nb8JZxxhTAA6BUY3daf6gFNpWj+Wu1GseGzpPNGF0s7QykhukXuXA==", + "version": "1.0.0-b.142", + "resolved": "https://registry.npmjs.org/itk-image-io/-/itk-image-io-1.0.0-b.142.tgz", + "integrity": "sha512-RBekgb5emTJLQsF0EPHgZD9TcsyLqvAZEyDIyEC7tN4vNtz3XIBa+9QzZlXDoX1GHdTrRxCIoHYr7QyMOQPrAw==", "dev": true, "dependencies": { - "itk-wasm": "1.0.0-b.141" + "itk-wasm": "1.0.0-b.142" } }, "node_modules/itk-wasm": { - "version": "1.0.0-b.141", - "resolved": "https://registry.npmjs.org/itk-wasm/-/itk-wasm-1.0.0-b.141.tgz", - "integrity": "sha512-kuCwXftLlTgYq/+RTweSzr4o/TVpstVCyBWbxFqvGX4KD57M7XIABNeUBx3ggmrW1YqpY66fWLUC9QUUkZmYrQ==", + "version": "1.0.0-b.142", + "resolved": "https://registry.npmjs.org/itk-wasm/-/itk-wasm-1.0.0-b.142.tgz", + "integrity": "sha512-EMtl91UuG1GhPgPDhHVKsc404OIAevAk0LnglLS4VqSt5cGozgyx6Kx9wdZxw6b0+pTKjJjOiCZsElUCoUzn4Q==", "dependencies": { "@babel/runtime": "^7.15.4", "@thewtex/zstddec": "^0.1.2", diff --git a/wasm/typescript/package.json b/wasm/typescript/package.json index c1bbc28c..272b3034 100644 --- a/wasm/typescript/package.json +++ b/wasm/typescript/package.json @@ -40,7 +40,7 @@ "author": "", "license": "Apache-2.0", "dependencies": { - "itk-wasm": "^1.0.0-b.140" + "itk-wasm": "^1.0.0-b.142" }, "devDependencies": { "@rollup/plugin-commonjs": "^24.0.0", @@ -53,7 +53,7 @@ "ava": "^5.3.1", "cypress": "^13.2.0", "debug": "^4.3.4", - "itk-image-io": "^1.0.0-b.140", + "itk-image-io": "^1.0.0-b.142", "rollup": "^3.9.0", "rollup-plugin-copy": "^3.4.0", "rollup-plugin-ignore": "^1.0.10", diff --git a/wasm/typescript/src/elastix-node.ts b/wasm/typescript/src/elastix-node.ts index 067bdfc7..4c52a159 100644 --- a/wasm/typescript/src/elastix-node.ts +++ b/wasm/typescript/src/elastix-node.ts @@ -67,7 +67,7 @@ async function elastixNode( } if (typeof options.initialTransform !== "undefined") { const initialTransform = options.initialTransform - mountDirs.add(path.dirname(value as string)) + mountDirs.add(path.dirname(initialTransform as string)) args.push('--initial-transform') const name = initialTransform as string diff --git a/wasm/typescript/src/elastix-options.ts b/wasm/typescript/src/elastix-options.ts index 94582fb2..a94cfd8e 100644 --- a/wasm/typescript/src/elastix-options.ts +++ b/wasm/typescript/src/elastix-options.ts @@ -9,7 +9,7 @@ interface ElastixOptions { /** Moving image */ moving?: Image - /** Initial transform to apply before registrtion */ + /** Initial transform to apply before registration */ initialTransform?: string | File | BinaryFile /** Fixed-to-moving transform path */ diff --git a/wasm/typescript/test/browser/demo-app/elastix-load-sample-inputs.ts b/wasm/typescript/test/browser/demo-app/elastix-load-sample-inputs.ts index 2b8aed6d..f283c1b8 100644 --- a/wasm/typescript/test/browser/demo-app/elastix-load-sample-inputs.ts +++ b/wasm/typescript/test/browser/demo-app/elastix-load-sample-inputs.ts @@ -1,6 +1,24 @@ import { readImageArrayBuffer } from "itk-wasm" export default async function elastixLoadSampleInputs (model, preRun=false) { + const dataUrl = 'https://w3s.link/ipfs/bafybeifq7m3mb4m3mgbhft2vqejjgwxx4azmmzuxwf5cubajpyaf4hq2gq/data/input' + + const parameterObjectButton = document.querySelector("#elastixInputs [name=parameter-object-file-button]") + if (!preRun) { + parameterObjectButton.loading = true + } + const parameterObjectFile = 'parameters_multiple.json' + const parameterObjectResponse = await fetch(`${dataUrl}/${parameterObjectFile}`) + const parameterObject = await parameterObjectResponse.json() + model.inputs.set("parameterObject", parameterObject) + + const parameterObjectElement = document.getElementById('elastix-parameter-object-details') + if (!preRun) { + parameterObjectElement.innerHTML = `
${globalThis.escapeHtml(JSON.stringify(parameterObject), globalThis.interfaceTypeJsonReplacer, 2)}` + parameterObjectElement.disabled = false + parameterObjectButton.loading = false + } + const fixedButton = document.querySelector('#elastixInputs sl-button[name=fixed-file-button]') if (!preRun) { fixedButton.loading = true diff --git a/wasm/typescript/test/browser/demo-app/index.html b/wasm/typescript/test/browser/demo-app/index.html index 9d98edb9..e9b17109 100644 --- a/wasm/typescript/test/browser/demo-app/index.html +++ b/wasm/typescript/test/browser/demo-app/index.html @@ -104,7 +104,7 @@