-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(WASI): Add mean-squares-versor-registration example
Based on the ImageRegistration8.cxx ITK/Examples/ ITK Software Guide example.
- Loading branch information
Showing
5 changed files
with
674 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
cmake_minimum_required(VERSION 3.16) | ||
project(mean-squares-versor-registration) | ||
|
||
# Use C++17 or newer with itk-wasm | ||
set(CMAKE_CXX_STANDARD 17) | ||
|
||
# We always want to build against the WebAssemblyInterface module. | ||
set(itk_components | ||
WebAssemblyInterface | ||
ITKCommon | ||
ITKImageFilterBase | ||
ITKImageGrid | ||
ITKImageIntensity | ||
ITKMetricsv4 | ||
ITKOptimizersv4 | ||
ITKRegistrationCommon | ||
ITKRegistrationMethodsv4 | ||
ITKTransform | ||
) | ||
# WASI or native binaries | ||
if (NOT EMSCRIPTEN) | ||
# WebAssemblyInterface supports the .iwi, .iwi.cbor itk-wasm format. | ||
# We can list other ITK IO modules to build against to support other | ||
# formats when building native executable or WASI WebAssembly. | ||
# However, this will bloat the size of the WASI WebAssembly binary, so | ||
# add them judiciously. | ||
set(itk_components | ||
${itk_components} | ||
ITKIOMeta | ||
# ITKImageIO # Adds support for all available image IO modules | ||
) | ||
endif() | ||
|
||
find_package(ITK REQUIRED | ||
COMPONENTS ${itk_components} | ||
) | ||
include(${ITK_USE_FILE}) | ||
|
||
# This is modified ITK/Examples/RegistrationITKv4/ImageRegistration8.cxx | ||
add_executable(mean-squares-versor-registration | ||
mean-squares-versor-registration.cxx) | ||
target_link_libraries(mean-squares-versor-registration | ||
PUBLIC ${ITK_LIBRARIES}) | ||
|
||
|
||
enable_testing() | ||
|
||
set(fixed_image ${CMAKE_CURRENT_BINARY_DIR}/brainweb1e1a10f20.mha) | ||
if(NOT EXISTS ${fixed_image}) | ||
message(STATUS "Downloading test fixed image...") | ||
file(DOWNLOAD "https://w3s.link/ipfs/bafybeigdv4jgy3zt5d7vdzq5qzmpofh6fubhnp5qqgkfvr25lozgskzzcq/brainweb1e1a10f20.mha" | ||
${fixed_image} | ||
) | ||
endif() | ||
set(moving_image ${CMAKE_CURRENT_BINARY_DIR}/brainweb1e1a10f20Rot10Tx15.mha) | ||
if(NOT EXISTS ${moving_image}) | ||
message(STATUS "Downloading test moving image...") | ||
file(DOWNLOAD | ||
"https://w3s.link/ipfs/bafybeialjushstijsk7rk45sm2i5sfxyc7uqmtwpeabakqrcrokhlx34tu/brainweb1e1a10f20Rot10Tx15.mha" | ||
${moving_image} | ||
) | ||
endif() | ||
add_test(NAME mean-squares-versor-registration-test | ||
COMMAND mean-squares-versor-registration | ||
${fixed_image} | ||
${moving_image} | ||
${CMAKE_CURRENT_BINARY_DIR}/output_image.mha | ||
) |
Oops, something went wrong.