OHIF-25: Multi-frame images should be loaded one frame at a time

This commit is contained in:
Leonardo Campos committed 2017-03-15 10:22:14 -03:00
1 parent 6cb0050f38
commit b31d7441ea
6 files changed
+80 -10

No files matched your search

@@ -25,6 +25,6 @@ export function getImageId(instance, frame) {
return imageId;
} else {
// TODO= Check multiframe image support with WADO-RS
return getWADORSImageId(instance); // WADO-RS Retrieve Frame
return getWADORSImageId(instance, frame); // WADO-RS Retrieve Frame
}
}
@@ -42,14 +42,26 @@ class ImageMetadataBuilder {
}
}
formatWADOREImageUrl = function(wadorsuri, frame) {
// 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 Meteor.absoluteUrl(wadorsuri);
}
/**
* Obtain an imageId for Cornerstone based on the WADO-RS scheme
*
* @param {object} instanceMetada metadata object (InstanceMetadata)
* @returns {string} The imageId to be used by Cornerstone
*/
export function getWADORSImageId(instance) {
const uri = Meteor.absoluteUrl(instance.wadorsuri);
export function getWADORSImageId(instance, frame) {
const uri = formatWADOREImageUrl(instance.wadorsuri, frame);
const imageId = `wadors:${uri}`;
const imageMetadata = new ImageMetadataBuilder()