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

Unable to Change URL of xhrRequest in Each Loop Iteration, Resulting in Same Image Being Loaded #542

Open
DarineZeyad opened this issue Jun 25, 2024 · 0 comments

Comments

@DarineZeyad
Copy link

DarineZeyad commented Jun 25, 2024

I am facing an issue with cornerstoneWADOImageLoader where I need to change the URL of the xhrRequest in each loop iteration. However, the loader keeps sending the URL from the first iteration, causing the same image to be loaded repeatedly. Here is the code snippet I am using:

cornerstoneWADOImageLoader.configure({
  useWebWorkers: true,
  decodeConfig: {
    convertFloatPixelDataToInt: false,
  },
  beforeSend: function (xhr) {
    xhr.open("GET", url, true);
    xhr.setRequestHeader("Authorization", `...TOKEN`);
    xhr.setRequestHeader("Accept", "image/jpeg");
  },
  onloadend: function (event, params) {
    // dispatching action
  },
});

cornerstoneWADOImageLoader.wadors.metaDataManager.add(
  imageId,
  instanceMetaData
);

Expected Behavior

The URL in the xhrRequest should change with each iteration, allowing different images to be loaded.

Actual Behavior

The URL remains the same for every iteration, leading to the same image being loaded repeatedly.

Alternative Approach

I have found an alternative way that successfully retrieves images, but I am unsure how cornerstone will handle the responded images:

cornerstoneWADOImageLoader.internal.xhrRequest(url, imageId, {
  Authorization: `Bearer ${sessionStorage.getItem(storageKeys.accessToken)}`,
});

HTTP Request Details

The whole point of trying to change the URL is to retrieve rendered images using the following HTTP request format:
GET https://healthcare.googleapis.com/v1beta1/{parent=projects/*/locations/*/datasets/*/dicomStores/*}/dicomWeb/{dicomWebPath=studies/*/series/*/instances/*/rendered}

Could you please advise on how to correctly update the URL within the beforeSend function or guidance on how cornerstone processes the images retrieved using the alternative approach would be greatly appreciated.

Thank you for your assistance!

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

No branches or pull requests

1 participant