Skip to content

Commit

Permalink
test(WASI): Add mean-squares-versor-registration example
Browse files Browse the repository at this point in the history
Based on the ImageRegistration8.cxx ITK/Examples/ ITK Software Guide
example.
  • Loading branch information
thewtex committed Mar 16, 2023
1 parent eef6717 commit 3259691
Show file tree
Hide file tree
Showing 5 changed files with 674 additions and 3 deletions.
2 changes: 1 addition & 1 deletion examples/inputs-outputs/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ find_package(ITK REQUIRED
include(${ITK_USE_FILE})

add_executable(inputs-outputs inputs-outputs.cxx)
target_link_libraries(inputs-outputs PUBLIC ${ITK_LIBRARIES})
target_link_libraries(inputs-outputs PUBLIC ${ITK_LIBRARIES})
68 changes: 68 additions & 0 deletions examples/mean-squares-versor-registration/CMakeLists.txt
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
)
Loading

0 comments on commit 3259691

Please sign in to comment.