Skip to content

Commit

Permalink
Merge pull request #932 from thewtex/package-bump
Browse files Browse the repository at this point in the history
package bump
  • Loading branch information
thewtex authored Sep 11, 2023
2 parents 324ffc3 + 7ba3409 commit b1289e3
Show file tree
Hide file tree
Showing 17 changed files with 436 additions and 298 deletions.
5 changes: 3 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,13 @@
# [1.0.0-b.137](https://github.com/InsightSoftwareConsortium/itk-wasm/compare/itk-wasm-v1.0.0-b.136...itk-wasm-v1.0.0-b.137) (2023-09-10)



### Performance Improvements

* bump packages to itk-wasm 1.0.0-b.136 ([d45eb61](https://github.com/InsightSoftwareConsortium/itk-wasm/commit/d45eb618505cdbf00821f60984d71abdbb7e67a4))
* bump packages to itk-wasm 1.0.0-b.137 ([d45eb61](https://github.com/InsightSoftwareConsortium/itk-wasm/commit/d45eb618505cdbf00821f60984d71abdbb7e67a4))
* support demo pre-runs ([9ad1dfa](https://github.com/InsightSoftwareConsortium/itk-wasm/commit/9ad1dfac140db6cff925df3b6b13b7f18e9fe44f))

# [1.0.0-b.136](https://github.com/InsightSoftwareConsortium/itk-wasm/compare/itk-wasm-v1.0.0-b.135...itk-wasm-v1.0.0-b.136) (2023-09-07)
# [1.0.0-b.137](https://github.com/InsightSoftwareConsortium/itk-wasm/compare/itk-wasm-v1.0.0-b.135...itk-wasm-v1.0.0-b.137) (2023-09-07)


### Features
Expand Down
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,12 @@
"build:webpack": "webpack --mode production --progress --color && webpack --mode development --progress --color",
"build:emscripten": "node ./src/build-emscripten.js",
"build:emscripten:compress-stringify": "node ./src/itk-wasm-cli.js -s packages/compress-stringify -b emscripten-build build ",
"build:bindgen:typescript:compress-stringify": "./src/itk-wasm-cli.js -s packages/compress-stringify -b emscripten-build bindgen --package-version 0.5.3 --package-name @itk-wasm/compress-stringify --package-description \"Zstandard compression and decompression and base64 encoding and decoding in WebAssembly.\" --repository 'https://github.com/InsightSoftwareConsortium/itk-wasm'",
"build:bindgen:python:compress-stringify": "./src/itk-wasm-cli.js -s packages/compress-stringify -b wasi-build bindgen --interface python --package-name itkwasm-compress-stringify --package-description \"Zstandard compression and decompression and base64 encoding and decoding in WebAssembly.\" --package-version 0.5.3 --repository 'https://github.com/InsightSoftwareConsortium/itk-wasm'",
"build:bindgen:python-web-demo:compress-stringify": "./src/itk-wasm-cli.js -s packages/compress-stringify -b emscripten-build bindgen --interface python-web-demo --package-name itkwasm-compress-stringify --package-description \"Zstandard compression and decompression and base64 encoding and decoding in WebAssembly.\" --package-version 0.5.3 --repository 'https://github.com/InsightSoftwareConsortium/itk-wasm'",
"build:bindgen:typescript:compress-stringify": "./src/itk-wasm-cli.js -s packages/compress-stringify -b emscripten-build bindgen --package-version 0.6.0 --package-name @itk-wasm/compress-stringify --package-description \"Zstandard compression and decompression and base64 encoding and decoding in WebAssembly.\" --repository 'https://github.com/InsightSoftwareConsortium/itk-wasm'",
"build:bindgen:python:compress-stringify": "./src/itk-wasm-cli.js -s packages/compress-stringify -b wasi-build bindgen --interface python --package-name itkwasm-compress-stringify --package-description \"Zstandard compression and decompression and base64 encoding and decoding in WebAssembly.\" --package-version 0.6.0 --repository 'https://github.com/InsightSoftwareConsortium/itk-wasm'",
"build:bindgen:python-web-demo:compress-stringify": "./src/itk-wasm-cli.js -s packages/compress-stringify -b emscripten-build bindgen --interface python-web-demo --package-name itkwasm-compress-stringify --package-description \"Zstandard compression and decompression and base64 encoding and decoding in WebAssembly.\" --package-version 0.6.0 --repository 'https://github.com/InsightSoftwareConsortium/itk-wasm'",
"build:emscripten:dicom": "node ./src/itk-wasm-cli.js -s packages/dicom -b emscripten-build build",
"build:bindgen:typescript:dicom": "./src/itk-wasm-cli.js -s packages/dicom -b emscripten-build bindgen --package-version 3.2.1 --package-name @itk-wasm/dicom --package-description \"Read files and images related to DICOM file format.\" --repository 'https://github.com/InsightSoftwareConsortium/itk-wasm'",
"build:bindgen:python:dicom": "./src/itk-wasm-cli.js -s packages/dicom -b wasi-build bindgen --package-version 3.2.1 --interface python --package-name itkwasm-dicom --package-description \"Read files and images related to DICOM file format.\" --repository 'https://github.com/InsightSoftwareConsortium/itk-wasm'",
"build:bindgen:typescript:dicom": "./src/itk-wasm-cli.js -s packages/dicom -b emscripten-build bindgen --package-version 3.3.0 --package-name @itk-wasm/dicom --package-description \"Read files and images related to DICOM file format.\" --repository 'https://github.com/InsightSoftwareConsortium/itk-wasm'",
"build:bindgen:python:dicom": "./src/itk-wasm-cli.js -s packages/dicom -b wasi-build bindgen --package-version 3.3.0 --interface python --package-name itkwasm-dicom --package-description \"Read files and images related to DICOM file format.\" --repository 'https://github.com/InsightSoftwareConsortium/itk-wasm'",
"build:emscripten:compare-images": "node ./src/itk-wasm-cli.js -s packages/compare-images -b emscripten-build build",
"build:bindgen:typescript:compare-images": "./src/itk-wasm-cli.js -s packages/compare-images -b emscripten-build bindgen --package-version 1.0.1 --package-name @itk-wasm/compare-images --package-description \"Compare images with a tolerance for regression testing.\" --repository 'https://github.com/InsightSoftwareConsortium/itk-wasm'",
"build:bindgen:python:compare-images": "./src/itk-wasm-cli.js -s packages/compare-images -b wasi-build bindgen --package-version 1.0.1 --interface python --package-name itkwasm-compare-images --package-description \"Compare images with a tolerance for regression testing.\" --repository 'https://github.com/InsightSoftwareConsortium/itk-wasm'",
Expand Down
4 changes: 2 additions & 2 deletions packages/compare-images/typescript/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"author": "",
"license": "Apache-2.0",
"dependencies": {
"itk-wasm": "^1.0.0-b.136"
"itk-wasm": "^1.0.0-b.138"
},
"devDependencies": {
"@rollup/plugin-commonjs": "^24.0.0",
Expand Down Expand Up @@ -69,4 +69,4 @@
"type": "git",
"url": "https://github.com/InsightSoftwareConsortium/itk-wasm"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import { readImageFile, copyImage } from 'itk-wasm'
import { writeImageArrayBuffer, copyImage } from 'itk-wasm'
import * as compareImages from '../../../dist/bundles/compare-images.js'
import compareDoubleImagesLoadSampleInputs from "./compare-double-images-load-sample-inputs.js"
import compareDoubleImagesLoadSampleInputs, { usePreRun } from "./compare-double-images-load-sample-inputs.js"

class CompareDoubleImagesModel {

Expand Down Expand Up @@ -132,6 +132,23 @@ class CompareDoubleImagesController {
}
})

const tabGroup = document.querySelector('sl-tab-group')
tabGroup.addEventListener('sl-tab-show', async (event) => {
if (event.detail.name === 'compareDoubleImages-panel') {
const params = new URLSearchParams(window.location.search)
if (!params.has('functionName') || params.get('functionName') !== 'compareDoubleImages') {
params.set('functionName', 'compareDoubleImages')
const url = new URL(document.location)
url.search = params
window.history.replaceState({ functionName: 'compareDoubleImages' }, '', url)
}
if (!this.webWorker && loadSampleInputs && usePreRun) {
await loadSampleInputs(model, true)
await this.run()
}
}
})

const runButton = document.querySelector('#compareDoubleImagesInputs sl-button[name="run"]')
runButton.addEventListener('click', async (event) => {
event.preventDefault()
Expand All @@ -144,16 +161,11 @@ class CompareDoubleImagesController {

try {
runButton.loading = true
const t0 = performance.now()

const { webWorker, metrics, differenceImage, differenceUchar2dImage, } = await compareImages.compareDoubleImages(this.webWorker,
copyImage(model.inputs.get('testImage')),
Object.fromEntries(model.options.entries())
)

const t0 = performance.now()
const { metrics, differenceImage, differenceUchar2dImage, } = await this.run()
const t1 = performance.now()
globalThis.notify("compareDoubleImages successfully completed", `in ${t1 - t0} milliseconds.`, "success", "rocket-fill")
this.webWorker = webWorker

model.outputs.set("metrics", metrics)
metricsOutputDownload.variant = "success"
Expand Down Expand Up @@ -186,6 +198,16 @@ class CompareDoubleImagesController {
}
})
}

async run() {
const { webWorker, metrics, differenceImage, differenceUchar2dImage, } = await compareImages.compareDoubleImages(this.webWorker,
copyImage(this.model.inputs.get('testImage')),
Object.fromEntries(this.model.options.entries())
)
this.webWorker = webWorker

return { metrics, differenceImage, differenceUchar2dImage, }
}
}

const compareDoubleImagesController = new CompareDoubleImagesController(compareDoubleImagesLoadSampleInputs)
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,21 @@ export default null
// This function should load sample inputs:
//
// 1) In the provided model map.
// 2) Into the corresponding HTML input elements.
// 2) Into the corresponding HTML input elements if preRun is not true.
//
// Example for an input named `exampleInput`:

// const exampleInput = 5
// model.inputs.set("exampleInput", exampleInput)
// const exampleElement = document.querySelector("#compareDoubleImagesInputs [name=example-input]")
// exampleElement.value = 5
// if (!preRun) {
// const exampleElement = document.querySelector("#compareDoubleImagesInputs [name=example-input]")
// exampleElement.value = 5
// }

// return model
// }

// Use this function to run the pipeline when this tab group is select.
// This will load the web worker if it is not already loaded, download the wasm module, and allocate memory in the wasm model.
// Set this to `false` if sample inputs are very large or sample pipeline computation is long.
export usePreRun = true
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import { readImageFile, copyImage } from 'itk-wasm'
import { writeImageArrayBuffer, copyImage } from 'itk-wasm'
import * as compareImages from '../../../dist/bundles/compare-images.js'
import vectorMagnitudeLoadSampleInputs from "./vector-magnitude-load-sample-inputs.js"
import vectorMagnitudeLoadSampleInputs, { usePreRun } from "./vector-magnitude-load-sample-inputs.js"

class VectorMagnitudeModel {

Expand Down Expand Up @@ -73,6 +73,23 @@ class VectorMagnitudeController {
}
})

const tabGroup = document.querySelector('sl-tab-group')
tabGroup.addEventListener('sl-tab-show', async (event) => {
if (event.detail.name === 'vectorMagnitude-panel') {
const params = new URLSearchParams(window.location.search)
if (!params.has('functionName') || params.get('functionName') !== 'vectorMagnitude') {
params.set('functionName', 'vectorMagnitude')
const url = new URL(document.location)
url.search = params
window.history.replaceState({ functionName: 'vectorMagnitude' }, '', url)
}
if (!this.webWorker && loadSampleInputs && usePreRun) {
await loadSampleInputs(model, true)
await this.run()
}
}
})

const runButton = document.querySelector('#vectorMagnitudeInputs sl-button[name="run"]')
runButton.addEventListener('click', async (event) => {
event.preventDefault()
Expand All @@ -85,16 +102,11 @@ class VectorMagnitudeController {

try {
runButton.loading = true
const t0 = performance.now()

const { webWorker, magnitudeImage, } = await compareImages.vectorMagnitude(this.webWorker,
copyImage(model.inputs.get('vectorImage')),
Object.fromEntries(model.options.entries())
)

const t0 = performance.now()
const { magnitudeImage, } = await this.run()
const t1 = performance.now()
globalThis.notify("vectorMagnitude successfully completed", `in ${t1 - t0} milliseconds.`, "success", "rocket-fill")
this.webWorker = webWorker

model.outputs.set("magnitudeImage", magnitudeImage)
magnitudeImageOutputDownload.variant = "success"
Expand All @@ -111,6 +123,16 @@ class VectorMagnitudeController {
}
})
}

async run() {
const { webWorker, magnitudeImage, } = await compareImages.vectorMagnitude(this.webWorker,
copyImage(this.model.inputs.get('vectorImage')),
Object.fromEntries(this.model.options.entries())
)
this.webWorker = webWorker

return { magnitudeImage, }
}
}

const vectorMagnitudeController = new VectorMagnitudeController(vectorMagnitudeLoadSampleInputs)
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,21 @@ export default null
// This function should load sample inputs:
//
// 1) In the provided model map.
// 2) Into the corresponding HTML input elements.
// 2) Into the corresponding HTML input elements if preRun is not true.
//
// Example for an input named `exampleInput`:

// const exampleInput = 5
// model.inputs.set("exampleInput", exampleInput)
// const exampleElement = document.querySelector("#vectorMagnitudeInputs [name=example-input]")
// exampleElement.value = 5
// if (!preRun) {
// const exampleElement = document.querySelector("#vectorMagnitudeInputs [name=example-input]")
// exampleElement.value = 5
// }

// return model
// }

// Use this function to run the pipeline when this tab group is select.
// This will load the web worker if it is not already loaded, download the wasm module, and allocate memory in the wasm model.
// Set this to `false` if sample inputs are very large or sample pipeline computation is long.
export usePreRun = true
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.5.3"
__version__ = "0.6.0"
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.5.3"
__version__ = "0.6.0"
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.5.3"
__version__ = "0.6.0"
Loading

0 comments on commit b1289e3

Please sign in to comment.