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 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 | 9454x 9454x 9454x 9454x 9454x 9454x 9454x 9454x 9454x 9454x 9454x 9454x 9454x 9454x 9454x | import type { Types } from '@cornerstonejs/core'; import { xhrRequest } from '../internal/index'; // import rangeRequest from '../internal/rangeRequest'; import streamRequest from '../internal/streamRequest'; import rangeRequest from '../internal/rangeRequest'; import extractMultipart from './extractMultipart'; import { getImageQualityStatus } from './getImageQualityStatus'; import type { CornerstoneWadoRsLoaderOptions } from './loadImage'; function getPixelData( uri: string, imageId: string, mediaType = 'application/octet-stream', options?: CornerstoneWadoRsLoaderOptions ) { const { streamingData, retrieveOptions = {} as Types.RetrieveOptions } = options || {}; const headers = { Accept: mediaType, }; // Add urlArguments to the url for retrieving - allows accept and other // parameters to be added. let url = retrieveOptions.urlArguments ? `${uri}${uri.indexOf('?') === -1 ? '?' : '&'}${ retrieveOptions.urlArguments }` : uri; // Replace the /frames/ part of the path with another path to choose // a different resource type. Iif (retrieveOptions.framesPath) { url = url.replace('/frames/', retrieveOptions.framesPath); } // Swap the streaming data out if a new instance starts. Eif (streamingData?.url !== url) { options.streamingData = { url }; } Iif ( (retrieveOptions as Types.RangeRetrieveOptions).rangeIndex !== undefined ) { return rangeRequest(url, imageId, headers, options); } // Use the streaming parser only when configured to do so Iif ((retrieveOptions as Types.StreamingRetrieveOptions).streaming) { return streamRequest(url, imageId, headers, options); } /** * Not progressively rendering, use regular xhr request. */ const loadPromise = xhrRequest(url, imageId, headers); const { xhr } = loadPromise; return loadPromise.then(function (imageFrameAsArrayBuffer /* , xhr*/) { const contentType = xhr.getResponseHeader('Content-Type') || 'application/octet-stream'; const extracted = extractMultipart( contentType, new Uint8Array(imageFrameAsArrayBuffer) ); extracted.imageQualityStatus = getImageQualityStatus(retrieveOptions, true); return extracted; }); } export default getPixelData; |