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 | import getWADORSImageId from './getWADORSImageId'; // https://stackoverflow.com/a/6021027/3895126 function updateQueryStringParameter(uri, key, value) { const regex = new RegExp('([?&])' + key + '=.*?(&|$)', 'i'); const separator = uri.indexOf('?') !== -1 ? '&' : '?'; if (uri.match(regex)) { return uri.replace(regex, '$1' + key + '=' + value + '$2'); } else { return uri + separator + key + '=' + value; } } /** * Obtain an imageId for Cornerstone from an image instance * * @param instance * @param frame * @param thumbnail * @returns {string} The imageId to be used by Cornerstone */ export default function getImageId(instance, frame, thumbnail = false) { if (!instance) { return; } if (instance.imageId && frame === undefined) { return instance.imageId; } if (typeof instance.getImageId === 'function') { return instance.getImageId(); } if (instance.url) { if (frame !== undefined) { instance.url = updateQueryStringParameter(instance.url, 'frame', frame); } return instance.url; } const renderingAttr = thumbnail ? 'thumbnailRendering' : 'imageRendering'; if (!instance[renderingAttr] || instance[renderingAttr] === 'wadouri' || !instance.wadorsuri) { let imageId = 'dicomweb:' + instance.wadouri; if (frame !== undefined) { imageId += '&frame=' + frame; } return imageId; } else { return getWADORSImageId(instance, frame, thumbnail); // WADO-RS Retrieve Frame } } |