What is the added value of using itk-wasm to build VTK C++ WASM App?

I’m trying to understand the role of itk-wasm in compiling a VTK C++ WebAssembly application. I appreciate any help.

As far as I know, the kitware/vtk-wasm is a VTK built with Emscripten and is available as a Docker image.

I had success using only the kitware/vtk-wasm Docker image to build the VTK C++ cone example in WebAssembly. It works fine and generates the HTML, JS, and wasm files.

docker run --rm --entrypoint /bin/bash -v $PWD:/work -it kitware/vtk-wasm

mkdir -p build && cd build

cmake \
    -G Ninja \
    -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE} \
    -DBUILD_SHARED_LIBS:BOOL=OFF \
    -DCMAKE_BUILD_TYPE:STRING=Release \
    -DVTK_DIR=/VTK-install/Release/lib/cmake/vtk \
    -DOPTIMIZE=BEST \
    ../         

cmake --build .
  1. I’m wondering why vtk-wasm-docker Readme suggests using itk-wasm for this purpose. What benefits does itk-wasm bring to the table? I believe it offers more than just reducing boilerplate code?

  2. Might not be related to this forum, but Is there a docker image available for itk that we can use to bring itk filters as WASM to the web? The kitware/vtk-wasm docker appears to be quite straightforward and promising for instance. I see in the hello world for itk-wasm that anything built with itk-wasm needs to be run via itk.runPipeline which is something I did not expect given the purpose of the js bridge file for the WASM. Is it possible to not use runPipeline? and only use the .js and .wasm for the output of itk-wasm?

Thanks!

As the readme suggests, the docker image simply borrows tooling from itk-wasm i.e, itk-wasm-cli in particular. It’s just a convenient way to reduce the amount of boilerplate script code necessary to cross compile.

Might not be related to this forum, but Is there a docker image available for itk that we can use to bring itk filters as WASM to the web? The kitware/vtk-wasm docker appears to be quite straightforward and promising for instance. I see in the hello world for itk-wasm that anything built with itk-wasm needs to be run via itk.runPipeline which is something I did not expect given the purpose of the js bridge file for the WASM. Is it possible to not use runPipeline? and only use the .js and .wasm for the output of itk-wasm?

@jcfr

Hmm. You certainly know more than me about the internals, but that is not what I read from the readme. I read it as kitware/vtk-wasm is a VTK static build from Emscripten, and we use some tooling from itk-wasm separately to achieve this goal.

[kitware/vtk-wasm](https://hub.docker.com/r/kitware/vtk-wasm) provides VTK static libraries built with [emscripten](https://emscripten.org). With the help of [kitware/vtk-wasm](https://hub.docker.com/r/kitware/vtk-wasm) and tooling borrowed from [itk-wasm](https://wasm.itk.org), it is very easy to integrate VTK-wasm into your web workflow for development and production.

So does this mean there is ITK inside kitware/vtk-wasm?

You’re correct, the itk-wasm tooling is used to build the docker image kitware/vtk-wasm. The docker image does not have ITK in it.

So does this mean there is ITK inside kitware/vtk-wasm?

No.

1 Like