Adding peer checks and allows changing aes when query/retrieve
This commit is contained in:
parent
9cde04bcfe
commit
6172bf6440
@ -111,8 +111,11 @@ Connection.prototype.addSocket = function(ae, socket) {
|
|||||||
Connection.prototype.associate = function(options, callback) {
|
Connection.prototype.associate = function(options, callback) {
|
||||||
var hostAE = options.hostAE ? options.hostAE : this.defaultPeer,
|
var hostAE = options.hostAE ? options.hostAE : this.defaultPeer,
|
||||||
sourceAE = options.sourceAE ? options.sourceAE : this.defaultServer;
|
sourceAE = options.sourceAE ? options.sourceAE : this.defaultServer;
|
||||||
peerInfo = this.selectPeer(hostAE), nativeSocket = new Socket();
|
if (!hostAE || !sourceAE) {
|
||||||
|
throw "Peers not provided or no defaults in settings";
|
||||||
|
}
|
||||||
|
|
||||||
|
var peerInfo = this.selectPeer(hostAE), nativeSocket = new Socket();
|
||||||
var socket = new CSocket(nativeSocket, this.options), o = this;
|
var socket = new CSocket(nativeSocket, this.options), o = this;
|
||||||
if (callback) {
|
if (callback) {
|
||||||
socket.once('associated', callback);
|
socket.once('associated', callback);
|
||||||
|
|||||||
@ -18,17 +18,20 @@ Meteor.startup(function(){
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
DIMSE.associate = function(contexts, callback) {
|
DIMSE.associate = function(contexts, callback, options) {
|
||||||
conn.associate({
|
var defaults = {
|
||||||
contexts: contexts
|
contexts: contexts
|
||||||
}, function(pdu) {
|
};
|
||||||
|
options = Object.assign(defaults, options);
|
||||||
|
|
||||||
|
conn.associate(options, function(pdu) {
|
||||||
// associated
|
// associated
|
||||||
console.log('==Associated');
|
console.log('==Associated');
|
||||||
callback.call(this, pdu);
|
callback.call(this, pdu);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
DIMSE.retrievePatients = function(params) {
|
DIMSE.retrievePatients = function(params, options) {
|
||||||
//var start = new Date();
|
//var start = new Date();
|
||||||
var future = new Future;
|
var future = new Future;
|
||||||
DIMSE.associate([C.SOP_PATIENT_ROOT_FIND], function(pdu) {
|
DIMSE.associate([C.SOP_PATIENT_ROOT_FIND], function(pdu) {
|
||||||
@ -57,13 +60,13 @@ DIMSE.retrievePatients = function(params) {
|
|||||||
//var time = new Date() - start;console.log(time + 'ms taken');
|
//var time = new Date() - start;console.log(time + 'ms taken');
|
||||||
future.return(patients);
|
future.return(patients);
|
||||||
});
|
});
|
||||||
});
|
}, options);
|
||||||
return future.wait();
|
return future.wait();
|
||||||
};
|
};
|
||||||
|
|
||||||
DIMSE.retrieveStudies = function(params, options) {
|
DIMSE.retrieveStudies = function(params, options) {
|
||||||
//var start = new Date();
|
//var start = new Date();
|
||||||
var future = new Future, options = Object.assign({limit : 100}, options);
|
var future = new Future;
|
||||||
DIMSE.associate([C.SOP_STUDY_ROOT_FIND], function(pdu) {
|
DIMSE.associate([C.SOP_STUDY_ROOT_FIND], function(pdu) {
|
||||||
var defaultParams = {
|
var defaultParams = {
|
||||||
0x0020000D: "",
|
0x0020000D: "",
|
||||||
@ -84,9 +87,6 @@ DIMSE.retrieveStudies = function(params, options) {
|
|||||||
var studies = [];
|
var studies = [];
|
||||||
result.on('result', function(msg) {
|
result.on('result', function(msg) {
|
||||||
studies.push(msg);
|
studies.push(msg);
|
||||||
if (options.limit && options.limit == studies.length) {
|
|
||||||
result.emit('cancel');
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
result.on('end', function() {
|
result.on('end', function() {
|
||||||
@ -97,11 +97,11 @@ DIMSE.retrieveStudies = function(params, options) {
|
|||||||
//var time = new Date() - start;console.log(time + 'ms taken');
|
//var time = new Date() - start;console.log(time + 'ms taken');
|
||||||
future.return(studies);
|
future.return(studies);
|
||||||
});
|
});
|
||||||
});
|
}, options);
|
||||||
return future.wait();
|
return future.wait();
|
||||||
};
|
};
|
||||||
|
|
||||||
DIMSE.retrieveSeries = function(studyInstanceUID, params) {
|
DIMSE.retrieveSeries = function(studyInstanceUID, params, options) {
|
||||||
var future = new Future;
|
var future = new Future;
|
||||||
DIMSE.associate([C.SOP_STUDY_ROOT_FIND], function(pdu) {
|
DIMSE.associate([C.SOP_STUDY_ROOT_FIND], function(pdu) {
|
||||||
var defaultParams = {
|
var defaultParams = {
|
||||||
@ -133,7 +133,7 @@ DIMSE.retrieveSeries = function(studyInstanceUID, params) {
|
|||||||
this.on('close', function() {
|
this.on('close', function() {
|
||||||
future.return(series);
|
future.return(series);
|
||||||
});
|
});
|
||||||
});
|
}, options);
|
||||||
return future.wait();
|
return future.wait();
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -160,7 +160,7 @@ DIMSE.retrieveInstances = function(studyInstanceUID, seriesInstanceUID, params,
|
|||||||
0x00280100: "",
|
0x00280100: "",
|
||||||
0x00280103: ""
|
0x00280103: ""
|
||||||
};
|
};
|
||||||
var result = this.findInstances(Object.assign(defaultParams, params), options),
|
var result = this.findInstances(Object.assign(defaultParams, params)),
|
||||||
o = this;
|
o = this;
|
||||||
|
|
||||||
var instances = [];
|
var instances = [];
|
||||||
@ -175,7 +175,7 @@ DIMSE.retrieveInstances = function(studyInstanceUID, seriesInstanceUID, params,
|
|||||||
this.on('close', function() {
|
this.on('close', function() {
|
||||||
future.return(instances);
|
future.return(instances);
|
||||||
});
|
});
|
||||||
});
|
}, options);
|
||||||
return future.wait();
|
return future.wait();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user