How to construct the ".gz" file loaded in the vtk.js example

const reader = vtkHttpDataSetReader.newInstance({
fetchGzip: true,
reader.setUrl(${__BASE_PATH__}/data/volume/headsq.vti, { loadData: true }).then(() => {});
In this example,The loaded file headsq.vti consists of a .gz file and a JSON file,The Json file I can copy the example to build,but the .gz file I can’t build。How do I build dicom image into .gz file.

You should use itk.js to directly read your DICOM. vtkHttpDataSetReader has its own format that is optimized for network and I don’t think you need to convert your data to that format in order to load it inside vtk.js.

1 Like

Thank you for your reply.I built vtkImageData by parsing pixel data in DICOM and loaded it into vtk.js,But it takes too long to load the DICOM data in network, I also want to compress the DICom data into .gz file and load it through vtkHttpDataSetReader,How do I build DICOM image into .gz file.

the .gz files are the raw bytes of your array compressed as gzip. Basically the same thing as Numpy tofile. The json metadata just describe what those bytes are.