cornerstonejs / cornerstone

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

How should I use purgeCache ? #526

Closed aizela closed 3 years ago

aizela commented 3 years ago

version:2.2.8

I made a simple project to achieve MPR

 <div id="cornerstone-target" class="item"></div>
      {mode === 0 ? null : (
        <div>
          <div id="axial-target" class="item"></div>
          <div id="coronal-target" class="item"></div>
          <div id="sagittal-target" class="item"></div>
        </div>
      )}
    </div>

when i click the button,it goes to show MPR or not.

and what my problem is that, when i change to normal mode ,then show MPR again, the lines on MPR images will increase. now I think what cause this is the cache. so how should i use cornerstone.imageCache.purgeCache()?
i have used as this:

  cornerstone.loadImage(axialMprUrl).then((image) => {
      cornerstone.imageCache.purgeCache()
      cornerstone.displayImage(mprAxialSeriesElement, image)
    })

but it didn't works