VTK WebAssembly Calling vtkXMLImageDataReader and vtkXMLPolyDataReader with URL's

I have compiled VTK with Emscripten and have gotten the VTK Emscripten/C++ examples working on a demo website. I would like to do a full VTK pipeline in WebAssembly including fetching the imagedata and polydata from a URL resource. I haven’t tried it yet, but I suspect it will not work. Has anybody else tried to fetch data with the VTK C++ readers from a URL resource?

I am going to try to use emscripten fetch with the URL and then convert the result from char* to std::string. I can then set the ReadFromInputString flag to true on the vtkXMLImageDataReader and set the InputString member of the vtkXMLImageDataReader to the std::string. I will update if this works.



Is there any progress? I have the same issue just like you have. After compile webassembly, i don’t know how to reader file from a external url.

Have you considered using ITK.wasm to load your VTK dataset ?

As far as I know, ITK.wasm only support vtk image data and polydata, but i need to reader unstructured grid data. So far I can only use C++ Emscripten to compile wasm file.