Skip to content

Commit

Permalink
Merge pull request #795 from thewtex/base-itk-wasi-updates
Browse files Browse the repository at this point in the history
Base itk wasi updates
  • Loading branch information
thewtex committed Mar 16, 2023
2 parents b1bf53a + 6eb6894 commit 7e9d82a
Show file tree
Hide file tree
Showing 7 changed files with 700 additions and 6 deletions.
24 changes: 23 additions & 1 deletion .github/workflows/examples.yml
Expand Up @@ -245,4 +245,26 @@ jobs:
- name: Test
run: |
npm run test
npm run test
test-mean-squares-versor-registration:
name: mean-squares-versor-registration
runs-on: ubuntu-22.04
defaults:
run:
working-directory: ./examples/mean-squares-versor-registration

steps:
- uses: actions/checkout@v3

- uses: actions/setup-node@v3
with:
node-version: '18'

- name: Install
run: |
npm install
- name: Build
run: |
npm run build
2 changes: 1 addition & 1 deletion examples/inputs-outputs/CMakeLists.txt
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
@@ -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
)

0 comments on commit 7e9d82a

Please sign in to comment.