Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] Failed to execute 'importScripts' on 'WorkerGlobalScope' #1819

Open
moneyfirst-yh opened this issue Feb 8, 2025 · 0 comments
Open

Comments

@moneyfirst-yh
Copy link

Describe the Bug

Image
When I was loading the CT, this error message appeared. What caused this?

Here is the relevant code section.
` async getDicomZIP(taskId) {
let res = await this.$get(api.getDicomZip, { taskId });
if (res) {
axios
.get(res.result, {
responseType: "blob",
})
.then(async (filezip_res) => {
let res = await this.zipToFile(filezip_res.data);
res.forEach((file) => {
const imageId =
cornerstoneDICOMImageLoader.wadouri.fileManager.add(file);
this.imageIds.push(imageId);
});

        console.log(this.imageIds);
        await this.initCornerstone();
        console.log("comes here1");

        await this.prefetchMetadataInformation(this.imageIds);
        console.log("comes here2");

        await this.initCt();
      });
  }
}`

` async initCornerstone() {
await initDemo();
new RenderingEngine(this.renderingEngineId);

},`

`
import initProviders from './initProviders';
import initVolumeLoader from './initVolumeLoader';
import {
init as csRenderInit,
imageLoader,
volumeLoader,
metaData,
} from '@cornerstonejs/core';
import * as cornerstoneTools from '@cornerstonejs/tools';
import * as cornerstone from '@cornerstonejs/core';
import { init as csToolsInit } from '@cornerstonejs/tools';
// import { fakeVolumeLoader } from '../../test/testUtilsVolumeLoader';
// import {
// fakeImageLoader,
// fakeMetaDataProvider,
// } from '../../test/testUtilsImageLoader';
import cornerstoneDICOMImageLoader from '@cornerstonejs/dicom-image-loader';

window.cornerstone = cornerstone;
window.cornerstoneTools = cornerstoneTools;

export default async function initDemo(config) {
initProviders();
cornerstoneDICOMImageLoader.init();
initVolumeLoader();
await csRenderInit({
peerImport,
...(config?.core ? config.core : {}),
});
await csToolsInit();

// // for testings, you don't need any of these
// volumeLoader.registerVolumeLoader('fakeVolumeLoader', fakeVolumeLoader);
// imageLoader.registerImageLoader('fakeImageLoader', fakeImageLoader);
// metaData.addProvider(fakeMetaDataProvider, 10000);
}

`

`
async prefetchMetadataInformation(imageIdsToPrefetch) {
for (let i = 0; i < imageIdsToPrefetch.length; i++) {

    await cornerstoneDICOMImageLoader.wadouri.loadImage(
      imageIdsToPrefetch[i]
    ).promise;
  }
},

`

Steps to Reproduce

error occurred when executing prefetchMetadataInformation.

The current behavior

error occurred

The expected behavior

no error

OS

windows10

Node version

16.20.2

Browser

chrome

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant