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

**URL:** https://discourse.vtk.org/t/what-is-the-added-value-of-using-itk-wasm-to-build-vtk-c-wasm-app/13281
**Category:** Web
**Created:** [February 8, 2024, 5:28am UTC](https://discourse.vtk.org/t/what-is-the-added-value-of-using-itk-wasm-to-build-vtk-c-wasm-app/13281 "2024-02-08T05:28:17Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Alireza](https://discourse.vtk.org/user_avatar/discourse.vtk.org/alireza/32/6230_2.png) [@Alireza](https://discourse.vtk.org/u/Alireza)
#### Post date: [February 8, 2024, 5:28am UTC](https://discourse.vtk.org/t/what-is-the-added-value-of-using-itk-wasm-to-build-vtk-c-wasm-app/13281/1 "2024-02-08T05:28:17Z")

</div>

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.

```auto
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](https://gitlab.kitware.com/vtk/vtk-wasm-docker) 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](https://wasm.itk.org/en/latest/cxx/tutorial/hello_world.html) 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!

---

<div class="post-metadata">

### Author: ![jaswantp](https://discourse.vtk.org/user_avatar/discourse.vtk.org/jaswantp/32/10046_2.png) [@jaswantp](https://discourse.vtk.org/u/jaswantp)
#### Post date: [February 8, 2024, 1:36pm UTC](https://discourse.vtk.org/t/what-is-the-added-value-of-using-itk-wasm-to-build-vtk-c-wasm-app/13281/2 "2024-02-08T13:36:03Z")

</div>

> [@Alireza](#):
>
> What benefits does itk-wasm bring to the table? I believe it offers more than just reducing boilerplate code?

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](https://wasm.itk.org/en/latest/cxx/tutorial/hello_world.html) 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

---

<div class="post-metadata">

### Author: ![Alireza](https://discourse.vtk.org/user_avatar/discourse.vtk.org/alireza/32/6230_2.png) [@Alireza](https://discourse.vtk.org/u/Alireza)
#### Post date: [February 8, 2024, 2:05pm UTC](https://discourse.vtk.org/t/what-is-the-added-value-of-using-itk-wasm-to-build-vtk-c-wasm-app/13281/3 "2024-02-08T14:05:35Z")

</div>

> [@jaswantp](#):
>
> 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.

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?

---

<div class="post-metadata">

### Author: ![jaswantp](https://discourse.vtk.org/user_avatar/discourse.vtk.org/jaswantp/32/10046_2.png) [@jaswantp](https://discourse.vtk.org/u/jaswantp)
#### Post date: [February 8, 2024, 3:53pm UTC](https://discourse.vtk.org/t/what-is-the-added-value-of-using-itk-wasm-to-build-vtk-c-wasm-app/13281/4 "2024-02-08T15:53:28Z")

</div>

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.
