ITK-Wasm compiles ITK C++ image processing to WebAssembly for browser, Node.js, and Python execution. The architecture spans:
- C++ Core (
include/,src/): ITK pipeline interface withitkPipeline.hCLI parsing - Docker Build Images (
src/docker/): Emscripten and WASI toolchain containers - CLI (
packages/core/typescript/itk-wasm/src/cli/):itk-wasmbuild/bindgen commands - Language Bindings: TypeScript (
packages/*/typescript/) and Python (packages/*/python/) - Example Packages (
packages/): image-io, mesh-io, dicom, downsample, etc.
# Full build
pnpm install
pnpm build
pnpm test
# Individual package development
cd packages/<package-name>
pnpm build:emscripten # or build:wasi
pnpm build:gen:typescript
pnpm build:gen:python
pnpm testpixi shell
pnpm build:emscripten:debug && pnpm build:wasi:debug
pnpm build && pnpm test# Build with local ITK source for bug fixes
./src/docker/build.sh --local-itk /path/to/ITK
# Or via environment variable
export ITK_WASM_LOCAL_ITK_SOURCE=/path/to/ITK
./src/docker/build.shEach packages/<name>/ contains:
- C++ pipelines (
.cxxfiles) withCMakeLists.txt package.jsonwithitk-wasmconfig section for test data, Docker images, package namestypescript/andpython/directories for generated bindingstest/data/with input/baseline files (downloaded viatest:data:download)
Use ITK_WASM_PARSE macro and typed inputs/outputs from include/:
#include "itkPipeline.h"
#include "itkInputImage.h"
#include "itkOutputImage.h"
int main(int argc, char * argv[]) {
itk::wasm::Pipeline pipeline("operation-name", "Description", argc, argv);
// Add options, parse with ITK_WASM_PARSE(pipeline), process, return
}Test data uses content-addressed storage. To add/modify:
# In package directory
pnpm test:data:pack # Creates test/data.tar.gz, outputs CID
# Ask user to upload to IPFS host, update package.json itk-wasm.test-data-hash and test-data-urlsThe CLI generates TypeScript/Python bindings from WASI builds:
itk-wasm bindgen --interface typescript # or pythonKey variables in itk_wasm_env.bash:
ITK_WASM_ITK_REPOSITORY,ITK_WASM_ITK_BRANCH: ITK source for Docker buildsITK_WASM_LOCAL_ITK_SOURCE: Use local ITK directory in Docker buildsITK_WASM_*_TEST_DATA_HASH/URLS: Per-package test data configuration
Uses conventional commits: feat:, fix:, docs:, etc.