From 804488458c9085f215d6616a7944f6d05353c594 Mon Sep 17 00:00:00 2001 From: Erik Ziegler Date: Sun, 7 Aug 2016 22:44:25 +0200 Subject: [PATCH] Add configuration option for DIMSE connections to fix connections to DCM4CHEE (#23) --- Packages/dimseservice/server/DIMSE.js | 18 ++++++--- .../worklist/client/lib/getStudyMetadata.js | 5 ++- .../server/services/dimse/retrieveMetadata.js | 20 +++++++--- config/dcm4cheeDIMSE.json | 40 +++++++++++++++++++ etc/dcm4cheCORSproxy.js | 5 +-- 5 files changed, 72 insertions(+), 16 deletions(-) create mode 100644 config/dcm4cheeDIMSE.json diff --git a/Packages/dimseservice/server/DIMSE.js b/Packages/dimseservice/server/DIMSE.js index 092f0acc4..d006a06cc 100755 --- a/Packages/dimseservice/server/DIMSE.js +++ b/Packages/dimseservice/server/DIMSE.js @@ -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; diff --git a/Packages/worklist/client/lib/getStudyMetadata.js b/Packages/worklist/client/lib/getStudyMetadata.js index 90e1d7e28..4620ea15e 100644 --- a/Packages/worklist/client/lib/getStudyMetadata.js +++ b/Packages/worklist/client/lib/getStudyMetadata.js @@ -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); diff --git a/Packages/worklist/server/services/dimse/retrieveMetadata.js b/Packages/worklist/server/services/dimse/retrieveMetadata.js index bafbfc9d5..7a34be612 100755 --- a/Packages/worklist/server/services/dimse/retrieveMetadata.js +++ b/Packages/worklist/server/services/dimse/retrieveMetadata.js @@ -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); }; diff --git a/config/dcm4cheeDIMSE.json b/config/dcm4cheeDIMSE.json new file mode 100644 index 000000000..e37a91fd4 --- /dev/null +++ b/config/dcm4cheeDIMSE.json @@ -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" +} diff --git a/etc/dcm4cheCORSproxy.js b/etc/dcm4cheCORSproxy.js index a113539a5..d47fbeed3 100644 --- a/etc/dcm4cheCORSproxy.js +++ b/etc/dcm4cheCORSproxy.js @@ -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) {