read the .vti file

I used this demo to import the downloaded headsq.vti file into Times 404 again via reader.seturl.
my code:

reader.setUrl(``, { loadData: true }).then(() => {
            const fileContents = writer.write(reader.getOutputData());
            // Try to read it back.
            const textEncoder = new TextEncoder();
            const blob = new Blob([fileContents], { type: 'text/plain' });
            const a = window.document.createElement('a');
            a.href = window.URL.createObjectURL(blob, { type: 'text/plain' });
   = 'headsq.vti';
            a.text = 'Download';
   = 'absolute';
   = '50%';
   = '10px';
   = 'white';
   = '5px';

image path:

got error:

How can I directly use the downloaded VTI file ?

The reader you are using (vtkHttpDataSetReader) relies on a “deconstructed” dataset format, where metadata and data are separated. What you’ve downloaded is a single vti file. What you need is to download the file with fetch or something similar.

const response = await fetch(`)
const arraybuffer = response.arraybuffer()
const reader = vtkXMLImageDataReader.newInstance()

Thank you very much, it has shown properly. But it is much larger than the original preservation, and the location is not right, please restore the original location

The following code works for me

    const __BASE_PATH__ = "";
    const reader = vtkHttpDataSetReader.newInstance({ fetchGzip: true });
      .setUrl(`${__BASE_PATH__}/data/volume/LIDC2.vti`, { loadData: true })
      .then(() => {
        const data = reader.getOutputData();