2017-01-10 19:09:43 +01:00
|
|
|
import { Meteor } from "meteor/meteor";
|
2017-01-16 18:30:54 +01:00
|
|
|
import { getWADORSImageId } from './getWADORSImageId';
|
2017-01-10 19:09:43 +01:00
|
|
|
|
2015-11-16 17:49:35 +01:00
|
|
|
/**
|
|
|
|
|
* Obtain an imageId for Cornerstone from an image instance
|
|
|
|
|
*
|
|
|
|
|
* @param instance
|
|
|
|
|
* @returns {string} The imageId to be used by Cornerstone
|
|
|
|
|
*/
|
2017-01-19 15:05:36 +01:00
|
|
|
export function getImageId(instance, frame) {
|
2017-01-18 16:59:03 +01:00
|
|
|
|
2015-10-13 14:14:50 +02:00
|
|
|
if (!instance) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
2015-11-26 10:36:34 +01:00
|
|
|
|
2016-04-14 19:30:18 +02:00
|
|
|
if (instance.url) {
|
2017-01-16 18:30:54 +01:00
|
|
|
return instance.url;
|
2016-04-14 19:30:18 +02:00
|
|
|
}
|
|
|
|
|
|
2015-10-13 14:14:50 +02:00
|
|
|
if (instance.wadouri) {
|
2017-01-16 18:30:54 +01:00
|
|
|
var imageId = 'dicomweb:' + Meteor.absoluteUrl(instance.wadouri);
|
2015-11-26 10:36:34 +01:00
|
|
|
if (frame !== undefined) {
|
|
|
|
|
imageId += '&frame=' + frame;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return imageId;
|
2015-10-13 14:14:50 +02:00
|
|
|
} else {
|
2015-11-26 10:36:34 +01:00
|
|
|
// TODO= Check multiframe image support with WADO-RS
|
2015-10-13 14:14:50 +02:00
|
|
|
return getWADORSImageId(instance); // WADO-RS Retrieve Frame
|
|
|
|
|
}
|
2017-01-16 18:30:54 +01:00
|
|
|
}
|