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 committed 2017-05-23 16:20:23 -04:00
1 parent c5c5ddf282
commit 7519006e64
2 files changed
+18 -2

No files matched your search

@@ -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';