# Problem realated to ITK.JS WebWorkers/ImageIO.worker.js

**URL:** <https://discourse.itk.org/t/problem-realated-to-itk-js-webworkers-imageio-worker-js/5216>\
**Category:** Beginner Questions\
**Created:** [July 26, 2022, 10:03am UTC](https://discourse.itk.org/t/problem-realated-to-itk-js-webworkers-imageio-worker-js/5216 "2022-07-26T10:03:20Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Yuvi-416](https://discourse.itk.org/user_avatar/discourse.itk.org/yuvi-416/32/2279_2.png) [@Yuvi-416](https://discourse.itk.org/u/Yuvi-416)\
**Post date:** [July 26, 2022, 10:03am UTC](https://discourse.itk.org/t/problem-realated-to-itk-js-webworkers-imageio-worker-js/5216/1 "2022-07-26T10:03:21Z")

</div>

Hello everyone,  
I am trying to run the below code to read a series of DICOM images and convert them into VTK objects before I send them for visualization.  
Problem is that, sometimes, itk.js read the image but most of the time I receive the below message about the CORE.POLICY. I tried both ways as follows to call itk.js to read images but still most of the time I receive the below error.

```auto
    <script src="https://unpkg.com/itk@14.0.1/umd/itk.js"></script>
<!-- <script type="text/javascript" src="{% static '/js/itk.js' %}"></script>-->

```

CODE:

```auto
function vol_processFile(vol_arrFileList, vol_color_val) {
  var vol_img = []
  console.log(vol_arrFileList)
  const vol_files = vol_arrFileList

vol_prom = []

for ( l = 0 ; l < vol_files.length; l++){
    console.time('image_loading_Time');
    if (l == 0){
        if (vol_files[l].length === 1) {
              vol_prom[l] = itk.readImageFile(null, vol_files[l][0])
              .then(function ({ webWorker, image: itkImage }) {
                webWorker.terminate()
                vol_imageData = convertItkToVtkImage(itkImage)
                console.log(vol_imageData)
                vol_img.push(vol_imageData)
              })
          } else {
           vol_prom[l] = itk.readImageDICOMFileSeries(vol_files[l]).then(function ({ image: itkImage }) {
            vol_imageData = convertItkToVtkImage(itkImage)
            console.log(vol_imageData)
             vol_img.push(vol_imageData)
              })
          }
        }
    else {
        if (vol_files[l].length === 1) {
              vol_prom[l] = itk.readImageFile(null, vol_files[l][0])
              .then(function ({ webWorker, image: itkImage }) {
                webWorker.terminate()
                vol_imageData = convertItkToVtkImage(itkImage)
                console.log(vol_imageData)
                 vol_img.push(vol_imageData)
              })
          } else {
            vol_prom[l] = itk.readImageDICOMFileSeries(vol_files[l]).then(function ({ image: itkImage }) {
                vol_imageData = convertItkToVtkImage(itkImage)
               // console.log(imageData)
                 vol_img.push(vol_imageData)
                  })
      }
    }
    setTimeout(function delay(){
      console.timeEnd('image_loading_Time');
    }, 1500);
}

Promise.all(vol_prom).then((values) => {
    console.log(vol_prom)

    $( "#btn2" ).prop( "disabled", true )
     $( "#f" ).prop( "disabled", true )
     $( ".colors_channels" ).prop( "disabled", true )
    //while(true){
    console.time('image_render_Time');
     volume_rendering(vol_img, vol_color_val) // Calls Volume rendering script
     // surface_rendering(img, color_val) // Calls surface rendering script
     // tri_planar_rendering(img) // Calls Tri-Planar rendering script
     // mpr_rendering(img) // Calls Multi-Planar Reconstruction rendering script

     console.log(vol_img.length +" - "+ vol_files.length)
     //if(img.length == files.length){
       // break;
     //}
    //}
        setTimeout(function delay(){
      console.timeEnd('image_render_Time');
    }, 1500);
}).catch(
console.log("Please check the input files again"));
//console.log(img)

}

```

ERROR:  
`Access to XMLHttpRequest at 'https://unpkg.com/itk@14.0.1/WebWorkers/ImageIO.worker.js' from origin '[http://127.0.0.1:8000](http://127.0.0.1:8000/)' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.`

I have already installed the required Django core files on my PC and also did whatever they suggest to include in setting.py like below but I still receive this error.  
ALLOWED\_HOSTS = [‘\*’]  
CORS\_ORIGIN\_ALLOW\_ALL = True #########################################################################  
Is there a way to solve this problem permanently? I am trying to solve it for a long time. I think there is some problem while fetching itk.js from CDN.

---

<div class="post-metadata">

**Author:** ![dzenanz](https://discourse.itk.org/user_avatar/discourse.itk.org/dzenanz/32/1093_2.png) [@dzenanz](https://discourse.itk.org/u/dzenanz)\
**Post date:** [July 26, 2022, 12:22pm UTC](https://discourse.itk.org/t/problem-realated-to-itk-js-webworkers-imageio-worker-js/5216/2 "2022-07-26T12:22:26Z")

</div>

@matt.mccormick might know.

---

<div class="post-metadata">

**Author:** ![matt.mccormick](https://discourse.itk.org/user_avatar/discourse.itk.org/matt.mccormick/32/7_2.png) [@matt.mccormick](https://discourse.itk.org/u/matt.mccormick)\
**Post date:** [August 23, 2022, 12:15am UTC](https://discourse.itk.org/t/problem-realated-to-itk-js-webworkers-imageio-worker-js/5216/3 "2022-08-23T00:15:11Z")

</div>

Hi,

Please upgrade from `itk-wasm`, which has updated resource access and now uses jsdelivr instead of unpkg by default.
