Fix bugs which prevents loading multi-frame instances with custom image loaders

- Construct image id based on frame (if defined) for custom image loaders as well
- Use DICOMFileLoadingListener for multi-frame images and image loaders except wado
This commit is contained in:
Evren Ozkan 2017-05-23 16:20:23 -04:00
parent c5c5ddf282
commit 7519006e64
2 changed files with 18 additions and 2 deletions

View File

@ -373,7 +373,7 @@ class StudyLoadingListener {
// how many frames has already been loaded (bytes/s instead of frames/s).
if ((schema === 'wadors') || !stackMetaData.isMultiFrame) {
return new StackLoadingListener(stack);
} else if ((schema === 'dicomweb') || (schema === 'wadouri')) {
} else {
return new DICOMFileLoadingListener(stack);
}
}

View File

@ -1,5 +1,17 @@
import { getWADORSImageId } from './getWADORSImageId';
// https://stackoverflow.com/a/6021027/3895126
function updateQueryStringParameter(uri, key, value) {
var re = new RegExp("([?&])" + key + "=.*?(&|$)", "i");
var separator = uri.indexOf('?') !== -1 ? "&" : "?";
if (uri.match(re)) {
return uri.replace(re, '$1' + key + "=" + value + '$2');
}
else {
return uri + separator + key + "=" + value;
}
}
/**
* Obtain an imageId for Cornerstone from an image instance
*
@ -14,7 +26,11 @@ export function getImageId(instance, frame, thumbnail) {
}
if (instance.url) {
return instance.url;
if (frame !== undefined) {
instance.url = updateQueryStringParameter(instance.url, 'frame', frame);
}
return instance.url;
}
const renderingAttr = thumbnail ? 'thumbnailRendering' : 'imageRendering';