cornerstonejs / cornerstone

JavaScript library to display interactive medical images including but not limited to DICOM
https://docs.cornerstonejs.org/
MIT License
2.04k stars 596 forks source link

'loadAndCacheImage' thhrow an error #594

Open ali161997 opened 2 years ago

ali161997 commented 2 years ago

version I use "cornerstone-core": "^2.3.0", "cornerstone-math": "^0.1.8", "cornerstone-wado-image-loader": "^3.1.2",

Issue

when using loadAndCacheImage it throw an error as "Not a JPEG file" and task "task decodeTask failed - Not a JPEG file"

what i should do

`

cornerstone
      .loadAndCacheImage(this.viewer.stacks[this.stackIndex].imageIds[0])
      .then(function(image) {
        // Display the image
        const element = document.getElementById(me.elementId);
        const stack = me.viewer.stacks[me.stackIndex];
        cornerstone.displayImage(element, image);
      })
      .catch((err) => {
        console.error("error is here :", err);
      });`
nankie commented 1 year ago

use cornerstoneWADOImageLoader in stead of cornerstone-wado-image-loader:

import cornerstoneWADOImageLoader from 'cornerstone-wado-image-loader';