VTK and WebAssembly

I am excited about the possibility of using VTK on the client browser via WebAssembly. I know there has been some work done to get the non-rendering part of VTK to compile to WebAssembly. I am a little confused why ITK is necessary for this to work. I am still trying to wrap my head around how this all fits together with WebAssembly, ITK, and VTK, so apologies to the ITK people if I sound like I don’t appreciate their work on this. It would be nice to have a VTK only WebAssembly solution.

I am also looking for examples on how to pass the non-rendering VTK WebAssembly pipeline to vtk.js for rendering.

You can look at the VTKSrc/Examples/Emscripten/Cxx/* for more details. The ITK part is mostly for leveraging the docker image that allow you to compile your VTK/C++ code into WebAssembly. The ITK community did a tremendous job setting up tools and infrastructure to build itk.js using ITK/C++ to WebAssembly. Here we are simply using their tools and infrastructure. In other words, you do not need ITK/C++ in your VTK/C++ application if you don’t need/want it.

Also, VTK WebAssembly now support rendering but only for geometry not for volume rendering.

Regarding your question between a WebAssembly processing backend and a vtk.js rendering pipeline, I was aiming to create such example but I ran out of time. You need to have a way to pass some typed array that live in the webassembly part to the JS and then transform them so they are part of a vtkImageData or vtkPolyData on the js world.

HTH,

Seb

Thanks Sebastien! That clears things up with the ITK/VTK question. I really appreciate the work the ITK folks have put in to make this work.

Are there examples for rendering geometry with VTK/WebAssembly?

I assume there are plans to incorporate volume rendering into WebAssembly at some point. Wish I could help with this effort, but it is a little beyond my skill level at this point. If I can find time I am going to look into pairing the WebAssembly pipeline to vtk.js and will contribute code/examples if I can.

Yes in VTKSrc/Examples/Emscripten/Cxx/*

The readme should help you building and running them yourself.