Skip to main content

Variable: stackContextPrefetch

const stackContextPrefetch: object

Type declaration

disable()

disable: (element) => void

Parameters

element: any

Returns

void

enable()

enable: (element) => void

Call this to enable stack context sensitive prefetch. Should be called before stack data is set in order to start prefetch after load first image. This will add a STACK_NEW_IMAGE to detect when a new image is displayed, and then update the prefetch stack. The context sensitive prefetch reacts to the initial display, or significant moves, the already loaded images, the cache size and the direction of navigation. The behaviour is:

  1. On navigating to a new image initially, or one that is at a different position:
  • Fetch the next/previous 2 images
  1. If the user is navigating forward/backward by less than 5 images, then
  • Prefetch additional images in the direction of navigation, up to 100
  1. If all the images in a given prefetch have completed, then:
  • Use the last prefetched image size as an image size for the stack
  • Fetch up to 1/4 of the cache size images near the current image

This is designed to:

  • Get nearby images immediately so that they are available for navigation
    • Under the assumption that users might click and view an image, then navigate to next/previous image to see the exact image they want
  • Not interfere with loading other viewports if they are still loading
    • Load priority is prefetch, and minimal images are requested initially
  • Load an entire series if it will fit in memory
    • Allows navigating to other parts of the series and display images immediately
  • Have images available for CINE/navigation in one direction even when there is more image data than will fit in memory.
    • Up to 100 images in the direction of travel will be prefetched

Parameters

element: any

to prefetch on

Returns

void

getConfiguration()

getConfiguration: () => object

Returns

object

directionExtraImages

directionExtraImages: number = 10

maxAfter

maxAfter: number = 2

maxImagesToPrefetch

maxImagesToPrefetch: number = Infinity

minBefore

minBefore: number = 2

preserveExistingPool

preserveExistingPool: boolean = false

setConfiguration()

setConfiguration: (config) => void

Parameters

config: any

Returns

void

Defined in

tools/src/utilities/stackPrefetch/stackContextPrefetch.ts:375