How to write vti files for use in vtk.js

I’m trying to replace the sample data in vtk.js with some of my own data. I’m not sure how I can convert data to the right .vti format though. I can convert my data to a .vti format using the vtk python library, and this file seems to be xml. One of the example files seems to be in a json format though, and indeed when I try to read my xml .vti file I get an error in vtk.js.

Could someone point me to an example that shows how to write .vti files in a format that can be read by vtk.js?

This example contains VTI files. You can have a look at those.

Hth,
Julien.

.vti are indeed XML files. The directory with a json file is a conversion from a vti file, but not a vti file. The XML file should be loaded with IO/XML/XMLImageDataReader while the directory structure with JSON should be loaded with IO/Core/HttpDataSetReader. Either of those could produce the same dataset. So pick the appropriate reader that match your data. The rest of the code should remain the same.

Thanks a lot! I managed to use the XMLImageDataReader :slight_smile: