Add configuration option for DIMSE connections to fix connections to DCM4CHEE (#23)

This commit is contained in:
Erik Ziegler 2016-08-07 22:44:25 +02:00
parent 3e4b66cfcd
commit 804488458c
5 changed files with 72 additions and 16 deletions

View File

@ -50,11 +50,14 @@ var getInstanceRetrievalParams = function(studyInstanceUID, seriesInstanceUID) {
// Orthanc has a bug here so we can't retrieve sequences at the moment
// https://groups.google.com/forum/#!topic/orthanc-users/ghKJfvtnK8Y
//0x00082112: '' // sourceImageSequence
}
};
};
Meteor.startup(function() {
if (!Meteor.settings.servers.dimse || !Meteor.settings.servers.dimse.length) return;
if (!Meteor.settings.servers.dimse || !Meteor.settings.servers.dimse.length) {
return;
}
// TODO: [custom-servers] use active server and check if type is DIMSE
var peers = Meteor.settings.servers.dimse[0].peers;
console.log('Adding DIMSE peers');
@ -169,7 +172,9 @@ DIMSE._retrieveInstancesBySeries = function(conn, series, studyInstanceUID, call
};
DIMSE.retrieveInstancesByStudyOnlyMulti = function(studyInstanceUID, params, options) {
if (!studyInstanceUID) return [];
if (!studyInstanceUID) {
return [];
}
var series = DIMSE.retrieveSeries(studyInstanceUID, params, options), instances = [];
series.forEach(function(seriesData){
@ -182,7 +187,9 @@ DIMSE.retrieveInstancesByStudyOnlyMulti = function(studyInstanceUID, params, opt
};
DIMSE.retrieveInstancesByStudyOnly = function(studyInstanceUID, params, options) {
if (!studyInstanceUID) return [];
if (!studyInstanceUID) {
return [];
}
var future = new Future;
DIMSE.associate([C.SOP_STUDY_ROOT_FIND], function(pdu){
@ -222,7 +229,7 @@ DIMSE.retrieveInstancesByStudyOnly = function(studyInstanceUID, params, options)
});
});
return future.wait();
}
};
DIMSE.retrieveSeries = function(studyInstanceUID, params, options) {
var future = new Future;
@ -264,7 +271,6 @@ DIMSE.retrieveInstances = function(studyInstanceUID, seriesInstanceUID, params,
var future = new Future;
DIMSE.associate([C.SOP_STUDY_ROOT_FIND], function(pdu) {
var defaultParams = getInstanceRetrievalParams(studyInstanceUID, seriesInstanceUID);
var result = this.findInstances(Object.assign(defaultParams, params)),
o = this;

View File

@ -26,7 +26,6 @@ getStudyMetadata = function(studyInstanceUid, doneCallback, failCallback) {
// If no study metadata is in the cache variable, we need to retrieve it from
// the server with a call.
Meteor.call('GetStudyMetadata', studyInstanceUid, function(error, study) {
log.info('worklistStudy getStudyMetadata: ' + studyInstanceUid);
console.timeEnd('getStudyMetadata');
if (Meteor.user && Meteor.user()) {
@ -48,6 +47,10 @@ getStudyMetadata = function(studyInstanceUid, doneCallback, failCallback) {
return;
}
if (!study) {
throw "GetStudyMetadata: No study data returned from server";
}
// Once we have retrieved the data, we sort the series' by series
// and instance number in ascending order
sortStudy(study);

View File

@ -21,6 +21,7 @@ function getSourceImageInstanceUid(instance) {
* Returns an object populated with study metadata, including the
* series list.
*
* @param studyInstanceUid
* @param resultData
* @returns {{seriesList: Array, patientName: *, patientId: *, accessionNumber: *, studyDate: *, modalities: *, studyDescription: *, imageCount: *, studyInstanceUid: *}}
*/
@ -104,6 +105,8 @@ function resultDataToStudyMetadata(studyInstanceUid, resultData) {
series.instances.push(instanceSummary);
});
studyData.studyInstanceUid = studyInstanceUid;
return studyData;
}
@ -113,13 +116,18 @@ function resultDataToStudyMetadata(studyInstanceUid, resultData) {
* @returns {{seriesList: Array, patientName: *, patientId: *, accessionNumber: *, studyDate: *, modalities: *, studyDescription: *, imageCount: *, studyInstanceUid: *}}
*/
Services.DIMSE.RetrieveMetadata = function(studyInstanceUid) {
var result = DIMSE.retrieveInstances(studyInstanceUid);
// TODO: Find active server
const activeServer = Meteor.settings.servers.dimse[0].peers[0];
const supportsInstanceRetrievalByStudyUid = activeServer.supportsInstanceRetrievalByStudyUid;
let results;
var study = resultDataToStudyMetadata(studyInstanceUid, result);
if (!study) {
study = {};
// Check explicitly for a value of false, since this property
// may be left undefined in config files
if (supportsInstanceRetrievalByStudyUid === false) {
results = DIMSE.retrieveInstancesByStudyOnly(studyInstanceUid);
} else {
results = DIMSE.retrieveInstances(studyInstanceUid);
}
study.studyInstanceUid = studyInstanceUid;
return study;
return resultDataToStudyMetadata(studyInstanceUid, results);
};

40
config/dcm4cheeDIMSE.json Normal file
View File

@ -0,0 +1,40 @@
{
"servers": {
"dicomWeb": [
{
"name": "DCM4CHEE",
"wadoUriRootNOTE": "either this uri is not correct for wado-uri or wado-uri is not configured on orthanc currently",
"wadoUriRoot": "http://localhost:8043/dcm4chee-arc/aets/DCM4CHEE/wado",
"qidoRoot": "http://localhost:8080/dcm4chee-arc/aets/DCM4CHEE/rs",
"wadoRoot": "http://localhost:8080/dcm4chee-arc/aets/DCM4CHEE/rs",
"qidoSupportsIncludeField": false,
"imageRendering": "wadouri",
"requestOptions": {
"auth": "admin:admin",
"logRequests": true,
"logResponses": false,
"logTiming": true
}
}],
"dimse": [{
"name": "DCM4CHEE_DIMSE",
"peers": [
{
"host": "localhost",
"port": 4242,
"aeTitle": "DCM4CHEE",
"default": true,
"supportsInstanceRetrievalByStudyUid": false
},
{
"host": "0.0.0.0",
"port": 11112,
"aeTitle": "DCM4CHEE",
"default": true,
"server": true
}
]
}]
},
"defaultServiceType": "dimse"
}

View File

@ -5,14 +5,13 @@ var http = require('http'),
httpProxy = require('http-proxy');
var proxy = httpProxy.createProxyServer({
target: 'http://192.168.99.100:8080',
target: 'http://localhost:8080',
auth: 'user:user'
}).listen(8080);
}).listen(8043);
proxy.on('proxyRes', function(proxyReq, req, res, options) {
// add the CORS header to the response
res.setHeader('Access-Control-Allow-Origin', '*');
console.log(proxyReq);
});
proxy.on('error', function(e) {