Skip to content

Latest commit

 

History

History
68 lines (48 loc) · 3.15 KB

README.md

File metadata and controls

68 lines (48 loc) · 3.15 KB

ITK wasm pipelines

The commands to build the pipelines are:

  • npm run emscripten-build -> alias for emscripten-build:release
  • npm run emscripten-build:release -> build in release
  • npm run emscripten-build:debug -> build in debug

Vite will take the new built files into account using the plugin vite-plugin-static-copy. The built files will be copied as soon as itk-wasm is done building, thanks to the reloadPageOnChange option of the plugin. This means that there is no need to restart the dev server every time you run an emscripten-build.

Debug in the browser

Debuging directly from the wasm files generated by npm run emscripten-build is hard. You can follow the instruction given in the itk-wasm documentation along with the command npm run emscripten-build:debug.

Example of path subsitution in Dwarf options on Windows: /work/ -> file:///C:/.../UPennContrast/itk/.

It is hard to put a breakpoint when the pipeline is fast. There is no real solution to this problem except running the pipeline and pause the execution in the debugger with the right timming.

Debugging with DWARF in Chrome often fails with an error which says that the debug symbols can't be found. But after several tries (launch the pipeline several times), it founds the symbols and debugging works.

Developping natively with ITK wasm

CMake modules

Go in the directory with the ITK sources and run a command that looks like this (change the last path):

python .\Utilities\Maintenance\WhatModulesITK.py . C:\dev\UPenn\UPennContrast\itk\MaskToBlob\main.cxx

Also add: WebAssemblyInterface to the needed itk components (it is not found by the script).

Not working with the master version of ITK, but it works with ITK 5.2.1.

Build with CMake

See this page of the documentation for information on how to build ITK and itk-wasm, and build natively.

To sum up, this is how to build and test ITK and itk-wasm:

# Build ITK
git clone https://github.com/InsightSoftwareConsortium/ITK
cmake -BITK-build -SITK -DBUILD_TESTING=OFF -DModule_MeshToPolyData=ON
cmake --build ITK-build

# Build the WebAssemblyInterface module from this module against ITK
git clone https://github.com/InsightSoftwareConsortium/itk-wasm
cmake -Bitk-wasm-build -Sitk-wasm -DBUILD_TESTING=ON -DITK_DIR=$PWD/ITK-build
cmake --build itk-wasm-build

# Run the tests
ctest --test-dir itk-wasm-build

Build the project (change the paths to match your setup):

cd C:\dev\UPenn\UPennContrast\itk
cmake -Bbuild -DITK_DIR=C:/dev/ITK-WASM/ITK-build
cmake --build build

On Windows, you can use the generated .sln file to open the project in Visual Studio.

Using Visual Studio

If you don't want to pollute your project folder with many VS files:

  • Open this folder (UPenn/itk) in VS: Open VS -> Open a local folder
  • Specify ITK_DIR (build directory of ITK) to CMake: Right click CMakeLists.txt -> CMake Settings for ...
  • To give cli arguments to your startup items: Debug -> Debug and launch settings for ... -> Add a line "args": ["foo", "bar"]