How can I pre-fetch slices of an image stack?

I’m trying to get my app to pre-fetch slices of an image stack using cornerstone-web-image-loader and a stack of PNG images fetched over http.

The documentation in Migration Guides | Cornerstone.js suggests that

viewport.setStack([...], 1)

would load and cache images. However this is not occuring. Only the first image slice is loaded and all further slices are fetched on-demand, resulting in a stuttery user experience.

How can I get cornerstonejs to pre-fetch all slices, or ideally provide my own custom pre-fetching strategy like “pre-fetch all un-fetched slices +/- N slices around the current one”?

Hello @stemps,

There is stackPrefetch in Cornerstone that might help you. See stackPrefetch search

Awesome! That works very nicely :slight_smile:. Thanks!