Skip to content

Commit

Permalink
build(compare-images): bump typescript for itk-wasm 1.0.0-b.154
Browse files Browse the repository at this point in the history
  • Loading branch information
thewtex committed Nov 9, 2023
1 parent c222c18 commit f3d016c
Show file tree
Hide file tree
Showing 21 changed files with 2,877 additions and 149 deletions.
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "3.0.1"
__version__ = "4.0.0"

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ classifiers = [
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
]
keywords = [
"itkwasm",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ def input_data():
]
data = {}
for f in test_files:
path = str(input_base_path / f) + '.pickle'
with open(path, 'rb') as fp:
data[str(f.name)] = pickle.load(fp)
with open(input_base_path / f, 'rb') as fp:
data[str(f.name)] = fp.read()
return data
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,25 @@
@run_in_pyodide(packages=['micropip', 'numpy'])
async def test_compare_double_images_async(selenium, package_wheel, input_data):
import micropip
await micropip.install(package_wheel, 'numpy', 'itkwasm')
await micropip.install(package_wheel)
await micropip.install('itkwasm-image-io-emscripten')
def write_input_data_to_fs(input_data, filename):
with open(filename, 'wb') as fp:
fp.write(input_data[filename])

from itkwasm_compare_images_emscripten import compare_double_images_async
import numpy as np
from itkwasm import Image
from itkwasm.pyodide import to_js as itkwasm_to_js
from itkwasm_compare_images_emscripten import compare_double_images_async
from itkwasm_image_io_emscripten import imread_async

test_image_file = 'cake_easy.iwi.cbor'
test_image = Image(**input_data[test_image_file])
write_input_data_to_fs(input_data, test_image_file)
test_image = await imread_async(test_image_file)

baseline_image_file = 'cake_hard.iwi.cbor'
baseline_image = Image(**input_data[baseline_image_file])
write_input_data_to_fs(input_data, baseline_image_file)
baseline_image = await imread_async(baseline_image_file)

metrics, difference_image, difference_image_rendering = await compare_double_images_async(test_image, baseline_images=[baseline_image])

Expand All @@ -37,18 +44,25 @@ async def test_compare_double_images_async(selenium, package_wheel, input_data):
@run_in_pyodide(packages=['micropip', 'numpy'])
async def test_compare_images_async(selenium, package_wheel, input_data):
import micropip
await micropip.install(package_wheel, 'numpy', 'itkwasm')
await micropip.install(package_wheel)
await micropip.install('itkwasm-image-io-emscripten')
def write_input_data_to_fs(input_data, filename):
with open(filename, 'wb') as fp:
fp.write(input_data[filename])

from itkwasm_compare_images_emscripten import compare_images_async
from itkwasm_image_io_emscripten import imread_async
import numpy as np
from itkwasm import Image
from itkwasm.pyodide import to_js as itkwasm_to_js

test_image_file = 'cake_easy.iwi.cbor'
test_image = Image(**input_data[test_image_file])
write_input_data_to_fs(input_data, test_image_file)
test_image = await imread_async(test_image_file)

baseline_image_file = 'cake_hard.iwi.cbor'
baseline_image = Image(**input_data[baseline_image_file])
write_input_data_to_fs(input_data, baseline_image_file)
baseline_image = await imread_async(baseline_image_file)

metrics, difference_image, difference_image_rendering = await compare_images_async(test_image, baseline_images=[baseline_image])

Expand All @@ -63,10 +77,12 @@ async def test_compare_images_async(selenium, package_wheel, input_data):
assert difference_image_rendering.imageType.componentType == 'uint8'

test_image_file = 'cake_easy.png'
test_image = Image(**input_data[test_image_file])
write_input_data_to_fs(input_data, test_image_file)
test_image = await imread_async(test_image_file)

baseline_image_file = 'cake_hard.png'
baseline_image = Image(**input_data[baseline_image_file])
write_input_data_to_fs(input_data, baseline_image_file)
baseline_image = await imread_async(baseline_image_file)

metrics, difference_image, difference_image_rendering = await compare_images_async(test_image, baseline_images=[baseline_image])

Expand All @@ -81,19 +97,21 @@ async def test_compare_images_async(selenium, package_wheel, input_data):
assert difference_image_rendering.imageType.componentType == 'uint8'

test_image_file = 'apple.jpg'
test_image = Image(**input_data[test_image_file])
write_input_data_to_fs(input_data, test_image_file)
test_image = await imread_async(test_image_file)

baseline_image_file = 'orange.jpg'
baseline_image = Image(**input_data[baseline_image_file])
write_input_data_to_fs(input_data, baseline_image_file)
baseline_image = await imread_async(baseline_image_file)

metrics, difference_image, difference_image_rendering = await compare_images_async(test_image, baseline_images=[baseline_image])

assert metrics['almostEqual'] == False
assert metrics['numberOfPixelsWithDifferences'] == 26477
assert metrics['minimumDifference'] == 0.002273026683894841
assert metrics['maximumDifference'] == 312.2511648746159
assert metrics['totalDifference'] == 3121656.100202402
assert metrics['meanDifference'] == 117.90067228924735
assert metrics['totalDifference'] == 3121703.1639738297
assert metrics['meanDifference'] == 117.90244982338746

assert difference_image.imageType.componentType == 'float64'
assert difference_image_rendering.imageType.componentType == 'uint8'
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "3.0.1"
__version__ = "4.0.0"
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "3.0.1"
__version__ = "4.0.0"
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ def input_data():
]
data = {}
for f in test_files:
path = str(input_base_path / f) + '.pickle'
with open(path, 'rb') as fp:
data[str(f.name)] = pickle.load(fp)
with open(input_base_path / f, 'rb') as fp:
data[str(f.name)] = fp.read()
return data
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,25 @@
@run_in_pyodide(packages=['micropip', 'numpy'])
async def test_compare_double_images_async(selenium, package_wheel, input_data):
import micropip
await micropip.install(package_wheel, 'numpy', 'itkwasm')
await micropip.install(package_wheel)
await micropip.install('itkwasm-image-io-emscripten')
def write_input_data_to_fs(input_data, filename):
with open(filename, 'wb') as fp:
fp.write(input_data[filename])

from itkwasm_compare_images import compare_double_images_async
import numpy as np
from itkwasm import Image
from itkwasm.pyodide import to_js as itkwasm_to_js
from itkwasm_image_io_emscripten import imread_async

test_image_file = 'cake_easy.iwi.cbor'
test_image = Image(**input_data[test_image_file])
write_input_data_to_fs(input_data, test_image_file)
test_image = await imread_async(test_image_file)

baseline_image_file = 'cake_hard.iwi.cbor'
baseline_image = Image(**input_data[baseline_image_file])
write_input_data_to_fs(input_data, baseline_image_file)
baseline_image = await imread_async(baseline_image_file)

metrics, difference_image, difference_image_rendering = await compare_double_images_async(test_image, baseline_images=[baseline_image])

Expand All @@ -37,18 +44,25 @@ async def test_compare_double_images_async(selenium, package_wheel, input_data):
@run_in_pyodide(packages=['micropip', 'numpy'])
async def test_compare_images_async(selenium, package_wheel, input_data):
import micropip
await micropip.install(package_wheel, 'numpy', 'itkwasm')
await micropip.install(package_wheel)
await micropip.install('itkwasm-image-io-emscripten')
def write_input_data_to_fs(input_data, filename):
with open(filename, 'wb') as fp:
fp.write(input_data[filename])

from itkwasm_compare_images import compare_images_async
import numpy as np
from itkwasm import Image
from itkwasm.pyodide import to_js as itkwasm_to_js
from itkwasm_image_io_emscripten import imread_async

test_image_file = 'cake_easy.iwi.cbor'
test_image = Image(**input_data[test_image_file])
write_input_data_to_fs(input_data, test_image_file)
test_image = await imread_async(test_image_file)

baseline_image_file = 'cake_hard.iwi.cbor'
baseline_image = Image(**input_data[baseline_image_file])
write_input_data_to_fs(input_data, baseline_image_file)
baseline_image = await imread_async(baseline_image_file)

metrics, difference_image, difference_image_rendering = await compare_images_async(test_image, baseline_images=[baseline_image])

Expand All @@ -63,10 +77,12 @@ async def test_compare_images_async(selenium, package_wheel, input_data):
assert difference_image_rendering.imageType.componentType == 'uint8'

test_image_file = 'cake_easy.png'
test_image = Image(**input_data[test_image_file])
write_input_data_to_fs(input_data, test_image_file)
test_image = await imread_async(test_image_file)

baseline_image_file = 'cake_hard.png'
baseline_image = Image(**input_data[baseline_image_file])
write_input_data_to_fs(input_data, baseline_image_file)
baseline_image = await imread_async(baseline_image_file)

metrics, difference_image, difference_image_rendering = await compare_images_async(test_image, baseline_images=[baseline_image])

Expand All @@ -81,19 +97,21 @@ async def test_compare_images_async(selenium, package_wheel, input_data):
assert difference_image_rendering.imageType.componentType == 'uint8'

test_image_file = 'apple.jpg'
test_image = Image(**input_data[test_image_file])
write_input_data_to_fs(input_data, test_image_file)
test_image = await imread_async(test_image_file)

baseline_image_file = 'orange.jpg'
baseline_image = Image(**input_data[baseline_image_file])
write_input_data_to_fs(input_data, baseline_image_file)
baseline_image = await imread_async(baseline_image_file)

metrics, difference_image, difference_image_rendering = await compare_images_async(test_image, baseline_images=[baseline_image])

assert metrics['almostEqual'] == False
assert metrics['numberOfPixelsWithDifferences'] == 26477
assert metrics['minimumDifference'] == 0.002273026683894841
assert metrics['maximumDifference'] == 312.2511648746159
assert metrics['totalDifference'] == 3121656.100202402
assert metrics['meanDifference'] == 117.90067228924735
assert metrics['totalDifference'] == 3121703.1639738297
assert metrics['meanDifference'] == 117.90244982338746

assert difference_image.imageType.componentType == 'float64'
assert difference_image_rendering.imageType.componentType == 'uint8'
49 changes: 0 additions & 49 deletions packages/compare-images/typescript/build/rollup.browser.config.js

This file was deleted.

36 changes: 0 additions & 36 deletions packages/compare-images/typescript/build/rollup.node.config.js

This file was deleted.

2 changes: 1 addition & 1 deletion packages/compare-images/typescript/build/vite.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export default defineConfig({
format: 'es'
},
optimizeDeps: {
exclude: ['@itk-wasm/image-io']
exclude: ['itk-wasm', '@itk-wasm/image-io']
},
plugins: [
// put lazy loaded JavaScript and Wasm bundles in dist directory
Expand Down
Loading

0 comments on commit f3d016c

Please sign in to comment.