All files / dicomImageLoader/src/imageLoader/internal retrieveDefaults.ts

100% Statements 3/3
100% Branches 0/0
100% Functions 0/0
100% Lines 3/3

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45                                            137x                   137x                     137x  
/**
 * Defaults shared by the byte range and the streaming retrieve paths.
 *
 * The two paths configure the same three things and have to agree on them, so
 * they read one copy of each value rather than declaring their own.
 */
 
/**
 * Bytes to retrieve, or to accumulate, before the first decode of a partial
 * image, when the retrieve options set no `initialChunkSize`.
 *
 * 32k decodes: OpenJPH reads the truncated remainder rather than throwing, and
 * the result is a recognisable image. The size is still too small for a high
 * resolution frame, where 32k of codestream spreads over so many pixels that
 * the first image adds little over a blank viewport, and the decode is then
 * repeated almost immediately. 128k buys a first image worth showing and stays
 * a small part of a frame that runs to several megabytes.
 *
 * This value equals `DEFAULT_CHUNK_SIZE` at present. The two stay separate
 * because they answer different questions - time to first image against cost
 * of refinement - and either can be set on its own in the retrieve options.
 */
export const DEFAULT_INITIAL_CHUNK_SIZE = 131072;
 
/**
 * Bytes to retrieve, or to accumulate, between decodes after the first, when
 * the retrieve options set no `chunkSize`.
 *
 * By this point the image is already on screen and the job is refining it, so
 * advancing in smaller steps would mean many more requests and decodes for the
 * same result.
 */
export const DEFAULT_CHUNK_SIZE = 131072;
 
/**
 * Minimum milliseconds between two decodes of the same partial image, when the
 * retrieve options set no `msBetweenDecode`.
 *
 * Chunk size bounds how often new data arrives, but on a fast connection that
 * still outruns what a display can use: decoding is much more expensive than
 * receiving, so without a clock the decoder runs continuously and the extra
 * frames are never seen. 500ms is a readable refresh rate.
 */
export const DEFAULT_MS_BETWEEN_DECODE = 500;