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

**URL:** https://discourse.vtk.org/t/how-to-construct-the-gz-file-loaded-in-the-vtk-js-example/7578
**Category:** Web
**Created:** [January 6, 2022, 2:28pm UTC](https://discourse.vtk.org/t/how-to-construct-the-gz-file-loaded-in-the-vtk-js-example/7578 "2022-01-06T14:28:25Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![qq769747518](https://discourse.vtk.org/user_avatar/discourse.vtk.org/qq769747518/32/4509_2.png) [@qq769747518](https://discourse.vtk.org/u/qq769747518)
#### Post date: [January 6, 2022, 2:28pm UTC](https://discourse.vtk.org/t/how-to-construct-the-gz-file-loaded-in-the-vtk-js-example/7578/1 "2022-01-06T14:28:25Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![Sebastien\_Jourdain](https://discourse.vtk.org/user_avatar/discourse.vtk.org/sebastien_jourdain/32/100_2.png) [@Sebastien\_Jourdain](https://discourse.vtk.org/u/Sebastien_Jourdain)
#### Post date: [January 6, 2022, 3:57pm UTC](https://discourse.vtk.org/t/how-to-construct-the-gz-file-loaded-in-the-vtk-js-example/7578/2 "2022-01-06T15:57:14Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![qq769747518](https://discourse.vtk.org/user_avatar/discourse.vtk.org/qq769747518/32/4509_2.png) [@qq769747518](https://discourse.vtk.org/u/qq769747518)
#### Post date: [January 11, 2022, 7:02am UTC](https://discourse.vtk.org/t/how-to-construct-the-gz-file-loaded-in-the-vtk-js-example/7578/4 "2022-01-11T07:02:06Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![Sebastien\_Jourdain](https://discourse.vtk.org/user_avatar/discourse.vtk.org/sebastien_jourdain/32/100_2.png) [@Sebastien\_Jourdain](https://discourse.vtk.org/u/Sebastien_Jourdain)
#### Post date: [January 11, 2022, 3:55pm UTC](https://discourse.vtk.org/t/how-to-construct-the-gz-file-loaded-in-the-vtk-js-example/7578/5 "2022-01-11T15:55:24Z")

</div>

the .gz files are the raw bytes of your array compressed as gzip. Basically the same thing as [Numpy tofile](https://numpy.org/doc/stable/reference/generated/numpy.ndarray.tofile.html). The json metadata just describe what those bytes are.
