Porting C++ app to VTK.js

We have an app written in C++ using Qt. The app used ITK to produce nrrd files and then uses VTK to render dicomm files with the nrrd files on top of them. We want to port this to a web app. Anyone have any experience doing this? Any pointers or references to docs? We want to try and leverage as much of our existing code as possible. Thanks!

1 Like

You may want to have a look at these tutorials for inspiration:

1 Like

Beware that we don’t have a 1 to 1 capability mapping between VTK/C++ and VTK/js but with the itk.js infrastructure we have some path to convert C++ code to web assembly. (We’ve mostly used it for the readers)

Now that’s said, we have a pretty neat OpenSource application (ParaView Glance) leveraging itk.js + vtk.js which provides some good features for medical datasets that is fully client based. This can be a good project for reference.

Also, depending of the amount of data and processing that you want to handle, you might need a server with ITK and/or VTK. And a ParaViewWeb type of infrastructure could be meaningful.

In general, if you need help, Kitware can provide support and/or development. On top of maintaining those OpenSource frameworks, we are helping customers to build or migrate their application using our Web solutions.

1 Like

Are there any new developments in this regard? @Sebastien_Jourdain I didn’t create a new topic to avoid excess.
Have you tried compiling your project with Emscripten or etc. ? @LarryMartell59

Actually we are waiting for a contribution from https://about.dicehub.com/ who managed to get the VTK/C++ rendering working in WebAssembly. They’ve been swamped but we are working together to provide an open-source solution for the community.

Thanks for reply. So how can I compile VTK(without rendering) with Emscripten toolchain? I found some sources. But they are using Docker. I want compile on Windows like compile another library.

@thewtex might be able to provide some additional information but I suspect that it won’t be trivial.

VTK without rendering can be used with the Emscripten Toolchain by using itk.js and the kitware/itk-js-vtk Docker image. This can be used to compile processing pipelines on Windows. itk.js and the Docker image provide:

  • The Emscripten toolchain
  • CMake configuration
  • VTK built with the Emscripten toolchain
  • A method to efficiently call the resulting JavaScript and WebAssembly

These are the required components.

Thank you. I succeeded after a little working. But I wonder another thing. Suppose I personalized some part of VTK for myself. Can I create own Docker Image?


Yes. Edit Dockerfile and build.sh found here, then specify the image name with itk-js build --image <your-image-name> src/path.

1 Like

I am also trying to compile VTK with Emscripten for Windows. Can you give me some pointers on how you accomplished this?