VTI file types for vtkjs volume reader

Hi all,

I’m trying to change this example to read other volume files:

after cloning the repo, the volume viewer can be started with:
npm run dev:volume

The data read is with the following line

reader
  .setUrl('https://kitware.github.io/vtk-js/data/volume/LIDC2.vti')
[...]

When I’m trying to change this to other data sources :

reader
  .setUrl('https://kitware.github.io/vtk-js-datasets/data/vti/LIDC2.vti')

I’m getting an error

I notice that the first version is npm folder structure with index.json, a binary file etc… while the second one is just a vti file, which is what I get from paraview when I output volume data.

Can you specify how to generate this ‘npm style’ vti data, or read vti files straight from paraview ?

thanks

The former is a folder-style dataset, where the index.json file is used as a manifest to download the appropriate data arrays for the image data. If you want to switch to loading the data/vti/LIDC2.vti binary file, then you will need to use fetch or vtkHttpDataAccessReader.fetchBinary to download the file, then use vtkXMLImageDataReader to read in the file. You can find an example of the reader here: vtk-js/index.js at master · Kitware/vtk-js · GitHub