From 4c1f4932d6e4410f13f836d98161b7f3f4984c78 Mon Sep 17 00:00:00 2001 From: Matt McCormick Date: Sun, 22 Oct 2023 22:37:51 -0400 Subject: [PATCH] test(itkwasm-image-io-wasi): add lsm test --- .../itkwasm-image-io-wasi/tests/test_lsm.py | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 packages/image-io/python/itkwasm-image-io-wasi/tests/test_lsm.py diff --git a/packages/image-io/python/itkwasm-image-io-wasi/tests/test_lsm.py b/packages/image-io/python/itkwasm-image-io-wasi/tests/test_lsm.py new file mode 100644 index 000000000..59e66b4dd --- /dev/null +++ b/packages/image-io/python/itkwasm-image-io-wasi/tests/test_lsm.py @@ -0,0 +1,28 @@ +from itkwasm_image_io_wasi import lsm_read_image + +from .common import test_input_path + +test_input_file_path = test_input_path / "cthead1.lsm" + +def verify_image(image): + assert image.imageType.dimension == 2 + assert image.imageType.componentType == "uint8" + assert image.imageType.pixelType == "RGB" + assert image.imageType.components == 4 + assert image.origin[0] == 0.0 + assert image.origin[1] == 0.0 + assert image.spacing[0] == 1.0e-8 + assert image.spacing[1] == 1.0e-8 + assert image.direction[0, 0] == 1.0 + assert image.direction[0, 1] == 0.0 + assert image.direction[1, 0] == 0.0 + assert image.direction[1, 1] == 1.0 + assert image.size[0] == 256 + assert image.size[1] == 256 + assert image.data.shape[1] == 256 + assert image.data.shape[0] == 256 + +def test_lsm_read_image(): + could_read, image = lsm_read_image(test_input_file_path) + assert could_read + verify_image(image) \ No newline at end of file