2017-06-16 21:36:34 +02:00
|
|
|
import { Meteor } from 'meteor/meteor';
|
2016-09-20 22:47:44 +02:00
|
|
|
import { OHIF } from 'meteor/ohif:core';
|
|
|
|
|
|
2015-10-13 14:14:50 +02:00
|
|
|
Meteor.methods({
|
2015-11-16 17:49:35 +01:00
|
|
|
/**
|
|
|
|
|
* Retrieves Study metadata given a Study Instance UID
|
|
|
|
|
* This Meteor method is available from both the client and the server
|
|
|
|
|
*/
|
2016-01-13 16:17:32 +01:00
|
|
|
GetStudyMetadata: function(studyInstanceUid) {
|
2016-09-20 22:47:44 +02:00
|
|
|
OHIF.log.info('GetStudyMetadata(%s)', studyInstanceUid);
|
2015-10-13 14:14:50 +02:00
|
|
|
|
2016-09-29 17:25:04 +02:00
|
|
|
// Get the server data. This is user-defined in the config.json files or through servers
|
|
|
|
|
// configuration modal
|
2017-06-16 21:36:34 +02:00
|
|
|
const server = OHIF.servers.getCurrentServer();
|
2016-09-29 17:25:04 +02:00
|
|
|
|
|
|
|
|
if (!server) {
|
2017-09-19 17:44:39 +02:00
|
|
|
throw new Meteor.Error('improper-server-config', 'No properly configured server was available over DICOMWeb or DIMSE.');
|
2016-01-13 16:17:32 +01:00
|
|
|
}
|
|
|
|
|
|
2017-09-19 17:44:39 +02:00
|
|
|
try {
|
|
|
|
|
if (server.type === 'dicomWeb') {
|
|
|
|
|
return Services.WADO.RetrieveMetadata(server, studyInstanceUid);
|
|
|
|
|
} else if (server.type === 'dimse') {
|
|
|
|
|
return Services.DIMSE.RetrieveMetadata(studyInstanceUid);
|
|
|
|
|
}
|
|
|
|
|
} catch (error) {
|
|
|
|
|
OHIF.log.trace();
|
|
|
|
|
|
|
|
|
|
throw error;
|
2016-02-09 13:19:11 +01:00
|
|
|
}
|
2015-11-16 17:49:35 +01:00
|
|
|
}
|
2016-01-13 16:17:32 +01:00
|
|
|
});
|