ohif-viewer/Packages/ohif-viewerbase/client/lib/getWADORSImageUrl.js
2017-03-15 17:32:08 -03:00

18 lines
543 B
JavaScript

export function getWADORSImageUrl(instance, frame) {
let wadorsuri = instance.wadorsuri;
if (!wadorsuri) {
return;
}
// We need to sum 1 because WADO-RS frame number is 1-based
frame = (frame || 0) + 1;
// Replaces /frame/1 by /frame/{frame}
// TODO: Maybe should be better to export the WADOProxy to be able to use it on client
// Example: WADOProxy.convertURL(baseWadoRsUri + '/frame/' + frame)
wadorsuri = wadorsuri.replace(/(%2Fframes%2F)(\d+)/, `$1${frame}`);
return wadorsuri;
}