Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 68 additions & 1 deletion packages/downsample/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ elseif(WASI)
else()
set(io_components
ITKImageIO
ITKIOTransformInsightLegacy
ITKIOTransformHDF5
)
endif()

Expand All @@ -21,12 +23,14 @@ find_package(ITK REQUIRED
WebAssemblyInterface
ITKSmoothing
ITKImageGrid
ITKImageFunction
ITKTransform
GenericLabelInterpolator
${io_components}
)
include(${ITK_USE_FILE})

foreach(pipeline downsample downsample-sigma gaussian-kernel-radius downsample-bin-shrink downsample-label-image)
foreach(pipeline downsample downsample-sigma gaussian-kernel-radius downsample-bin-shrink downsample-label-image resample)
add_executable(${pipeline} ${pipeline}.cxx)
target_link_libraries(${pipeline} PUBLIC ${ITK_LIBRARIES})
target_include_directories(${pipeline} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
Expand Down Expand Up @@ -69,3 +73,66 @@ add_test(NAME downsample-label-image
${CMAKE_CURRENT_BINARY_DIR}/cthead1_downsampled_label_image.png
--shrink-factors 2 2
)

# Self-contained smoke test: use cthead1.png as both the moving image and the
# reference geometry with the default identity transform, so the resampled
# output closely matches the input. Needs no new test data.
add_test(NAME resample
COMMAND resample
${CMAKE_CURRENT_SOURCE_DIR}/test/data/input/cthead1.png
${CMAKE_CURRENT_SOURCE_DIR}/test/data/input/cthead1.png
${CMAKE_CURRENT_BINARY_DIR}/cthead1_resampled.png
--interpolator linear
)

# Interpolator coverage: one self-contained test per interpolator, using
# cthead1.png as both the moving image and the reference geometry (identity
# transform), so every interpolator selection is exercised. Needs no new data.
add_test(NAME resample-linear
COMMAND resample
${CMAKE_CURRENT_SOURCE_DIR}/test/data/input/cthead1.png
${CMAKE_CURRENT_SOURCE_DIR}/test/data/input/cthead1.png
${CMAKE_CURRENT_BINARY_DIR}/cthead1_resampled_linear.png
--interpolator linear
)

add_test(NAME resample-nearest-neighbor
COMMAND resample
${CMAKE_CURRENT_SOURCE_DIR}/test/data/input/cthead1.png
${CMAKE_CURRENT_SOURCE_DIR}/test/data/input/cthead1.png
${CMAKE_CURRENT_BINARY_DIR}/cthead1_resampled_nearest_neighbor.png
--interpolator nearest_neighbor
)

add_test(NAME resample-b-spline
COMMAND resample
${CMAKE_CURRENT_SOURCE_DIR}/test/data/input/cthead1.png
${CMAKE_CURRENT_SOURCE_DIR}/test/data/input/cthead1.png
${CMAKE_CURRENT_BINARY_DIR}/cthead1_resampled_b_spline.png
--interpolator b_spline
)

add_test(NAME resample-windowed-sinc
COMMAND resample
${CMAKE_CURRENT_SOURCE_DIR}/test/data/input/cthead1.png
${CMAKE_CURRENT_SOURCE_DIR}/test/data/input/cthead1.png
${CMAKE_CURRENT_BINARY_DIR}/cthead1_resampled_windowed_sinc.png
--interpolator windowed_sinc
)

add_test(NAME resample-gaussian
COMMAND resample
${CMAKE_CURRENT_SOURCE_DIR}/test/data/input/cthead1.png
${CMAKE_CURRENT_SOURCE_DIR}/test/data/input/cthead1.png
${CMAKE_CURRENT_BINARY_DIR}/cthead1_resampled_gaussian.png
--interpolator gaussian
)

# Label-image interpolator on the existing multi-label test image.
add_test(NAME resample-label-image
COMMAND resample
${CMAKE_CURRENT_SOURCE_DIR}/test/data/input/2th_cthead1.png
${CMAKE_CURRENT_SOURCE_DIR}/test/data/input/2th_cthead1.png
${CMAKE_CURRENT_BINARY_DIR}/2th_cthead1_resampled_label_image.png
--interpolator label_image
)
6 changes: 3 additions & 3 deletions packages/downsample/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
"itk-wasm": {
"emscripten-docker-image": "docker.io/itkwasm/emscripten:latest",
"wasi-docker-image": "docker.io/itkwasm/wasi:latest",
"test-data-hash": "bafkreigtrr3oeqaunbyhrpuvvhc5hfmpbddc4u52jvonsvr2m2xe5ni3jq",
"test-data-hash": "bafkreiesjpg3sjqkyjb77djrffdvznjjsgvudd2y44iqjrfgnd45uyyprq",
"test-data-urls": [
"https://itk.mypinata.cloud/ipfs/bafkreigtrr3oeqaunbyhrpuvvhc5hfmpbddc4u52jvonsvr2m2xe5ni3jq"
"https://itk.mypinata.cloud/ipfs/bafkreiesjpg3sjqkyjb77djrffdvznjjsgvudd2y44iqjrfgnd45uyyprq"
],
"typescript-package-name": "@itk-wasm/downsample",
"python-package-name": "itkwasm-downsample",
Expand All @@ -28,7 +28,7 @@
"build:gen:typescript": "itk-wasm pnpm-script build:gen:typescript",
"build:gen:python": "pnpm build:wasi && pnpm bindgen:python",
"test": "pnpm test:data:download && pnpm build:gen:python && pnpm test:python",
"test:data:download": "dam download test/data test/data.tar.gz bafkreigtrr3oeqaunbyhrpuvvhc5hfmpbddc4u52jvonsvr2m2xe5ni3jq https://itk.mypinata.cloud/ipfs/bafkreigtrr3oeqaunbyhrpuvvhc5hfmpbddc4u52jvonsvr2m2xe5ni3jq",
"test:data:download": "dam download test/data test/data.tar.gz bafkreiesjpg3sjqkyjb77djrffdvznjjsgvudd2y44iqjrfgnd45uyyprq https://itk.mypinata.cloud/ipfs/bafkreiesjpg3sjqkyjb77djrffdvznjjsgvudd2y44iqjrfgnd45uyyprq",
"test:data:pack": "dam pack test/data test/data.tar.gz",
"test:python:wasi": "pnpm test:data:download && pixi run --manifest-path=./pixi.toml test-wasi",
"test:python:emscripten": "pnpm test:data:download && pixi run --manifest-path=./pixi.toml test-emscripten",
Expand Down
Loading
Loading