Add ServerConfiguration schema to validate Meteor settings, removed defaultSettings, ran JSCS for DIMSEService package
This commit is contained in:
parent
356abd0978
commit
d4b014847a
@ -1,54 +0,0 @@
|
|||||||
import { Meteor } from 'meteor/meteor';
|
|
||||||
|
|
||||||
Meteor.startup(function() {
|
|
||||||
if (Object.keys(Meteor.settings).length > 1) {
|
|
||||||
console.log('Using custom LesionTracker settings');
|
|
||||||
console.log(Meteor.settings);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Meteor.settings = {
|
|
||||||
servers: {
|
|
||||||
dicomWeb: [{
|
|
||||||
name: 'Orthanc',
|
|
||||||
wadoUriRootNOTE: 'either this uri is not correct for wado-uri or wado-uri is not configured on orthanc currently',
|
|
||||||
wadoUriRoot: 'http://localhost:8043/wado',
|
|
||||||
qidoRoot: 'http://localhost:8042/dicom-web',
|
|
||||||
wadoRoot: 'http://localhost:8042/dicom-web',
|
|
||||||
qidoSupportsIncludeField: false,
|
|
||||||
imageRendering: 'wadouri',
|
|
||||||
requestOptions: {
|
|
||||||
auth: 'orthanc:orthanc',
|
|
||||||
logRequests: true,
|
|
||||||
logResponses: false,
|
|
||||||
logTiming: true
|
|
||||||
}
|
|
||||||
}],
|
|
||||||
dimse: [{
|
|
||||||
name: "ORTHANC_DIMSE",
|
|
||||||
peers: [{
|
|
||||||
host: 'localhost',
|
|
||||||
port: 4242,
|
|
||||||
aeTitle: 'ORTHANC',
|
|
||||||
default: true
|
|
||||||
}]
|
|
||||||
}]
|
|
||||||
},
|
|
||||||
"defaultServiceType": 'dicomWeb',
|
|
||||||
"public": {
|
|
||||||
"verifyEmail": false,
|
|
||||||
"ui": {
|
|
||||||
"studyListFunctionsEnabled": true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//defaultServiceType: 'dimse'
|
|
||||||
};
|
|
||||||
|
|
||||||
console.log('Using default LesionTracker settings with service: ' + Meteor.settings.defaultServiceType);
|
|
||||||
|
|
||||||
// Bind events if window is closed
|
|
||||||
$(window).bind('beforeunload', function (e) {
|
|
||||||
// have to return null, unless you want a chrome popup alert
|
|
||||||
// return 'If you leave this page then any unsaved changes will be lost.';
|
|
||||||
});
|
|
||||||
});
|
|
||||||
@ -39,3 +39,4 @@ clinical:router
|
|||||||
fastclick@1.0.12
|
fastclick@1.0.12
|
||||||
standard-minifier-css@1.1.8
|
standard-minifier-css@1.1.8
|
||||||
standard-minifier-js@1.1.8
|
standard-minifier-js@1.1.8
|
||||||
|
aldeed:simple-schema
|
||||||
|
|||||||
@ -1,3 +1,4 @@
|
|||||||
|
aldeed:simple-schema@1.5.3
|
||||||
allow-deny@1.0.5
|
allow-deny@1.0.5
|
||||||
arsnebula:reactive-promise@0.9.1
|
arsnebula:reactive-promise@0.9.1
|
||||||
autoupdate@1.3.11
|
autoupdate@1.3.11
|
||||||
@ -49,6 +50,7 @@ jquery@1.11.9
|
|||||||
launch-screen@1.0.12
|
launch-screen@1.0.12
|
||||||
livedata@1.0.18
|
livedata@1.0.18
|
||||||
logging@1.1.14
|
logging@1.1.14
|
||||||
|
mdg:validation-error@0.2.0
|
||||||
meteor@1.2.16
|
meteor@1.2.16
|
||||||
meteor-base@1.0.4
|
meteor-base@1.0.4
|
||||||
meteor-platform@1.2.6
|
meteor-platform@1.2.6
|
||||||
|
|||||||
@ -1,44 +0,0 @@
|
|||||||
import { Meteor } from 'meteor/meteor';
|
|
||||||
|
|
||||||
Meteor.startup(function() {
|
|
||||||
if (Object.keys(Meteor.settings).length > 1) {
|
|
||||||
console.log('Using custom LesionTracker settings: ');
|
|
||||||
console.log(Meteor.settings);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Meteor.settings = {
|
|
||||||
servers: {
|
|
||||||
dicomWeb: [{
|
|
||||||
name: 'Orthanc',
|
|
||||||
wadoUriRootNOTE: 'either this uri is not correct for wado-uri or wado-uri is not configured on orthanc currently',
|
|
||||||
wadoUriRoot: 'http://localhost:8043/wado',
|
|
||||||
qidoRoot: 'http://localhost:8042/dicom-web',
|
|
||||||
wadoRoot: 'http://localhost:8042/dicom-web',
|
|
||||||
qidoSupportsIncludeField: false,
|
|
||||||
imageRendering: 'wadouri',
|
|
||||||
requestOptions: {
|
|
||||||
auth: 'orthanc:orthanc',
|
|
||||||
logRequests: true,
|
|
||||||
logResponses: false,
|
|
||||||
logTiming: true
|
|
||||||
}
|
|
||||||
}],
|
|
||||||
dimse: [{
|
|
||||||
name: "ORTHANC_DIMSE",
|
|
||||||
peers: [{
|
|
||||||
host: 'localhost',
|
|
||||||
port: 4242,
|
|
||||||
hostAE: 'ORTHANC'
|
|
||||||
}]
|
|
||||||
}]
|
|
||||||
},
|
|
||||||
defaultServiceType: 'dicomWeb',
|
|
||||||
//defaultServiceType: 'dimse'
|
|
||||||
public: {
|
|
||||||
ui: {
|
|
||||||
studyListFunctionsEnabled: true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
});
|
|
||||||
@ -5,8 +5,9 @@ Package.describe({
|
|||||||
});
|
});
|
||||||
|
|
||||||
Package.onUse(function(api) {
|
Package.onUse(function(api) {
|
||||||
//api.use("weiwei:dicomservices");
|
api.versionsFrom('1.4');
|
||||||
|
|
||||||
|
api.use('ecmascript');
|
||||||
api.addFiles('server/require.js', 'server');
|
api.addFiles('server/require.js', 'server');
|
||||||
api.addFiles('server/constants.js', 'server');
|
api.addFiles('server/constants.js', 'server');
|
||||||
api.addFiles('server/elements_data.js', 'server');
|
api.addFiles('server/elements_data.js', 'server');
|
||||||
|
|||||||
@ -12,7 +12,8 @@ var Envelope = function(command, dataset) {
|
|||||||
EventEmitter.call(this);
|
EventEmitter.call(this);
|
||||||
this.command = command;
|
this.command = command;
|
||||||
this.dataset = dataset;
|
this.dataset = dataset;
|
||||||
}
|
};
|
||||||
|
|
||||||
util.inherits(Envelope, EventEmitter);
|
util.inherits(Envelope, EventEmitter);
|
||||||
|
|
||||||
CSocket = function(socket, options) {
|
CSocket = function(socket, options) {
|
||||||
@ -39,35 +40,43 @@ CSocket = function(socket, options) {
|
|||||||
this.options = options;
|
this.options = options;
|
||||||
|
|
||||||
var o = this;
|
var o = this;
|
||||||
this.socket.on("connect", function(){
|
this.socket.on('connect', function() {
|
||||||
|
console.log('Connect');
|
||||||
o.ready();
|
o.ready();
|
||||||
});
|
});
|
||||||
this.socket.on("data", function(data) {
|
this.socket.on('data', function(data) {
|
||||||
o.received(data);
|
o.received(data);
|
||||||
});
|
});
|
||||||
this.socket.on("error", function(he) {
|
this.socket.on('error', function(he) {
|
||||||
console.log("Error: ", he);
|
console.log('Error: ', he);
|
||||||
|
throw 'Error: ' + he;
|
||||||
});
|
});
|
||||||
this.socket.on("close", function() {
|
this.socket.on('timeout', function(he) {
|
||||||
|
console.log('Timeout: ', he);
|
||||||
|
throw 'Timeout: ' + he;
|
||||||
|
});
|
||||||
|
this.socket.on('close', function() {
|
||||||
if (o.intervalId) {
|
if (o.intervalId) {
|
||||||
clearInterval(o.intervalId);
|
clearInterval(o.intervalId);
|
||||||
}
|
}
|
||||||
o.connected = false;
|
|
||||||
console.log("Connection closed");
|
|
||||||
o.emit('close');
|
|
||||||
})
|
|
||||||
|
|
||||||
this.on("released", function() {
|
o.connected = false;
|
||||||
|
console.log('Connection closed');
|
||||||
|
o.emit('close');
|
||||||
|
});
|
||||||
|
|
||||||
|
this.on('released', function() {
|
||||||
this.released();
|
this.released();
|
||||||
});
|
});
|
||||||
this.on('aborted', function(pdu) {
|
this.on('aborted', function(pdu) {
|
||||||
console.log('Assocation aborted with reason ' + pdu.reason);
|
console.warn('Association aborted with reason ' + pdu.reason);
|
||||||
this.released();
|
this.released();
|
||||||
})
|
});
|
||||||
this.on('message', function(pdvs) {
|
this.on('message', function(pdvs) {
|
||||||
this.receivedMessage(pdvs);
|
this.receivedMessage(pdvs);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
util.inherits(CSocket, EventEmitter);
|
util.inherits(CSocket, EventEmitter);
|
||||||
|
|
||||||
CSocket.prototype.setCallingAE = function(ae) {
|
CSocket.prototype.setCallingAE = function(ae) {
|
||||||
@ -84,10 +93,11 @@ CSocket.prototype.associate = function() {
|
|||||||
associateRQ.setCallingAETitle(this.callingAe);
|
associateRQ.setCallingAETitle(this.callingAe);
|
||||||
associateRQ.setApplicationContextItem(new ApplicationContextItem());
|
associateRQ.setApplicationContextItem(new ApplicationContextItem());
|
||||||
|
|
||||||
var contextItems = []
|
var contextItems = [];
|
||||||
this.presentationContexts.forEach(function(context) {
|
this.presentationContexts.forEach(function(context) {
|
||||||
var contextItem = new PresentationContextItem(),
|
var contextItem = new PresentationContextItem(),
|
||||||
syntaxes = [];
|
syntaxes = [];
|
||||||
|
|
||||||
context.transferSyntaxes.forEach(function(transferSyntax) {
|
context.transferSyntaxes.forEach(function(transferSyntax) {
|
||||||
var transfer = new TransferSyntaxItem();
|
var transfer = new TransferSyntaxItem();
|
||||||
transfer.setTransferSyntaxName(transferSyntax);
|
transfer.setTransferSyntaxName(transferSyntax);
|
||||||
@ -123,39 +133,45 @@ CSocket.prototype.associate = function() {
|
|||||||
CSocket.prototype.getContext = function(id) {
|
CSocket.prototype.getContext = function(id) {
|
||||||
for (var k in this.presentationContexts) {
|
for (var k in this.presentationContexts) {
|
||||||
var ctx = this.presentationContexts[k];
|
var ctx = this.presentationContexts[k];
|
||||||
if (id == ctx.id) return ctx;
|
if (id === ctx.id) {
|
||||||
|
return ctx;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
};
|
||||||
|
|
||||||
CSocket.prototype.getSyntax = function(contextId) {
|
CSocket.prototype.getSyntax = function(contextId) {
|
||||||
if (!this.negotiatedContexts[contextId]) return null;
|
if (!this.negotiatedContexts[contextId]) return null;
|
||||||
|
|
||||||
return this.negotiatedContexts[contextId].transferSyntax;
|
return this.negotiatedContexts[contextId].transferSyntax;
|
||||||
}
|
};
|
||||||
|
|
||||||
CSocket.prototype.getContextByUID = function(uid) {
|
CSocket.prototype.getContextByUID = function(uid) {
|
||||||
for (var k in this.negotiatedContexts) {
|
for (var k in this.negotiatedContexts) {
|
||||||
var ctx = this.negotiatedContexts[k];
|
var ctx = this.negotiatedContexts[k];
|
||||||
if (ctx.abstractSyntax == uid) {
|
if (ctx.abstractSyntax === uid) {
|
||||||
return ctx;
|
return ctx;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
};
|
||||||
|
|
||||||
|
CSocket.prototype.getContextId = function(contextId) {
|
||||||
|
if (!this.negotiatedContexts[contextId]) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
CSocket.prototype.getContextId = function(contextId) {
|
|
||||||
if (!this.negotiatedContexts[contextId]) return null;
|
|
||||||
|
|
||||||
return this.negotiatedContexts[contextId].id;
|
return this.negotiatedContexts[contextId].id;
|
||||||
}
|
};
|
||||||
|
|
||||||
CSocket.prototype.setPresentationContexts = function(uids) {
|
CSocket.prototype.setPresentationContexts = function(uids) {
|
||||||
var contexts = [],
|
var contexts = [],
|
||||||
id = 0;
|
id = 0;
|
||||||
uids.forEach(function(uid) {
|
uids.forEach(function(uid) {
|
||||||
id++;
|
id++;
|
||||||
if (typeof uid == 'string') {
|
if (typeof uid === 'string') {
|
||||||
contexts.push({
|
contexts.push({
|
||||||
id: id,
|
id: id,
|
||||||
abstractSyntax: uid,
|
abstractSyntax: uid,
|
||||||
@ -174,7 +190,7 @@ CSocket.prototype.setPresentationContexts = function(uids) {
|
|||||||
|
|
||||||
CSocket.prototype.newMessageId = function() {
|
CSocket.prototype.newMessageId = function() {
|
||||||
return (++this.messageIdCounter) % 65536;
|
return (++this.messageIdCounter) % 65536;
|
||||||
}
|
};
|
||||||
|
|
||||||
CSocket.prototype.resetReceive = function() {
|
CSocket.prototype.resetReceive = function() {
|
||||||
this.receiving = this.receiveLength = null;
|
this.receiving = this.receiveLength = null;
|
||||||
@ -197,7 +213,7 @@ CSocket.prototype.released = function() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
CSocket.prototype.ready = function() {
|
CSocket.prototype.ready = function() {
|
||||||
console.log("Connection established");
|
console.log('Connection established');
|
||||||
this.connected = true;
|
this.connected = true;
|
||||||
this.started = time();
|
this.started = time();
|
||||||
|
|
||||||
@ -217,8 +233,6 @@ CSocket.prototype.checkIdle = function() {
|
|||||||
this.idleClose();
|
this.idleClose();
|
||||||
} else if (this.lastReceived && (current - this.lastReceived >= idl)) {
|
} else if (this.lastReceived && (current - this.lastReceived >= idl)) {
|
||||||
this.idleClose();
|
this.idleClose();
|
||||||
} else {
|
|
||||||
//console.log('keep idling')
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -228,7 +242,6 @@ CSocket.prototype.idleClose = function() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
CSocket.prototype.received = function(data) {
|
CSocket.prototype.received = function(data) {
|
||||||
var i = 0;
|
|
||||||
do {
|
do {
|
||||||
data = this.process(data);
|
data = this.process(data);
|
||||||
} while (data !== null);
|
} while (data !== null);
|
||||||
@ -236,7 +249,6 @@ CSocket.prototype.received = function(data) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
CSocket.prototype.process = function(data) {
|
CSocket.prototype.process = function(data) {
|
||||||
//console.log("Data received");
|
|
||||||
if (this.receiving === null) {
|
if (this.receiving === null) {
|
||||||
if (this.minRecv) {
|
if (this.minRecv) {
|
||||||
data = Buffer.concat([this.minRecv, data], this.minRecv.length + data.length);
|
data = Buffer.concat([this.minRecv, data], this.minRecv.length + data.length);
|
||||||
@ -263,6 +275,7 @@ CSocket.prototype.process = function(data) {
|
|||||||
process = data.slice(0, len + 6);
|
process = data.slice(0, len + 6);
|
||||||
remaining = data.slice(len + 6, cmp + 6);
|
remaining = data.slice(len + 6, cmp + 6);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.resetReceive();
|
this.resetReceive();
|
||||||
this.interpret(new ReadStream(process), this);
|
this.interpret(new ReadStream(process), this);
|
||||||
if (remaining) {
|
if (remaining) {
|
||||||
@ -270,6 +283,7 @@ CSocket.prototype.process = function(data) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
console.log('Data received');
|
||||||
var newData = Buffer.concat([this.receiving, data], this.receiving.length + data.length),
|
var newData = Buffer.concat([this.receiving, data], this.receiving.length + data.length),
|
||||||
pduLength = newData.length - 6;
|
pduLength = newData.length - 6;
|
||||||
|
|
||||||
@ -281,6 +295,7 @@ CSocket.prototype.process = function(data) {
|
|||||||
remaining = newData.slice(this.receiveLength + 6, pduLength + 6);
|
remaining = newData.slice(this.receiveLength + 6, pduLength + 6);
|
||||||
newData = newData.slice(0, this.receiveLength + 6);
|
newData = newData.slice(0, this.receiveLength + 6);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.resetReceive();
|
this.resetReceive();
|
||||||
this.interpret(new ReadStream(newData));
|
this.interpret(new ReadStream(newData));
|
||||||
if (remaining) {
|
if (remaining) {
|
||||||
@ -288,6 +303,7 @@ CSocket.prototype.process = function(data) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -302,8 +318,9 @@ CSocket.prototype.interpret = function(stream) {
|
|||||||
pdu.presentationContextItems.forEach(function(ctx) {
|
pdu.presentationContextItems.forEach(function(ctx) {
|
||||||
var requested = o.getContext(ctx.presentationContextID);
|
var requested = o.getContext(ctx.presentationContextID);
|
||||||
if (!requested) {
|
if (!requested) {
|
||||||
throw "Accepted presentation context not found";
|
throw 'Accepted presentation context not found';
|
||||||
}
|
}
|
||||||
|
|
||||||
o.negotiatedContexts[ctx.presentationContextID] = {
|
o.negotiatedContexts[ctx.presentationContextID] = {
|
||||||
id: ctx.presentationContextID,
|
id: ctx.presentationContextID,
|
||||||
transferSyntax: ctx.transferSyntaxesItems[0].transferSyntaxName,
|
transferSyntax: ctx.transferSyntaxesItems[0].transferSyntaxName,
|
||||||
@ -350,11 +367,13 @@ CSocket.prototype.interpret = function(stream) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pdvs[i].isLast) {
|
if (pdvs[i].isLast) {
|
||||||
this.emit('message', pdvs[i]);
|
this.emit('message', pdvs[i]);
|
||||||
} else {
|
} else {
|
||||||
this.pendingPDVs = [pdvs[i]];
|
this.pendingPDVs = [pdvs[i]];
|
||||||
}
|
}
|
||||||
|
|
||||||
i = j;
|
i = j;
|
||||||
} else {
|
} else {
|
||||||
this.emit('message', pdvs[i++]);
|
this.emit('message', pdvs[i++]);
|
||||||
@ -377,9 +396,11 @@ CSocket.prototype.receivedMessage = function(pdv) {
|
|||||||
if (msg.is(C.COMMAND_C_GET_RSP) || msg.is(C.COMMAND_C_MOVE_RSP)) {
|
if (msg.is(C.COMMAND_C_GET_RSP) || msg.is(C.COMMAND_C_MOVE_RSP)) {
|
||||||
//console.log('remaining', msg.getNumOfRemainingSubOperations(), msg.getNumOfCompletedSubOperations());
|
//console.log('remaining', msg.getNumOfRemainingSubOperations(), msg.getNumOfCompletedSubOperations());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (msg.failure()) {
|
if (msg.failure()) {
|
||||||
console.log("message failed with status ", msg.getStatus().toString(16));
|
console.log('message failed with status ', msg.getStatus().toString(16));
|
||||||
}
|
}
|
||||||
|
|
||||||
listener.emit('response', msg);
|
listener.emit('response', msg);
|
||||||
if (msg.isFinal()) {
|
if (msg.isFinal()) {
|
||||||
if (listener) {
|
if (listener) {
|
||||||
@ -403,7 +424,7 @@ CSocket.prototype.receivedMessage = function(pdv) {
|
|||||||
|
|
||||||
} else {
|
} else {
|
||||||
if (!this.lastCommand) {
|
if (!this.lastCommand) {
|
||||||
throw "Only dataset?";
|
throw 'Only dataset?';
|
||||||
} else if (!this.lastCommand.haveData()) {
|
} else if (!this.lastCommand.haveData()) {
|
||||||
throw "Last command didn't indicate presence of data";
|
throw "Last command didn't indicate presence of data";
|
||||||
}
|
}
|
||||||
@ -413,7 +434,7 @@ CSocket.prototype.receivedMessage = function(pdv) {
|
|||||||
if (this.messages[replyId].listener) {
|
if (this.messages[replyId].listener) {
|
||||||
var flag = this.lastCommand.failure() ? true : false;
|
var flag = this.lastCommand.failure() ? true : false;
|
||||||
|
|
||||||
this.messages[replyId].listener.emit("result", msg, flag);
|
this.messages[replyId].listener.emit('result', msg, flag);
|
||||||
|
|
||||||
if (this.lastCommand.failure()) {
|
if (this.lastCommand.failure()) {
|
||||||
delete this.messages[replyId];
|
delete this.messages[replyId];
|
||||||
@ -429,7 +450,7 @@ CSocket.prototype.receivedMessage = function(pdv) {
|
|||||||
if (this.lastGets.length > 0) {
|
if (this.lastGets.length > 0) {
|
||||||
useId = this.lastGets[0];
|
useId = this.lastGets[0];
|
||||||
} else {
|
} else {
|
||||||
throw "Where does this c-store came from?";
|
throw 'Where does this c-store came from?';
|
||||||
}
|
}
|
||||||
} else console.log('move ', moveMessageId);
|
} else console.log('move ', moveMessageId);
|
||||||
//this.storeResponse(useId, msg);
|
//this.storeResponse(useId, msg);
|
||||||
@ -447,7 +468,7 @@ CSocket.prototype.wrapToPData = function(message, context) {
|
|||||||
pdv.setMessage(message);
|
pdv.setMessage(message);
|
||||||
pdata.setPresentationDataValueItems([pdv]);
|
pdata.setPresentationDataValueItems([pdv]);
|
||||||
return pdata;
|
return pdata;
|
||||||
}
|
};
|
||||||
|
|
||||||
CSocket.prototype.sendMessage = function(context, command, dataset) {
|
CSocket.prototype.sendMessage = function(context, command, dataset) {
|
||||||
var nContext = this.getContextByUID(context),
|
var nContext = this.getContextByUID(context),
|
||||||
@ -474,20 +495,22 @@ CSocket.prototype.sendMessage = function(context, command, dataset) {
|
|||||||
command.setSyntax(C.IMPLICIT_LITTLE_ENDIAN);
|
command.setSyntax(C.IMPLICIT_LITTLE_ENDIAN);
|
||||||
command.setContextId(context);
|
command.setContextId(context);
|
||||||
command.setMessageId(messageId);
|
command.setMessageId(messageId);
|
||||||
if (dataset)
|
if (dataset) {
|
||||||
command.setDataSetPresent(C.DATA_SET_PRESENT);
|
command.setDataSetPresent(C.DATA_SET_PRESENT);
|
||||||
|
}
|
||||||
|
|
||||||
this.lastSent = command;
|
this.lastSent = command;
|
||||||
if (command.is(C.COMMAND_C_GET_RQ)) {
|
if (command.is(C.COMMAND_C_GET_RQ)) {
|
||||||
this.lastGets.push(messageId);
|
this.lastGets.push(messageId);
|
||||||
}
|
}
|
||||||
|
|
||||||
var pdata = this.wrapToPData(command);
|
var pdata = this.wrapToPData(command);
|
||||||
|
|
||||||
msgData.command = command;
|
msgData.command = command;
|
||||||
this.messages[messageId] = msgData;
|
this.messages[messageId] = msgData;
|
||||||
console.log('Sending command ' + command.typeString());
|
console.log('Sending command ' + command.typeString());
|
||||||
this.send(pdata);
|
this.send(pdata);
|
||||||
if (dataset && typeof dataset == 'object') {
|
if (dataset && typeof dataset === 'object') {
|
||||||
dataset.setSyntax(syntax);
|
dataset.setSyntax(syntax);
|
||||||
var dsData = new PDataTF(),
|
var dsData = new PDataTF(),
|
||||||
dPdv = new PresentationDataValueItem(cid);
|
dPdv = new PresentationDataValueItem(cid);
|
||||||
@ -496,6 +519,7 @@ CSocket.prototype.sendMessage = function(context, command, dataset) {
|
|||||||
dsData.setPresentationDataValueItems([dPdv]);
|
dsData.setPresentationDataValueItems([dPdv]);
|
||||||
this.send(dsData);
|
this.send(dsData);
|
||||||
}
|
}
|
||||||
|
|
||||||
return msgData.listener;
|
return msgData.listener;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -520,7 +544,9 @@ CSocket.prototype.wrapMessage = function(data) {
|
|||||||
var datasetMessage = new DataSetMessage();
|
var datasetMessage = new DataSetMessage();
|
||||||
datasetMessage.setElements(data);
|
datasetMessage.setElements(data);
|
||||||
return datasetMessage;
|
return datasetMessage;
|
||||||
} else return data;
|
} else {
|
||||||
|
return data;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
CSocket.prototype.find = function(params, options) {
|
CSocket.prototype.find = function(params, options) {
|
||||||
@ -540,7 +566,7 @@ CSocket.prototype.storeInstance = function(sopClassUID, sopInstanceUID, options)
|
|||||||
storeMessage.setAffectedSOPClassUID(sopClassUID);
|
storeMessage.setAffectedSOPClassUID(sopClassUID);
|
||||||
|
|
||||||
return this.sendMessage(sopClassUID, storeMessage, true);
|
return this.sendMessage(sopClassUID, storeMessage, true);
|
||||||
}
|
};
|
||||||
|
|
||||||
CSocket.prototype.moveInstances = function(destination, params, options) {
|
CSocket.prototype.moveInstances = function(destination, params, options) {
|
||||||
var sendParams = Object.assign({
|
var sendParams = Object.assign({
|
||||||
@ -556,10 +582,10 @@ CSocket.prototype.moveInstances = function(destination, params, options) {
|
|||||||
CSocket.prototype.findPatients = function(params, options) {
|
CSocket.prototype.findPatients = function(params, options) {
|
||||||
var sendParams = Object.assign({
|
var sendParams = Object.assign({
|
||||||
0x00080052: C.QUERY_RETRIEVE_LEVEL_PATIENT,
|
0x00080052: C.QUERY_RETRIEVE_LEVEL_PATIENT,
|
||||||
0x00100010: "",
|
0x00100010: '',
|
||||||
0x00100020: "",
|
0x00100020: '',
|
||||||
0x00100030: "",
|
0x00100030: '',
|
||||||
0x00100040: "",
|
0x00100040: '',
|
||||||
}, params);
|
}, params);
|
||||||
options = Object.assign({
|
options = Object.assign({
|
||||||
context: C.SOP_PATIENT_ROOT_FIND
|
context: C.SOP_PATIENT_ROOT_FIND
|
||||||
@ -571,10 +597,10 @@ CSocket.prototype.findPatients = function(params, options) {
|
|||||||
CSocket.prototype.findStudies = function(params, options) {
|
CSocket.prototype.findStudies = function(params, options) {
|
||||||
var sendParams = Object.assign({
|
var sendParams = Object.assign({
|
||||||
0x00080052: C.QUERY_RETRIEVE_LEVEL_STUDY,
|
0x00080052: C.QUERY_RETRIEVE_LEVEL_STUDY,
|
||||||
0x00080020: "",
|
0x00080020: '',
|
||||||
0x00100010: "",
|
0x00100010: '',
|
||||||
0x00080061: "",
|
0x00080061: '',
|
||||||
0x0020000D: ""
|
0x0020000D: ''
|
||||||
}, params);
|
}, params);
|
||||||
options = Object.assign({
|
options = Object.assign({
|
||||||
context: C.SOP_STUDY_ROOT_FIND
|
context: C.SOP_STUDY_ROOT_FIND
|
||||||
@ -586,10 +612,10 @@ CSocket.prototype.findStudies = function(params, options) {
|
|||||||
CSocket.prototype.findSeries = function(params, options) {
|
CSocket.prototype.findSeries = function(params, options) {
|
||||||
var sendParams = Object.assign({
|
var sendParams = Object.assign({
|
||||||
0x00080052: C.QUERY_RETRIEVE_LEVEL_SERIES,
|
0x00080052: C.QUERY_RETRIEVE_LEVEL_SERIES,
|
||||||
0x00080020: "",
|
0x00080020: '',
|
||||||
0x0020000E: "",
|
0x0020000E: '',
|
||||||
0x0008103E: "",
|
0x0008103E: '',
|
||||||
0x0020000D: ""
|
0x0020000D: ''
|
||||||
}, params);
|
}, params);
|
||||||
options = Object.assign({
|
options = Object.assign({
|
||||||
context: C.SOP_STUDY_ROOT_FIND
|
context: C.SOP_STUDY_ROOT_FIND
|
||||||
@ -601,10 +627,10 @@ CSocket.prototype.findSeries = function(params, options) {
|
|||||||
CSocket.prototype.findInstances = function(params, options) {
|
CSocket.prototype.findInstances = function(params, options) {
|
||||||
var sendParams = Object.assign({
|
var sendParams = Object.assign({
|
||||||
0x00080052: C.QUERY_RETRIEVE_LEVEL_IMAGE,
|
0x00080052: C.QUERY_RETRIEVE_LEVEL_IMAGE,
|
||||||
0x00080020: "",
|
0x00080020: '',
|
||||||
0x0020000E: "",
|
0x0020000E: '',
|
||||||
0x0008103E: "",
|
0x0008103E: '',
|
||||||
0x0020000D: ""
|
0x0020000D: ''
|
||||||
}, params);
|
}, params);
|
||||||
options = Object.assign({
|
options = Object.assign({
|
||||||
context: C.SOP_STUDY_ROOT_FIND
|
context: C.SOP_STUDY_ROOT_FIND
|
||||||
|
|||||||
@ -1,3 +1,5 @@
|
|||||||
|
// Uses NodeJS 'net'
|
||||||
|
// https://nodejs.org/api/net.html
|
||||||
var net = Npm.require('net'),
|
var net = Npm.require('net'),
|
||||||
Socket = net.Socket;
|
Socket = net.Socket;
|
||||||
|
|
||||||
@ -18,21 +20,24 @@ Connection = function (options) {
|
|||||||
this.peerSockets = {};
|
this.peerSockets = {};
|
||||||
this.defaultPeer = null;
|
this.defaultPeer = null;
|
||||||
this.defaultServer = null;
|
this.defaultServer = null;
|
||||||
}
|
};
|
||||||
|
|
||||||
util.inherits(Connection, EventEmitter);
|
util.inherits(Connection, EventEmitter);
|
||||||
|
|
||||||
var StoreHandle = function() {
|
var StoreHandle = function() {
|
||||||
EventEmitter.call(this);
|
EventEmitter.call(this);
|
||||||
}
|
};
|
||||||
|
|
||||||
util.inherits(StoreHandle, EventEmitter);
|
util.inherits(StoreHandle, EventEmitter);
|
||||||
|
|
||||||
Connection.prototype.addPeer = function(options) {
|
Connection.prototype.addPeer = function(options) {
|
||||||
if (!options.aeTitle || !options.host || !options.port) {
|
if (!options.aeTitle || !options.host || !options.port) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.peers[options.aeTitle] = {
|
this.peers[options.aeTitle] = {
|
||||||
host: options.host, port: options.port
|
host: options.host,
|
||||||
|
port: options.port
|
||||||
};
|
};
|
||||||
if (options.default) {
|
if (options.default) {
|
||||||
if (options.server) {
|
if (options.server) {
|
||||||
@ -41,14 +46,15 @@ Connection.prototype.addPeer = function (options) {
|
|||||||
this.defaultPeer = options.aeTitle;
|
this.defaultPeer = options.aeTitle;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (options.server) {
|
if (options.server) {
|
||||||
//start listening
|
//start listening
|
||||||
var server = net.createServer();
|
var server = net.createServer();
|
||||||
server.listen(options.port, options.host, function() {
|
server.listen(options.port, options.host, function() {
|
||||||
console.log("listening on %j", this.address());
|
console.log('listening on %j', this.address());
|
||||||
});
|
});
|
||||||
server.on('error', function(err) {
|
server.on('error', function(err) {
|
||||||
console.log("server error %j", err);
|
console.log('server error %j', err);
|
||||||
});
|
});
|
||||||
var o = this;
|
var o = this;
|
||||||
server.on('connection', function(nativeSocket) {
|
server.on('connection', function(nativeSocket) {
|
||||||
@ -66,27 +72,31 @@ Connection.prototype.addPeer = function (options) {
|
|||||||
|
|
||||||
Connection.prototype.selectPeer = function(aeTitle) {
|
Connection.prototype.selectPeer = function(aeTitle) {
|
||||||
if (!aeTitle || !this.peers[aeTitle]) {
|
if (!aeTitle || !this.peers[aeTitle]) {
|
||||||
throw "No such peer";
|
throw 'No such peer';
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.peers[aeTitle];
|
return this.peers[aeTitle];
|
||||||
};
|
};
|
||||||
|
|
||||||
Connection.prototype._sendFile = function(socket, sHandle, file, maxSend, metaLength, list) {
|
Connection.prototype._sendFile = function(socket, sHandle, file, maxSend, metaLength, list) {
|
||||||
var fileNameText = typeof file.file == 'string' ? file.file : 'buffer';
|
var fileNameText = typeof file.file === 'string' ? file.file : 'buffer';
|
||||||
console.log("Sending file " + fileNameText);
|
console.log('Sending file ' + fileNameText);
|
||||||
var useContext = socket.getContextByUID(file.context), self = this;
|
var useContext = socket.getContextByUID(file.context),
|
||||||
|
self = this;
|
||||||
|
|
||||||
PDU.generatePDatas(useContext.id, file.file, maxSend, null, metaLength, function(err, handle) {
|
PDU.generatePDatas(useContext.id, file.file, maxSend, null, metaLength, function(err, handle) {
|
||||||
if (err) {
|
if (err) {
|
||||||
console.log('Error while sending file');
|
console.log('Error while sending file');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var processNext = function() {
|
var processNext = function() {
|
||||||
var next = list.shift();
|
var next = list.shift();
|
||||||
if (next)
|
if (next) {
|
||||||
self._sendFile(socket, sHandle, next, maxSend, metaLength, list);
|
self._sendFile(socket, sHandle, next, maxSend, metaLength, list);
|
||||||
else
|
} else {
|
||||||
socket.release();
|
socket.release();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
var store = socket.storeInstance(useContext.abstractSyntax, file.uid);
|
var store = socket.storeInstance(useContext.abstractSyntax, file.uid);
|
||||||
@ -104,6 +114,7 @@ Connection.prototype._sendFile = function (socket, sHandle, file, maxSend, metaL
|
|||||||
if (msg.failure()) {
|
if (msg.failure()) {
|
||||||
error = new Error(statusText);
|
error = new Error(statusText);
|
||||||
}
|
}
|
||||||
|
|
||||||
sHandle.emit('file', error, fileNameText);
|
sHandle.emit('file', error, fileNameText);
|
||||||
processNext();
|
processNext();
|
||||||
});
|
});
|
||||||
@ -111,20 +122,27 @@ Connection.prototype._sendFile = function (socket, sHandle, file, maxSend, metaL
|
|||||||
};
|
};
|
||||||
|
|
||||||
Connection.prototype.storeInstances = function(fileList) {
|
Connection.prototype.storeInstances = function(fileList) {
|
||||||
var contexts = {}, read = 0, length = fileList.length, toSend = [], self = this, handle = new StoreHandle();
|
var contexts = {},
|
||||||
|
read = 0,
|
||||||
|
length = fileList.length,
|
||||||
|
toSend = [],
|
||||||
|
self = this,
|
||||||
|
handle = new StoreHandle();
|
||||||
var lastProcessedMetaLength;
|
var lastProcessedMetaLength;
|
||||||
fileList.forEach(function(bufferOrFile) {
|
fileList.forEach(function(bufferOrFile) {
|
||||||
var fileNameText = typeof bufferOrFile == 'string' ? bufferOrFile : 'buffer';
|
var fileNameText = typeof bufferOrFile === 'string' ? bufferOrFile : 'buffer';
|
||||||
DicomMessage.readMetaHeader(bufferOrFile, function(err, metaMessage, metaLength) {
|
DicomMessage.readMetaHeader(bufferOrFile, function(err, metaMessage, metaLength) {
|
||||||
read++;
|
read++;
|
||||||
if (err) {
|
if (err) {
|
||||||
handle.emit('file', err, fileNameText);
|
handle.emit('file', err, fileNameText);
|
||||||
if (read == length && toSend.length > 0 && lastProcessedMetaLength) {
|
if (read === length && toSend.length > 0 && lastProcessedMetaLength) {
|
||||||
sendProcessedFiles(self, contexts, toSend, handle, lastProcessedMetaLength);
|
sendProcessedFiles(self, contexts, toSend, handle, lastProcessedMetaLength);
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
console.log('Dicom file ' + (typeof bufferOrFile == 'string' ? bufferOrFile : 'buffer') + ' found');
|
|
||||||
|
console.log('Dicom file ' + (typeof bufferOrFile === 'string' ? bufferOrFile : 'buffer') + ' found');
|
||||||
lastProcessedMetaLength = metaLength;
|
lastProcessedMetaLength = metaLength;
|
||||||
var syntax = metaMessage.getValue(0x00020010),
|
var syntax = metaMessage.getValue(0x00020010),
|
||||||
sopClassUID = metaMessage.getValue(0x00020002),
|
sopClassUID = metaMessage.getValue(0x00020002),
|
||||||
@ -133,12 +151,18 @@ Connection.prototype.storeInstances = function (fileList) {
|
|||||||
if (!contexts[sopClassUID]) {
|
if (!contexts[sopClassUID]) {
|
||||||
contexts[sopClassUID] = [];
|
contexts[sopClassUID] = [];
|
||||||
}
|
}
|
||||||
if (syntax && contexts[sopClassUID].indexOf(syntax) == -1) {
|
|
||||||
|
if (syntax && contexts[sopClassUID].indexOf(syntax) === -1) {
|
||||||
contexts[sopClassUID].push(syntax);
|
contexts[sopClassUID].push(syntax);
|
||||||
}
|
}
|
||||||
toSend.push({file: bufferOrFile, context: sopClassUID, uid: instanceUID});
|
|
||||||
|
|
||||||
if (read == length) {
|
toSend.push({
|
||||||
|
file: bufferOrFile,
|
||||||
|
context: sopClassUID,
|
||||||
|
uid: instanceUID
|
||||||
|
});
|
||||||
|
|
||||||
|
if (read === length) {
|
||||||
sendProcessedFiles(self, contexts, toSend, handle, metaLength);
|
sendProcessedFiles(self, contexts, toSend, handle, metaLength);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -152,16 +176,20 @@ sendProcessedFiles = function (self, contexts, toSend, handle, metaLength) {
|
|||||||
for (var context in contexts) {
|
for (var context in contexts) {
|
||||||
var useSyntaxes = contexts[context];
|
var useSyntaxes = contexts[context];
|
||||||
if (useSyntaxes.length > 0) {
|
if (useSyntaxes.length > 0) {
|
||||||
useContexts.push({context: context, syntaxes: contexts[context]});
|
useContexts.push({
|
||||||
|
context: context,
|
||||||
|
syntaxes: contexts[context]
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
throw "No syntax specified for context " + context;
|
throw 'No syntax specified for context ' + context;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
self.associate({
|
self.associate({
|
||||||
contexts: useContexts
|
contexts: useContexts
|
||||||
}, function(ac) {
|
}, function(ac) {
|
||||||
var maxSend = ac.getMaxSize(), next = toSend.shift();
|
var maxSend = ac.getMaxSize(),
|
||||||
|
next = toSend.shift();
|
||||||
self._sendFile(this, handle, next, maxSend, metaLength, toSend);
|
self._sendFile(this, handle, next, maxSend, metaLength, toSend);
|
||||||
|
|
||||||
});
|
});
|
||||||
@ -180,7 +208,7 @@ Connection.prototype.storeResponse = function (messageId, msg) {
|
|||||||
replyMessage.setReplyMessageId(this.lastCommand.messageId);
|
replyMessage.setReplyMessageId(this.lastCommand.messageId);
|
||||||
this.sendMessage(replyMessage, null, null, storeSr);
|
this.sendMessage(replyMessage, null, null, storeSr);
|
||||||
} else {
|
} else {
|
||||||
throw "Missing store status";
|
throw 'Missing store status';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -193,6 +221,7 @@ Connection.prototype.allClosed = function () {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return allClosed;
|
return allClosed;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -200,10 +229,11 @@ Connection.prototype.addSocket = function (ae, socket) {
|
|||||||
if (!this.peerSockets[ae]) {
|
if (!this.peerSockets[ae]) {
|
||||||
this.peerSockets[ae] = {};
|
this.peerSockets[ae] = {};
|
||||||
}
|
}
|
||||||
|
|
||||||
this.peerSockets[ae][socket.id] = socket;
|
this.peerSockets[ae][socket.id] = socket;
|
||||||
|
|
||||||
var o = this;
|
var o = this;
|
||||||
socket.on("close", function () {
|
socket.on('close', function() {
|
||||||
if (o.peerSockets[ae][this.id]) {
|
if (o.peerSockets[ae][this.id]) {
|
||||||
delete o.peerSockets[ae][this.id];
|
delete o.peerSockets[ae][this.id];
|
||||||
}
|
}
|
||||||
@ -213,20 +243,31 @@ 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;
|
||||||
|
|
||||||
if (!hostAE || !sourceAE) {
|
if (!hostAE || !sourceAE) {
|
||||||
throw "Peers not provided or no defaults in settings";
|
throw 'Peers not provided or no defaults in settings';
|
||||||
}
|
}
|
||||||
|
|
||||||
var peerInfo = this.selectPeer(hostAE), nativeSocket = new Socket();
|
var peerInfo = this.selectPeer(hostAE),
|
||||||
var socket = new CSocket(nativeSocket, this.options), o = this;
|
nativeSocket = new Socket();
|
||||||
|
|
||||||
|
var socket = new CSocket(nativeSocket, this.options),
|
||||||
|
o = this;
|
||||||
|
|
||||||
if (callback) {
|
if (callback) {
|
||||||
socket.once('associated', callback);
|
socket.once('associated', callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
console.log('Starting Connection...');
|
||||||
|
|
||||||
socket.setCalledAe(hostAE);
|
socket.setCalledAe(hostAE);
|
||||||
socket.setCallingAE(sourceAE);
|
socket.setCallingAE(sourceAE);
|
||||||
|
|
||||||
|
console.log(peerInfo);
|
||||||
|
|
||||||
nativeSocket.connect({
|
nativeSocket.connect({
|
||||||
host: peerInfo.host, port: peerInfo.port
|
host: peerInfo.host,
|
||||||
|
port: peerInfo.port
|
||||||
}, function() {
|
}, function() {
|
||||||
//connected
|
//connected
|
||||||
o.addSocket(hostAE, socket);
|
o.addSocket(hostAE, socket);
|
||||||
@ -234,7 +275,7 @@ Connection.prototype.associate = function (options, callback) {
|
|||||||
if (options.contexts) {
|
if (options.contexts) {
|
||||||
socket.setPresentationContexts(options.contexts);
|
socket.setPresentationContexts(options.contexts);
|
||||||
} else {
|
} else {
|
||||||
throw "Contexts must be specified";
|
throw 'Contexts must be specified';
|
||||||
}
|
}
|
||||||
|
|
||||||
socket.associate();
|
socket.associate();
|
||||||
|
|||||||
@ -56,12 +56,14 @@ var getInstanceRetrievalParams = function(studyInstanceUID, seriesInstanceUID) {
|
|||||||
|
|
||||||
Meteor.startup(function() {
|
Meteor.startup(function() {
|
||||||
if (!Meteor.settings.servers.dimse || !Meteor.settings.servers.dimse.length) {
|
if (!Meteor.settings.servers.dimse || !Meteor.settings.servers.dimse.length) {
|
||||||
return;
|
console.error('dimse-config: ' + 'No DIMSE Servers provided.');
|
||||||
|
throw new Meteor.Error('dimse-config', 'No DIMSE Servers provided.');
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: [custom-servers] use active server and check if type is DIMSE
|
// TODO: [custom-servers] use active server and check if type is DIMSE
|
||||||
var peers = Meteor.settings.servers.dimse[0].peers;
|
var peers = Meteor.settings.servers.dimse[0].peers;
|
||||||
if (!peers || !peers.length) {
|
if (!peers || !peers.length) {
|
||||||
|
console.error('dimse-config: ' + 'No DIMSE Peers provided.');
|
||||||
throw new Meteor.Error('dimse-config', 'No DIMSE Peers provided.');
|
throw new Meteor.Error('dimse-config', 'No DIMSE Peers provided.');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -71,7 +73,7 @@ Meteor.startup(function() {
|
|||||||
conn.addPeer(peer);
|
conn.addPeer(peer);
|
||||||
});
|
});
|
||||||
} catch(error) {
|
} catch(error) {
|
||||||
console.warn('dimse-addPeers: ' + error);
|
console.error('dimse-addPeers: ' + error);
|
||||||
throw new Meteor.Error('dimse-addPeers', error);
|
throw new Meteor.Error('dimse-addPeers', error);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -82,6 +84,7 @@ DIMSE.associate = function(contexts, callback, options) {
|
|||||||
};
|
};
|
||||||
options = Object.assign(defaults, options);
|
options = Object.assign(defaults, options);
|
||||||
|
|
||||||
|
console.log('Associating...');
|
||||||
try {
|
try {
|
||||||
conn.associate(options, function(pdu) {
|
conn.associate(options, function(pdu) {
|
||||||
// associated
|
// associated
|
||||||
@ -89,7 +92,7 @@ DIMSE.associate = function(contexts, callback, options) {
|
|||||||
callback.call(this, pdu);
|
callback.call(this, pdu);
|
||||||
});
|
});
|
||||||
} catch(error) {
|
} catch(error) {
|
||||||
console.warn('dimse-associate: ' + error);
|
console.error('dimse-associate: ' + error);
|
||||||
throw new Meteor.Error('dimse-associate', error);
|
throw new Meteor.Error('dimse-associate', error);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -165,7 +168,8 @@ DIMSE.retrieveStudies = function(params, options) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
DIMSE._retrieveInstancesBySeries = function(conn, series, studyInstanceUID, callback, params) {
|
DIMSE._retrieveInstancesBySeries = function(conn, series, studyInstanceUID, callback, params) {
|
||||||
var aSeries = series.shift(), seriesInstanceUID = aSeries.getValue(0x0020000E),
|
var aSeries = series.shift(),
|
||||||
|
seriesInstanceUID = aSeries.getValue(0x0020000E),
|
||||||
defaultParams = getInstanceRetrievalParams(studyInstanceUID, seriesInstanceUID);
|
defaultParams = getInstanceRetrievalParams(studyInstanceUID, seriesInstanceUID);
|
||||||
|
|
||||||
var result = conn.findInstances(Object.assign(defaultParams, params)),
|
var result = conn.findInstances(Object.assign(defaultParams, params)),
|
||||||
@ -189,7 +193,8 @@ DIMSE.retrieveInstancesByStudyOnlyMulti = function(studyInstanceUID, params, opt
|
|||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
var series = DIMSE.retrieveSeries(studyInstanceUID, params, options), instances = [];
|
var series = DIMSE.retrieveSeries(studyInstanceUID, params, options),
|
||||||
|
instances = [];
|
||||||
series.forEach(function(seriesData) {
|
series.forEach(function(seriesData) {
|
||||||
var seriesInstanceUID = seriesData.getValue(0x0020000E);
|
var seriesInstanceUID = seriesData.getValue(0x0020000E);
|
||||||
|
|
||||||
@ -220,7 +225,9 @@ DIMSE.retrieveInstancesByStudyOnly = function(studyInstanceUID, params, options)
|
|||||||
0x00200011: ''
|
0x00200011: ''
|
||||||
};
|
};
|
||||||
var result = this.findSeries(Object.assign(defaultParams, params)),
|
var result = this.findSeries(Object.assign(defaultParams, params)),
|
||||||
series = [], conn = this, allInstances = [];
|
series = [],
|
||||||
|
conn = this,
|
||||||
|
allInstances = [];
|
||||||
|
|
||||||
result.on('result', function(msg) {
|
result.on('result', function(msg) {
|
||||||
series.push(msg);
|
series.push(msg);
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@ -5,45 +5,48 @@ Field = function(type, value) {
|
|||||||
|
|
||||||
Field.prototype.length = function() {
|
Field.prototype.length = function() {
|
||||||
return calcLength(this.type, this.value);
|
return calcLength(this.type, this.value);
|
||||||
}
|
};
|
||||||
|
|
||||||
Field.prototype.write = function(stream) {
|
Field.prototype.write = function(stream) {
|
||||||
stream.write(this.type, this.value);
|
stream.write(this.type, this.value);
|
||||||
}
|
};
|
||||||
|
|
||||||
Field.prototype.isNumeric = function() {
|
Field.prototype.isNumeric = function() {
|
||||||
return false;
|
return false;
|
||||||
}
|
};
|
||||||
|
|
||||||
BufferField = function(buffer, start, length) {
|
BufferField = function(buffer, start, length) {
|
||||||
Field.call(this, C.TYPE_BUFFER, buffer);
|
Field.call(this, C.TYPE_BUFFER, buffer);
|
||||||
this.bufferLength = length;
|
this.bufferLength = length;
|
||||||
this.bufferStart = start;
|
this.bufferStart = start;
|
||||||
}
|
};
|
||||||
|
|
||||||
util.inherits(BufferField, Field);
|
util.inherits(BufferField, Field);
|
||||||
|
|
||||||
BufferField.prototype.length = function() {
|
BufferField.prototype.length = function() {
|
||||||
return this.bufferLength;
|
return this.bufferLength;
|
||||||
}
|
};
|
||||||
|
|
||||||
BufferField.prototype.write = function(stream) {
|
BufferField.prototype.write = function(stream) {
|
||||||
stream.writeRawBuffer(this.value, this.bufferStart, this.bufferLength);
|
stream.writeRawBuffer(this.value, this.bufferStart, this.bufferLength);
|
||||||
}
|
};
|
||||||
|
|
||||||
StringField = function(str) {
|
StringField = function(str) {
|
||||||
Field.call(this, C.TYPE_ASCII, typeof str == 'string' ? str : "");
|
Field.call(this, C.TYPE_ASCII, typeof str == 'string' ? str : '');
|
||||||
}
|
};
|
||||||
|
|
||||||
util.inherits(StringField, Field);
|
util.inherits(StringField, Field);
|
||||||
|
|
||||||
FilledField = function(value, length) {
|
FilledField = function(value, length) {
|
||||||
Field.call(this, C.TYPE_COMPOSITE, value);
|
Field.call(this, C.TYPE_COMPOSITE, value);
|
||||||
this.fillLength = length;
|
this.fillLength = length;
|
||||||
}
|
};
|
||||||
|
|
||||||
util.inherits(FilledField, Field);
|
util.inherits(FilledField, Field);
|
||||||
|
|
||||||
FilledField.prototype.length = function() {
|
FilledField.prototype.length = function() {
|
||||||
return this.fillLength;
|
return this.fillLength;
|
||||||
}
|
};
|
||||||
|
|
||||||
FilledField.prototype.write = function(stream) {
|
FilledField.prototype.write = function(stream) {
|
||||||
var len = this.value.length;
|
var len = this.value.length;
|
||||||
@ -51,93 +54,103 @@ FilledField.prototype.write = function(stream) {
|
|||||||
if (len > 0)
|
if (len > 0)
|
||||||
stream.write(C.TYPE_ASCII, this.value);
|
stream.write(C.TYPE_ASCII, this.value);
|
||||||
var zeroLength = this.fillLength - len;
|
var zeroLength = this.fillLength - len;
|
||||||
stream.write(C.TYPE_HEX, "20".repeat(zeroLength));
|
stream.write(C.TYPE_HEX, '20'.repeat(zeroLength));
|
||||||
} else if (len == this.fillLength) {
|
} else if (len == this.fillLength) {
|
||||||
stream.write(C.TYPE_ASCII, this.value);
|
stream.write(C.TYPE_ASCII, this.value);
|
||||||
} else {
|
} else {
|
||||||
throw "Length mismatch";
|
throw 'Length mismatch';
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
HexField = function(hex) {
|
HexField = function(hex) {
|
||||||
Field.call(this, C.TYPE_HEX, hex);
|
Field.call(this, C.TYPE_HEX, hex);
|
||||||
}
|
};
|
||||||
|
|
||||||
util.inherits(HexField, Field);
|
util.inherits(HexField, Field);
|
||||||
|
|
||||||
ReservedField = function(length) {
|
ReservedField = function(length) {
|
||||||
length = length || 1;
|
length = length || 1;
|
||||||
Field.call(this, C.TYPE_HEX, "00".repeat(length));
|
Field.call(this, C.TYPE_HEX, '00'.repeat(length));
|
||||||
}
|
};
|
||||||
|
|
||||||
util.inherits(ReservedField, Field);
|
util.inherits(ReservedField, Field);
|
||||||
|
|
||||||
UInt8Field = function(value) {
|
UInt8Field = function(value) {
|
||||||
Field.call(this, C.TYPE_UINT8, value);
|
Field.call(this, C.TYPE_UINT8, value);
|
||||||
}
|
};
|
||||||
|
|
||||||
util.inherits(UInt8Field, Field);
|
util.inherits(UInt8Field, Field);
|
||||||
|
|
||||||
UInt8Field.prototype.isNumeric = function() {
|
UInt8Field.prototype.isNumeric = function() {
|
||||||
return true;
|
return true;
|
||||||
}
|
};
|
||||||
|
|
||||||
UInt16Field = function(value) {
|
UInt16Field = function(value) {
|
||||||
Field.call(this, C.TYPE_UINT16, value);
|
Field.call(this, C.TYPE_UINT16, value);
|
||||||
}
|
};
|
||||||
|
|
||||||
util.inherits(UInt16Field, Field);
|
util.inherits(UInt16Field, Field);
|
||||||
|
|
||||||
UInt16Field.prototype.isNumeric = function() {
|
UInt16Field.prototype.isNumeric = function() {
|
||||||
return true;
|
return true;
|
||||||
}
|
};
|
||||||
|
|
||||||
UInt32Field = function(value) {
|
UInt32Field = function(value) {
|
||||||
Field.call(this, C.TYPE_UINT32, value);
|
Field.call(this, C.TYPE_UINT32, value);
|
||||||
}
|
};
|
||||||
|
|
||||||
util.inherits(UInt32Field, Field);
|
util.inherits(UInt32Field, Field);
|
||||||
|
|
||||||
UInt32Field.prototype.isNumeric = function() {
|
UInt32Field.prototype.isNumeric = function() {
|
||||||
return true;
|
return true;
|
||||||
}
|
};
|
||||||
|
|
||||||
Int8Field = function(value) {
|
Int8Field = function(value) {
|
||||||
Field.call(this, C.TYPE_INT8, value);
|
Field.call(this, C.TYPE_INT8, value);
|
||||||
}
|
};
|
||||||
|
|
||||||
util.inherits(Int8Field, Field);
|
util.inherits(Int8Field, Field);
|
||||||
|
|
||||||
Int8Field.prototype.isNumeric = function() {
|
Int8Field.prototype.isNumeric = function() {
|
||||||
return true;
|
return true;
|
||||||
}
|
};
|
||||||
|
|
||||||
Int16Field = function(value) {
|
Int16Field = function(value) {
|
||||||
Field.call(this, C.TYPE_INT16, value);
|
Field.call(this, C.TYPE_INT16, value);
|
||||||
}
|
};
|
||||||
|
|
||||||
util.inherits(Int16Field, Field);
|
util.inherits(Int16Field, Field);
|
||||||
|
|
||||||
Int16Field.prototype.isNumeric = function() {
|
Int16Field.prototype.isNumeric = function() {
|
||||||
return true;
|
return true;
|
||||||
}
|
};
|
||||||
|
|
||||||
Int32Field = function(value) {
|
Int32Field = function(value) {
|
||||||
Field.call(this, C.TYPE_INT32, value);
|
Field.call(this, C.TYPE_INT32, value);
|
||||||
}
|
};
|
||||||
|
|
||||||
util.inherits(Int32Field, Field);
|
util.inherits(Int32Field, Field);
|
||||||
|
|
||||||
Int32Field.prototype.isNumeric = function() {
|
Int32Field.prototype.isNumeric = function() {
|
||||||
return true;
|
return true;
|
||||||
}
|
};
|
||||||
|
|
||||||
FloatField = function(value) {
|
FloatField = function(value) {
|
||||||
Field.call(this, C.TYPE_FLOAT, value);
|
Field.call(this, C.TYPE_FLOAT, value);
|
||||||
}
|
};
|
||||||
|
|
||||||
util.inherits(FloatField, Field);
|
util.inherits(FloatField, Field);
|
||||||
|
|
||||||
FloatField.prototype.isNumeric = function() {
|
FloatField.prototype.isNumeric = function() {
|
||||||
return true;
|
return true;
|
||||||
}
|
};
|
||||||
|
|
||||||
DoubleField = function(value) {
|
DoubleField = function(value) {
|
||||||
Field.call(this, C.TYPE_DOUBLE, value);
|
Field.call(this, C.TYPE_DOUBLE, value);
|
||||||
}
|
};
|
||||||
|
|
||||||
util.inherits(DoubleField, Field);
|
util.inherits(DoubleField, Field);
|
||||||
|
|
||||||
DoubleField.prototype.isNumeric = function() {
|
DoubleField.prototype.isNumeric = function() {
|
||||||
return true;
|
return true;
|
||||||
}
|
};
|
||||||
|
|||||||
@ -7,7 +7,7 @@ DicomMessage = function(syntax) {
|
|||||||
|
|
||||||
DicomMessage.prototype.isCommand = function() {
|
DicomMessage.prototype.isCommand = function() {
|
||||||
return this.type == C.DATA_TYPE_COMMAND;
|
return this.type == C.DATA_TYPE_COMMAND;
|
||||||
}
|
};
|
||||||
|
|
||||||
DicomMessage.prototype.setSyntax = function(syntax) {
|
DicomMessage.prototype.setSyntax = function(syntax) {
|
||||||
this.syntax = syntax;
|
this.syntax = syntax;
|
||||||
@ -15,15 +15,15 @@ DicomMessage.prototype.setSyntax = function(syntax) {
|
|||||||
for (var tag in this.elementPairs) {
|
for (var tag in this.elementPairs) {
|
||||||
this.elementPairs[tag].setSyntax(this.syntax);
|
this.elementPairs[tag].setSyntax(this.syntax);
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
DicomMessage.prototype.setMessageId = function(id) {
|
DicomMessage.prototype.setMessageId = function(id) {
|
||||||
this.messageId = id;
|
this.messageId = id;
|
||||||
}
|
};
|
||||||
|
|
||||||
DicomMessage.prototype.setReplyMessageId = function(id) {
|
DicomMessage.prototype.setReplyMessageId = function(id) {
|
||||||
this.replyMessageId = id;
|
this.replyMessageId = id;
|
||||||
}
|
};
|
||||||
|
|
||||||
DicomMessage.prototype.command = function(cmds) {
|
DicomMessage.prototype.command = function(cmds) {
|
||||||
cmds.unshift(this.newElement(0x00000800, this.dataSetPresent ? C.DATA_SET_PRESENT : C.DATE_SET_ABSENCE));
|
cmds.unshift(this.newElement(0x00000800, this.dataSetPresent ? C.DATA_SET_PRESENT : C.DATE_SET_ABSENCE));
|
||||||
@ -39,7 +39,7 @@ DicomMessage.prototype.command = function(cmds) {
|
|||||||
|
|
||||||
cmds.unshift(this.newElement(0x00000000, length));
|
cmds.unshift(this.newElement(0x00000000, length));
|
||||||
return cmds;
|
return cmds;
|
||||||
}
|
};
|
||||||
|
|
||||||
DicomMessage.prototype.response = function(cmds) {
|
DicomMessage.prototype.response = function(cmds) {
|
||||||
cmds.unshift(this.newElement(0x00000800, this.dataSetPresent ? C.DATA_SET_PRESENT : C.DATE_SET_ABSENCE));
|
cmds.unshift(this.newElement(0x00000800, this.dataSetPresent ? C.DATA_SET_PRESENT : C.DATE_SET_ABSENCE));
|
||||||
@ -55,75 +55,77 @@ DicomMessage.prototype.response = function(cmds) {
|
|||||||
|
|
||||||
cmds.unshift(this.newElement(0x00000000, length));
|
cmds.unshift(this.newElement(0x00000000, length));
|
||||||
return cmds;
|
return cmds;
|
||||||
}
|
};
|
||||||
|
|
||||||
DicomMessage.prototype.setElements = function(pairs) {
|
DicomMessage.prototype.setElements = function(pairs) {
|
||||||
var p = {};
|
var p = {};
|
||||||
for (var tag in pairs) {
|
for (var tag in pairs) {
|
||||||
p[tag] = this.newElement(tag, pairs[tag]);
|
p[tag] = this.newElement(tag, pairs[tag]);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.elementPairs = p;
|
this.elementPairs = p;
|
||||||
}
|
};
|
||||||
|
|
||||||
DicomMessage.prototype.newElement = function(tag, value) {
|
DicomMessage.prototype.newElement = function(tag, value) {
|
||||||
return elementByType(tag, value, this.syntax);
|
return elementByType(tag, value, this.syntax);
|
||||||
}
|
};
|
||||||
|
|
||||||
DicomMessage.prototype.setElement = function(key, value) {
|
DicomMessage.prototype.setElement = function(key, value) {
|
||||||
this.elementPairs[key] = elementByType(key, value);
|
this.elementPairs[key] = elementByType(key, value);
|
||||||
}
|
};
|
||||||
|
|
||||||
DicomMessage.prototype.setElementPairs = function(pairs) {
|
DicomMessage.prototype.setElementPairs = function(pairs) {
|
||||||
this.elementPairs = pairs;
|
this.elementPairs = pairs;
|
||||||
}
|
};
|
||||||
|
|
||||||
DicomMessage.prototype.setContextId = function(context) {
|
DicomMessage.prototype.setContextId = function(context) {
|
||||||
this.contextUID = context;
|
this.contextUID = context;
|
||||||
}
|
};
|
||||||
|
|
||||||
DicomMessage.prototype.setPriority = function(pri) {
|
DicomMessage.prototype.setPriority = function(pri) {
|
||||||
this.priority = pri;
|
this.priority = pri;
|
||||||
}
|
};
|
||||||
|
|
||||||
DicomMessage.prototype.setType = function(type) {
|
DicomMessage.prototype.setType = function(type) {
|
||||||
this.type = type;
|
this.type = type;
|
||||||
}
|
};
|
||||||
|
|
||||||
DicomMessage.prototype.setDataSetPresent = function(present) {
|
DicomMessage.prototype.setDataSetPresent = function(present) {
|
||||||
this.dataSetPresent = present == 0x0101 ? false : true;
|
this.dataSetPresent = present == 0x0101 ? false : true;
|
||||||
}
|
};
|
||||||
|
|
||||||
DicomMessage.prototype.haveData = function() {
|
DicomMessage.prototype.haveData = function() {
|
||||||
return this.dataSetPresent;
|
return this.dataSetPresent;
|
||||||
}
|
};
|
||||||
|
|
||||||
DicomMessage.prototype.tags = function() {
|
DicomMessage.prototype.tags = function() {
|
||||||
return Object.keys(this.elementPairs);
|
return Object.keys(this.elementPairs);
|
||||||
}
|
};
|
||||||
|
|
||||||
DicomMessage.prototype.key = function(tag) {
|
DicomMessage.prototype.key = function(tag) {
|
||||||
return elementKeywordByTag(tag);
|
return elementKeywordByTag(tag);
|
||||||
}
|
};
|
||||||
|
|
||||||
DicomMessage.prototype.getValue = function(tag) {
|
DicomMessage.prototype.getValue = function(tag) {
|
||||||
return this.elementPairs[tag] ? this.elementPairs[tag].getValue() : null;
|
return this.elementPairs[tag] ? this.elementPairs[tag].getValue() : null;
|
||||||
}
|
};
|
||||||
|
|
||||||
DicomMessage.prototype.affectedSOPClassUID = function() {
|
DicomMessage.prototype.affectedSOPClassUID = function() {
|
||||||
return this.getValue(0x00000002);
|
return this.getValue(0x00000002);
|
||||||
}
|
};
|
||||||
|
|
||||||
DicomMessage.prototype.getMessageId = function() {
|
DicomMessage.prototype.getMessageId = function() {
|
||||||
return this.getValue(0x00000110);
|
return this.getValue(0x00000110);
|
||||||
}
|
};
|
||||||
|
|
||||||
DicomMessage.prototype.getFields = function() {
|
DicomMessage.prototype.getFields = function() {
|
||||||
var eles = [];
|
var eles = [];
|
||||||
for (var tag in this.elementPairs) {
|
for (var tag in this.elementPairs) {
|
||||||
eles.push(this.elementPairs[tag]);
|
eles.push(this.elementPairs[tag]);
|
||||||
}
|
}
|
||||||
|
|
||||||
return eles;
|
return eles;
|
||||||
}
|
};
|
||||||
|
|
||||||
DicomMessage.prototype.length = function(elems) {
|
DicomMessage.prototype.length = function(elems) {
|
||||||
var len = 0;
|
var len = 0;
|
||||||
@ -131,79 +133,84 @@ DicomMessage.prototype.length = function(elems) {
|
|||||||
len += elem.length(elem.getFields());
|
len += elem.length(elem.getFields());
|
||||||
});
|
});
|
||||||
return len;
|
return len;
|
||||||
}
|
};
|
||||||
|
|
||||||
DicomMessage.prototype.isResponse = function() {
|
DicomMessage.prototype.isResponse = function() {
|
||||||
return false;
|
return false;
|
||||||
}
|
};
|
||||||
|
|
||||||
DicomMessage.prototype.is = function(type) {
|
DicomMessage.prototype.is = function(type) {
|
||||||
return this.commandType == type;
|
return this.commandType == type;
|
||||||
}
|
};
|
||||||
|
|
||||||
DicomMessage.prototype.write = function(stream) {
|
DicomMessage.prototype.write = function(stream) {
|
||||||
var fields = this.getFields(), o = this;
|
var fields = this.getFields(),
|
||||||
|
o = this;
|
||||||
fields.forEach(function(field) {
|
fields.forEach(function(field) {
|
||||||
field.setSyntax(o.syntax);
|
field.setSyntax(o.syntax);
|
||||||
field.write(stream);
|
field.write(stream);
|
||||||
});
|
});
|
||||||
}
|
};
|
||||||
|
|
||||||
DicomMessage.prototype.printElements = function(pairs, indent) {
|
DicomMessage.prototype.printElements = function(pairs, indent) {
|
||||||
var typeName = "";
|
var typeName = '';
|
||||||
for (var tag in pairs) {
|
for (var tag in pairs) {
|
||||||
var value = pairs[tag].getValue();
|
var value = pairs[tag].getValue();
|
||||||
typeName += (" ".repeat(indent)) + this.key(tag) + " : ";
|
typeName += (' '.repeat(indent)) + this.key(tag) + ' : ';
|
||||||
if (value instanceof Array) {
|
if (value instanceof Array) {
|
||||||
var o = this;
|
var o = this;
|
||||||
value.forEach(function(p) {
|
value.forEach(function(p) {
|
||||||
if (typeof p == "object") {
|
if (typeof p == 'object') {
|
||||||
typeName += "[\n" + o.printElements(p, indent + 2) + (" ".repeat(indent)) + "]";
|
typeName += '[\n' + o.printElements(p, indent + 2) + (' '.repeat(indent)) + ']';
|
||||||
} else {
|
} else {
|
||||||
typeName += "[" + p + "]";
|
typeName += '[' + p + ']';
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
if (typeName[typeName.length-1] != "\n") {
|
if (typeName[typeName.length - 1] != '\n') {
|
||||||
typeName += "\n";
|
typeName += '\n';
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
typeName += value + "\n";
|
typeName += value + '\n';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return typeName;
|
|
||||||
}
|
return typeName;
|
||||||
|
};
|
||||||
|
|
||||||
DicomMessage.prototype.typeString = function() {
|
DicomMessage.prototype.typeString = function() {
|
||||||
var typeName = "";
|
var typeName = '';
|
||||||
if (!this.isCommand()) {
|
if (!this.isCommand()) {
|
||||||
typeName = "DateSet Message";
|
typeName = 'DateSet Message';
|
||||||
} else {
|
} else {
|
||||||
switch (this.commandType) {
|
switch (this.commandType) {
|
||||||
case C.COMMAND_C_GET_RSP : typeName = "C-GET-RSP"; break;
|
case C.COMMAND_C_GET_RSP : typeName = 'C-GET-RSP'; break;
|
||||||
case C.COMMAND_C_MOVE_RSP : typeName = "C-MOVE-RSP"; break;
|
case C.COMMAND_C_MOVE_RSP : typeName = 'C-MOVE-RSP'; break;
|
||||||
case C.COMMAND_C_GET_RQ : typeName = "C-GET-RQ"; break;
|
case C.COMMAND_C_GET_RQ : typeName = 'C-GET-RQ'; break;
|
||||||
case C.COMMAND_C_STORE_RQ : typeName = "C-STORE-RQ"; break;
|
case C.COMMAND_C_STORE_RQ : typeName = 'C-STORE-RQ'; break;
|
||||||
case C.COMMAND_C_FIND_RSP : typeName = "C-FIND-RSP"; break;
|
case C.COMMAND_C_FIND_RSP : typeName = 'C-FIND-RSP'; break;
|
||||||
case C.COMMAND_C_MOVE_RQ : typeName = "C-MOVE-RQ"; break;
|
case C.COMMAND_C_MOVE_RQ : typeName = 'C-MOVE-RQ'; break;
|
||||||
case C.COMMAND_C_FIND_RQ : typeName = "C-FIND-RQ"; break;
|
case C.COMMAND_C_FIND_RQ : typeName = 'C-FIND-RQ'; break;
|
||||||
case C.COMMAND_C_STORE_RSP : typeName = "C-STORE-RSP"; break;
|
case C.COMMAND_C_STORE_RSP : typeName = 'C-STORE-RSP'; break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return typeName;
|
return typeName;
|
||||||
}
|
};
|
||||||
|
|
||||||
DicomMessage.prototype.toString = function() {
|
DicomMessage.prototype.toString = function() {
|
||||||
var typeName = this.typeString();
|
var typeName = this.typeString();
|
||||||
typeName += " [\n";
|
typeName += ' [\n';
|
||||||
typeName += this.printElements(this.elementPairs, 0);
|
typeName += this.printElements(this.elementPairs, 0);
|
||||||
typeName += "]";
|
typeName += ']';
|
||||||
return typeName;
|
return typeName;
|
||||||
}
|
};
|
||||||
|
|
||||||
DicomMessage.prototype.walkObject = function(pairs) {
|
DicomMessage.prototype.walkObject = function(pairs) {
|
||||||
var obj = {}, o = this;
|
var obj = {},
|
||||||
|
o = this;
|
||||||
for (var tag in pairs) {
|
for (var tag in pairs) {
|
||||||
var v = pairs[tag].getValue(), u = v;
|
var v = pairs[tag].getValue(),
|
||||||
|
u = v;
|
||||||
if (v instanceof Array) {
|
if (v instanceof Array) {
|
||||||
u = [];
|
u = [];
|
||||||
v.forEach(function(a) {
|
v.forEach(function(a) {
|
||||||
@ -212,15 +219,16 @@ DicomMessage.prototype.walkObject = function(pairs) {
|
|||||||
} else u.push(a);
|
} else u.push(a);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
obj[tag] = u;
|
obj[tag] = u;
|
||||||
}
|
}
|
||||||
|
|
||||||
return obj;
|
return obj;
|
||||||
}
|
};
|
||||||
|
|
||||||
DicomMessage.prototype.toObject = function() {
|
DicomMessage.prototype.toObject = function() {
|
||||||
return this.walkObject(this.elementPairs);
|
return this.walkObject(this.elementPairs);
|
||||||
}
|
};
|
||||||
|
|
||||||
DicomMessage.readToPairs = function(stream, syntax, options) {
|
DicomMessage.readToPairs = function(stream, syntax, options) {
|
||||||
var pairs = {};
|
var pairs = {};
|
||||||
@ -229,16 +237,18 @@ DicomMessage.readToPairs = function(stream, syntax, options) {
|
|||||||
if (options) {
|
if (options) {
|
||||||
elem.setOptions(options);
|
elem.setOptions(options);
|
||||||
}
|
}
|
||||||
|
|
||||||
elem.setSyntax(syntax);
|
elem.setSyntax(syntax);
|
||||||
elem.readBytes(stream);
|
elem.readBytes(stream);
|
||||||
pairs[elem.tag.value] = elem;
|
pairs[elem.tag.value] = elem;
|
||||||
}
|
}
|
||||||
|
|
||||||
return pairs;
|
return pairs;
|
||||||
}
|
};
|
||||||
|
|
||||||
var fileValid = function(stream) {
|
var fileValid = function(stream) {
|
||||||
return stream.readString(4, C.TYPE_ASCII) == 'DICM';
|
return stream.readString(4, C.TYPE_ASCII) == 'DICM';
|
||||||
}
|
};
|
||||||
|
|
||||||
var readMetaStream = function(stream, useSyntax, length, callback) {
|
var readMetaStream = function(stream, useSyntax, length, callback) {
|
||||||
var message = new FileMetaMessage();
|
var message = new FileMetaMessage();
|
||||||
@ -246,8 +256,9 @@ var readMetaStream = function(stream, useSyntax, length, callback) {
|
|||||||
if (callback) {
|
if (callback) {
|
||||||
callback(null, message, length);
|
callback(null, message, length);
|
||||||
}
|
}
|
||||||
|
|
||||||
return message;
|
return message;
|
||||||
}
|
};
|
||||||
|
|
||||||
DicomMessage.readMetaHeader = function(bufferOrFile, callback) {
|
DicomMessage.readMetaHeader = function(bufferOrFile, callback) {
|
||||||
var useSyntax = C.EXPLICIT_LITTLE_ENDIAN;
|
var useSyntax = C.EXPLICIT_LITTLE_ENDIAN;
|
||||||
@ -258,6 +269,7 @@ DicomMessage.readMetaHeader = function(bufferOrFile, callback) {
|
|||||||
if (!fileValid(stream)) {
|
if (!fileValid(stream)) {
|
||||||
return quitWithError('Invalid a dicom file ', callback);
|
return quitWithError('Invalid a dicom file ', callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
var el = readAElement(stream, useSyntax),
|
var el = readAElement(stream, useSyntax),
|
||||||
metaLength = el.value,
|
metaLength = el.value,
|
||||||
metaStream = stream.more(metaLength);
|
metaStream = stream.more(metaLength);
|
||||||
@ -269,17 +281,20 @@ DicomMessage.readMetaHeader = function(bufferOrFile, callback) {
|
|||||||
//fs.closeSync(fd);
|
//fs.closeSync(fd);
|
||||||
return quitWithError('Cannot open file', callback);
|
return quitWithError('Cannot open file', callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
var buffer = new Buffer(16);
|
var buffer = new Buffer(16);
|
||||||
fs.read(fd, buffer, 0, 16, 128, function(err, bytesRead) {
|
fs.read(fd, buffer, 0, 16, 128, function(err, bytesRead) {
|
||||||
if (err || bytesRead != 16) {
|
if (err || bytesRead != 16) {
|
||||||
fs.closeSync(fd);
|
fs.closeSync(fd);
|
||||||
return quitWithError('Cannot read file', callback);
|
return quitWithError('Cannot read file', callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
var stream = new ReadStream(buffer);
|
var stream = new ReadStream(buffer);
|
||||||
if (!fileValid(stream)) {
|
if (!fileValid(stream)) {
|
||||||
fs.closeSync(fd);
|
fs.closeSync(fd);
|
||||||
return quitWithError('Not a dicom file ' + bufferOrFile, callback);
|
return quitWithError('Not a dicom file ' + bufferOrFile, callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
var el = readAElement(stream, useSyntax),
|
var el = readAElement(stream, useSyntax),
|
||||||
metaLength = el.value,
|
metaLength = el.value,
|
||||||
metaBuffer = new Buffer(metaLength);
|
metaBuffer = new Buffer(metaLength);
|
||||||
@ -289,6 +304,7 @@ DicomMessage.readMetaHeader = function(bufferOrFile, callback) {
|
|||||||
if (err || bytesRead != metaLength) {
|
if (err || bytesRead != metaLength) {
|
||||||
return quitWithError('Invalid a dicom file ' + bufferOrFile, callback);
|
return quitWithError('Invalid a dicom file ' + bufferOrFile, callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
var metaStream = new ReadStream(metaBuffer);
|
var metaStream = new ReadStream(metaBuffer);
|
||||||
return readMetaStream(metaStream, useSyntax, metaLength, callback);
|
return readMetaStream(metaStream, useSyntax, metaLength, callback);
|
||||||
});
|
});
|
||||||
@ -297,16 +313,19 @@ DicomMessage.readMetaHeader = function(bufferOrFile, callback) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
};
|
||||||
|
|
||||||
DicomMessage.read = function(stream, type, syntax, options) {
|
DicomMessage.read = function(stream, type, syntax, options) {
|
||||||
var elements = [], pairs = {}, useSyntax = type == C.DATA_TYPE_COMMAND ? C.IMPLICIT_LITTLE_ENDIAN : syntax;
|
var elements = [],
|
||||||
|
pairs = {},
|
||||||
|
useSyntax = type == C.DATA_TYPE_COMMAND ? C.IMPLICIT_LITTLE_ENDIAN : syntax;
|
||||||
stream.reset();
|
stream.reset();
|
||||||
while (!stream.end()) {
|
while (!stream.end()) {
|
||||||
var elem = new DataElement();
|
var elem = new DataElement();
|
||||||
if (options) {
|
if (options) {
|
||||||
elem.setOptions(options);
|
elem.setOptions(options);
|
||||||
}
|
}
|
||||||
|
|
||||||
elem.setSyntax(useSyntax);
|
elem.setSyntax(useSyntax);
|
||||||
elem.readBytes(stream);//return;
|
elem.readBytes(stream);//return;
|
||||||
pairs[elem.tag.value] = elem;
|
pairs[elem.tag.value] = elem;
|
||||||
@ -323,7 +342,7 @@ DicomMessage.read = function(stream, type, syntax, options) {
|
|||||||
case 0x0001 : message = new CStoreRQ(useSyntax); break;
|
case 0x0001 : message = new CStoreRQ(useSyntax); break;
|
||||||
case 0x0020 : message = new CFindRQ(useSyntax); break;
|
case 0x0020 : message = new CFindRQ(useSyntax); break;
|
||||||
case 0x8001 : message = new CStoreRSP(useSyntax); break;
|
case 0x8001 : message = new CStoreRSP(useSyntax); break;
|
||||||
default : throw "Unrecognized command type " + cmdType.toString(16); break;
|
default : throw 'Unrecognized command type ' + cmdType.toString(16); break;
|
||||||
}
|
}
|
||||||
|
|
||||||
message.setElementPairs(pairs);
|
message.setElementPairs(pairs);
|
||||||
@ -338,25 +357,28 @@ DicomMessage.read = function(stream, type, syntax, options) {
|
|||||||
message = new DataSetMessage(useSyntax);
|
message = new DataSetMessage(useSyntax);
|
||||||
message.setElementPairs(pairs);
|
message.setElementPairs(pairs);
|
||||||
} else {
|
} else {
|
||||||
throw "Unrecognized message type";
|
throw 'Unrecognized message type';
|
||||||
}
|
}
|
||||||
|
|
||||||
return message;
|
return message;
|
||||||
}
|
};
|
||||||
|
|
||||||
DataSetMessage = function(syntax) {
|
DataSetMessage = function(syntax) {
|
||||||
DicomMessage.call(this, syntax);
|
DicomMessage.call(this, syntax);
|
||||||
this.type = C.DATA_TYPE_DATA;
|
this.type = C.DATA_TYPE_DATA;
|
||||||
};
|
};
|
||||||
|
|
||||||
util.inherits(DataSetMessage, DicomMessage);
|
util.inherits(DataSetMessage, DicomMessage);
|
||||||
|
|
||||||
DataSetMessage.prototype.is = function(type) {
|
DataSetMessage.prototype.is = function(type) {
|
||||||
return false;
|
return false;
|
||||||
}
|
};
|
||||||
|
|
||||||
FileMetaMessage = function(syntax) {
|
FileMetaMessage = function(syntax) {
|
||||||
DicomMessage.call(this, syntax);
|
DicomMessage.call(this, syntax);
|
||||||
this.type = null
|
this.type = null;
|
||||||
};
|
};
|
||||||
|
|
||||||
util.inherits(FileMetaMessage, DicomMessage);
|
util.inherits(FileMetaMessage, DicomMessage);
|
||||||
|
|
||||||
CommandMessage = function(syntax) {
|
CommandMessage = function(syntax) {
|
||||||
@ -364,101 +386,106 @@ CommandMessage = function(syntax) {
|
|||||||
this.type = C.DATA_TYPE_COMMAND;
|
this.type = C.DATA_TYPE_COMMAND;
|
||||||
this.priority = C.PRIORITY_MEDIUM;
|
this.priority = C.PRIORITY_MEDIUM;
|
||||||
this.dataSetPresent = true;
|
this.dataSetPresent = true;
|
||||||
}
|
};
|
||||||
|
|
||||||
util.inherits(CommandMessage, DicomMessage);
|
util.inherits(CommandMessage, DicomMessage);
|
||||||
|
|
||||||
CommandMessage.prototype.getFields = function() {
|
CommandMessage.prototype.getFields = function() {
|
||||||
return this.command(CommandMessage.super_.prototype.getFields.call(this));
|
return this.command(CommandMessage.super_.prototype.getFields.call(this));
|
||||||
}
|
};
|
||||||
|
|
||||||
CommandResponse = function(syntax) {
|
CommandResponse = function(syntax) {
|
||||||
DicomMessage.call(this, syntax);
|
DicomMessage.call(this, syntax);
|
||||||
this.type = C.DATA_TYPE_COMMAND;
|
this.type = C.DATA_TYPE_COMMAND;
|
||||||
this.dataSetPresent = true;
|
this.dataSetPresent = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
util.inherits(CommandResponse, DicomMessage);
|
util.inherits(CommandResponse, DicomMessage);
|
||||||
|
|
||||||
CommandResponse.prototype.isResponse = function() {
|
CommandResponse.prototype.isResponse = function() {
|
||||||
return true;
|
return true;
|
||||||
}
|
};
|
||||||
|
|
||||||
CommandResponse.prototype.respondedTo = function() {
|
CommandResponse.prototype.respondedTo = function() {
|
||||||
return this.getValue(0x00000120);
|
return this.getValue(0x00000120);
|
||||||
}
|
};
|
||||||
|
|
||||||
CommandResponse.prototype.isFinal = function() {
|
CommandResponse.prototype.isFinal = function() {
|
||||||
return this.success() || this.failure() || this.cancel();
|
return this.success() || this.failure() || this.cancel();
|
||||||
}
|
};
|
||||||
|
|
||||||
CommandResponse.prototype.warning = function() {
|
CommandResponse.prototype.warning = function() {
|
||||||
var status = this.getStatus();
|
var status = this.getStatus();
|
||||||
return (status == 0x0001) || (status >> 12 == 0xb);
|
return (status == 0x0001) || (status >> 12 == 0xb);
|
||||||
}
|
};
|
||||||
|
|
||||||
CommandResponse.prototype.success = function() {
|
CommandResponse.prototype.success = function() {
|
||||||
return this.getStatus() == 0x0000;
|
return this.getStatus() == 0x0000;
|
||||||
}
|
};
|
||||||
|
|
||||||
CommandResponse.prototype.failure = function() {
|
CommandResponse.prototype.failure = function() {
|
||||||
var status = this.getStatus();
|
var status = this.getStatus();
|
||||||
return (status >> 12 == 0xa) || (status >> 12 == 0xc) || (status >> 8 == 0x1)
|
return (status >> 12 == 0xa) || (status >> 12 == 0xc) || (status >> 8 == 0x1);
|
||||||
}
|
};
|
||||||
|
|
||||||
CommandResponse.prototype.cancel = function() {
|
CommandResponse.prototype.cancel = function() {
|
||||||
return this.getStatus() == C.STATUS_CANCEL;
|
return this.getStatus() == C.STATUS_CANCEL;
|
||||||
}
|
};
|
||||||
|
|
||||||
CommandResponse.prototype.pending = function() {
|
CommandResponse.prototype.pending = function() {
|
||||||
var status = this.getStatus();
|
var status = this.getStatus();
|
||||||
return (status == 0xff00) || (status == 0xff01);
|
return (status == 0xff00) || (status == 0xff01);
|
||||||
}
|
};
|
||||||
|
|
||||||
CommandResponse.prototype.getStatus = function() {
|
CommandResponse.prototype.getStatus = function() {
|
||||||
return this.getValue(0x00000900);
|
return this.getValue(0x00000900);
|
||||||
}
|
};
|
||||||
|
|
||||||
CommandResponse.prototype.setStatus = function(status) {
|
CommandResponse.prototype.setStatus = function(status) {
|
||||||
this.setElement(0x00000900, status);
|
this.setElement(0x00000900, status);
|
||||||
}
|
};
|
||||||
|
|
||||||
// following four methods only available to C-GET-RSP and C-MOVE-RSP
|
// following four methods only available to C-GET-RSP and C-MOVE-RSP
|
||||||
CommandResponse.prototype.getNumOfRemainingSubOperations = function() {
|
CommandResponse.prototype.getNumOfRemainingSubOperations = function() {
|
||||||
return this.getValue(0x00001020);
|
return this.getValue(0x00001020);
|
||||||
}
|
};
|
||||||
|
|
||||||
CommandResponse.prototype.getNumOfCompletedSubOperations = function() {
|
CommandResponse.prototype.getNumOfCompletedSubOperations = function() {
|
||||||
return this.getValue(0x00001021);
|
return this.getValue(0x00001021);
|
||||||
}
|
};
|
||||||
|
|
||||||
CommandResponse.prototype.getNumOfFailedSubOperations = function() {
|
CommandResponse.prototype.getNumOfFailedSubOperations = function() {
|
||||||
return this.getValue(0x00001022);
|
return this.getValue(0x00001022);
|
||||||
}
|
};
|
||||||
|
|
||||||
CommandResponse.prototype.getNumOfWarningSubOperations = function() {
|
CommandResponse.prototype.getNumOfWarningSubOperations = function() {
|
||||||
return this.getValue(0x00001023);
|
return this.getValue(0x00001023);
|
||||||
}
|
};
|
||||||
//end
|
//end
|
||||||
|
|
||||||
CommandResponse.prototype.getFields = function() {
|
CommandResponse.prototype.getFields = function() {
|
||||||
return this.response(CommandResponse.super_.prototype.getFields.call(this));
|
return this.response(CommandResponse.super_.prototype.getFields.call(this));
|
||||||
}
|
};
|
||||||
|
|
||||||
CFindRSP = function(syntax) {
|
CFindRSP = function(syntax) {
|
||||||
CommandResponse.call(this, syntax);
|
CommandResponse.call(this, syntax);
|
||||||
this.commandType = 0x8020;
|
this.commandType = 0x8020;
|
||||||
};
|
};
|
||||||
|
|
||||||
util.inherits(CFindRSP, CommandResponse);
|
util.inherits(CFindRSP, CommandResponse);
|
||||||
|
|
||||||
CGetRSP = function(syntax) {
|
CGetRSP = function(syntax) {
|
||||||
CommandResponse.call(this, syntax);
|
CommandResponse.call(this, syntax);
|
||||||
this.commandType = 0x8010;
|
this.commandType = 0x8010;
|
||||||
};
|
};
|
||||||
|
|
||||||
util.inherits(CGetRSP, CommandResponse);
|
util.inherits(CGetRSP, CommandResponse);
|
||||||
|
|
||||||
CMoveRSP = function(syntax) {
|
CMoveRSP = function(syntax) {
|
||||||
CommandResponse.call(this, syntax);
|
CommandResponse.call(this, syntax);
|
||||||
this.commandType = 0x8021;
|
this.commandType = 0x8021;
|
||||||
};
|
};
|
||||||
|
|
||||||
util.inherits(CMoveRSP, CommandResponse);
|
util.inherits(CMoveRSP, CommandResponse);
|
||||||
|
|
||||||
CFindRQ = function(syntax) {
|
CFindRQ = function(syntax) {
|
||||||
@ -466,6 +493,7 @@ CFindRQ = function(syntax) {
|
|||||||
this.commandType = 0x20;
|
this.commandType = 0x20;
|
||||||
this.contextUID = C.SOP_STUDY_ROOT_FIND;
|
this.contextUID = C.SOP_STUDY_ROOT_FIND;
|
||||||
};
|
};
|
||||||
|
|
||||||
util.inherits(CFindRQ, CommandMessage);
|
util.inherits(CFindRQ, CommandMessage);
|
||||||
|
|
||||||
CCancelRQ = function(syntax) {
|
CCancelRQ = function(syntax) {
|
||||||
@ -474,6 +502,7 @@ CCancelRQ = function(syntax) {
|
|||||||
this.contextUID = null;
|
this.contextUID = null;
|
||||||
this.dataSetPresent = false;
|
this.dataSetPresent = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
util.inherits(CCancelRQ, CommandResponse);
|
util.inherits(CCancelRQ, CommandResponse);
|
||||||
|
|
||||||
CCancelMoveRQ = function(syntax) {
|
CCancelMoveRQ = function(syntax) {
|
||||||
@ -482,23 +511,25 @@ CCancelMoveRQ = function(syntax) {
|
|||||||
this.contextUID = null;
|
this.contextUID = null;
|
||||||
this.dataSetPresent = false;
|
this.dataSetPresent = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
util.inherits(CCancelMoveRQ, CommandResponse);
|
util.inherits(CCancelMoveRQ, CommandResponse);
|
||||||
|
|
||||||
CMoveRQ = function(syntax, destination) {
|
CMoveRQ = function(syntax, destination) {
|
||||||
CommandMessage.call(this, syntax);
|
CommandMessage.call(this, syntax);
|
||||||
this.commandType = 0x21;
|
this.commandType = 0x21;
|
||||||
this.contextUID = C.SOP_STUDY_ROOT_MOVE;
|
this.contextUID = C.SOP_STUDY_ROOT_MOVE;
|
||||||
this.setDestination(destination || "");
|
this.setDestination(destination || '');
|
||||||
};
|
};
|
||||||
|
|
||||||
util.inherits(CMoveRQ, CommandMessage);
|
util.inherits(CMoveRQ, CommandMessage);
|
||||||
|
|
||||||
CMoveRQ.prototype.setStore = function(cstr) {
|
CMoveRQ.prototype.setStore = function(cstr) {
|
||||||
this.store = cstr;
|
this.store = cstr;
|
||||||
}
|
};
|
||||||
|
|
||||||
CMoveRQ.prototype.setDestination = function(dest) {
|
CMoveRQ.prototype.setDestination = function(dest) {
|
||||||
this.setElement(0x00000600, dest);
|
this.setElement(0x00000600, dest);
|
||||||
}
|
};
|
||||||
|
|
||||||
CGetRQ = function(syntax) {
|
CGetRQ = function(syntax) {
|
||||||
CommandMessage.call(this, syntax);
|
CommandMessage.call(this, syntax);
|
||||||
@ -506,38 +537,40 @@ CGetRQ = function(syntax) {
|
|||||||
this.contextUID = C.SOP_STUDY_ROOT_GET;
|
this.contextUID = C.SOP_STUDY_ROOT_GET;
|
||||||
this.store = null;
|
this.store = null;
|
||||||
};
|
};
|
||||||
|
|
||||||
util.inherits(CGetRQ, CommandMessage);
|
util.inherits(CGetRQ, CommandMessage);
|
||||||
|
|
||||||
CGetRQ.prototype.setStore = function(cstr) {
|
CGetRQ.prototype.setStore = function(cstr) {
|
||||||
this.store = cstr;
|
this.store = cstr;
|
||||||
}
|
};
|
||||||
|
|
||||||
CStoreRQ = function(syntax) {
|
CStoreRQ = function(syntax) {
|
||||||
CommandMessage.call(this, syntax);
|
CommandMessage.call(this, syntax);
|
||||||
this.commandType = 0x01;
|
this.commandType = 0x01;
|
||||||
this.contextUID = C.SOP_STUDY_ROOT_GET;
|
this.contextUID = C.SOP_STUDY_ROOT_GET;
|
||||||
};
|
};
|
||||||
|
|
||||||
util.inherits(CStoreRQ, CommandMessage);
|
util.inherits(CStoreRQ, CommandMessage);
|
||||||
|
|
||||||
CStoreRQ.prototype.getOriginAETitle = function() {
|
CStoreRQ.prototype.getOriginAETitle = function() {
|
||||||
return this.getValue(0x00001030);
|
return this.getValue(0x00001030);
|
||||||
}
|
};
|
||||||
|
|
||||||
CStoreRQ.prototype.getMoveMessageId = function() {
|
CStoreRQ.prototype.getMoveMessageId = function() {
|
||||||
return this.getValue(0x00001031);
|
return this.getValue(0x00001031);
|
||||||
}
|
};
|
||||||
|
|
||||||
CStoreRQ.prototype.getAffectedSOPInstanceUID = function() {
|
CStoreRQ.prototype.getAffectedSOPInstanceUID = function() {
|
||||||
return this.getValue(0x00001000);
|
return this.getValue(0x00001000);
|
||||||
}
|
};
|
||||||
|
|
||||||
CStoreRQ.prototype.setAffectedSOPInstanceUID = function(uid) {
|
CStoreRQ.prototype.setAffectedSOPInstanceUID = function(uid) {
|
||||||
this.setElement(0x00001000, uid);
|
this.setElement(0x00001000, uid);
|
||||||
}
|
};
|
||||||
|
|
||||||
CStoreRQ.prototype.setAffectedSOPClassUID = function(uid) {
|
CStoreRQ.prototype.setAffectedSOPClassUID = function(uid) {
|
||||||
this.setElement(0x00000002, uid);
|
this.setElement(0x00000002, uid);
|
||||||
}
|
};
|
||||||
|
|
||||||
CStoreRSP = function(syntax) {
|
CStoreRSP = function(syntax) {
|
||||||
CommandResponse.call(this, syntax);
|
CommandResponse.call(this, syntax);
|
||||||
@ -545,12 +578,13 @@ CStoreRSP = function(syntax) {
|
|||||||
this.contextUID = C.SOP_STUDY_ROOT_GET;
|
this.contextUID = C.SOP_STUDY_ROOT_GET;
|
||||||
this.dataSetPresent = false;
|
this.dataSetPresent = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
util.inherits(CStoreRSP, CommandResponse);
|
util.inherits(CStoreRSP, CommandResponse);
|
||||||
|
|
||||||
CStoreRSP.prototype.setAffectedSOPInstanceUID = function(uid) {
|
CStoreRSP.prototype.setAffectedSOPInstanceUID = function(uid) {
|
||||||
this.setElement(0x00001000, uid);
|
this.setElement(0x00001000, uid);
|
||||||
}
|
};
|
||||||
|
|
||||||
CStoreRSP.prototype.getAffectedSOPInstanceUID = function(uid) {
|
CStoreRSP.prototype.getAffectedSOPInstanceUID = function(uid) {
|
||||||
return this.getValue(0x00001000);
|
return this.getValue(0x00001000);
|
||||||
}
|
};
|
||||||
|
|||||||
@ -1,7 +1,9 @@
|
|||||||
var isString = function(type) {
|
var isString = function(type) {
|
||||||
if (type == C.TYPE_ASCII || type == C.TYPE_HEX) {
|
if (type === C.TYPE_ASCII || type === C.TYPE_HEX) {
|
||||||
return true;
|
return true;
|
||||||
} else return false;
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
calcLength = function(type, value) {
|
calcLength = function(type, value) {
|
||||||
@ -20,7 +22,7 @@ calcLength = function(type, value) {
|
|||||||
default :break;
|
default :break;
|
||||||
}
|
}
|
||||||
return size;
|
return size;
|
||||||
}
|
};
|
||||||
|
|
||||||
var RWStream = function() {
|
var RWStream = function() {
|
||||||
this.endian = C.BIG_ENDIAN;
|
this.endian = C.BIG_ENDIAN;
|
||||||
@ -28,19 +30,19 @@ var RWStream = function() {
|
|||||||
|
|
||||||
RWStream.prototype.setEndian = function(endian) {
|
RWStream.prototype.setEndian = function(endian) {
|
||||||
this.endian = endian;
|
this.endian = endian;
|
||||||
}
|
};
|
||||||
|
|
||||||
RWStream.prototype.getEncoding = function(type) {
|
RWStream.prototype.getEncoding = function(type) {
|
||||||
return RWStream.encodings[type];
|
return RWStream.encodings[type];
|
||||||
}
|
};
|
||||||
|
|
||||||
RWStream.prototype.getWriteType = function(type) {
|
RWStream.prototype.getWriteType = function(type) {
|
||||||
return RWStream.writes[this.endian][type];
|
return RWStream.writes[this.endian][type];
|
||||||
}
|
};
|
||||||
|
|
||||||
RWStream.prototype.getReadType = function(type) {
|
RWStream.prototype.getReadType = function(type) {
|
||||||
return RWStream.reads[this.endian][type];
|
return RWStream.reads[this.endian][type];
|
||||||
}
|
};
|
||||||
|
|
||||||
WriteStream = function() {
|
WriteStream = function() {
|
||||||
RWStream.call(this);
|
RWStream.call(this);
|
||||||
@ -48,7 +50,7 @@ WriteStream = function() {
|
|||||||
this.rawBuffer = new Buffer(this.defaultBufferSize);
|
this.rawBuffer = new Buffer(this.defaultBufferSize);
|
||||||
this.offset = 0;
|
this.offset = 0;
|
||||||
this.contentSize = 0;
|
this.contentSize = 0;
|
||||||
}
|
};
|
||||||
|
|
||||||
util.inherits(WriteStream, RWStream);
|
util.inherits(WriteStream, RWStream);
|
||||||
|
|
||||||
@ -57,15 +59,15 @@ WriteStream.prototype.increment = function(add) {
|
|||||||
if (this.offset > this.contentSize) {
|
if (this.offset > this.contentSize) {
|
||||||
this.contentSize = this.offset;
|
this.contentSize = this.offset;
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
WriteStream.prototype.size = function() {
|
WriteStream.prototype.size = function() {
|
||||||
return this.contentSize;
|
return this.contentSize;
|
||||||
}
|
};
|
||||||
|
|
||||||
WriteStream.prototype.skip = function(amount) {
|
WriteStream.prototype.skip = function(amount) {
|
||||||
this.increment(amount);
|
this.increment(amount);
|
||||||
}
|
};
|
||||||
|
|
||||||
WriteStream.prototype.checkSize = function(length) {
|
WriteStream.prototype.checkSize = function(length) {
|
||||||
if (this.offset + length > this.rawBuffer.length) {
|
if (this.offset + length > this.rawBuffer.length) {
|
||||||
@ -75,22 +77,22 @@ WriteStream.prototype.checkSize = function(length) {
|
|||||||
this.rawBuffer.copy(newBuffer, 0, 0, this.contentSize);
|
this.rawBuffer.copy(newBuffer, 0, 0, this.contentSize);
|
||||||
this.rawBuffer = newBuffer;
|
this.rawBuffer = newBuffer;
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
WriteStream.prototype.writeToBuffer = function(type, value, length) {
|
WriteStream.prototype.writeToBuffer = function(type, value, length) {
|
||||||
if (value === "" || value === null) return;
|
if (value === '' || value === null) return;
|
||||||
|
|
||||||
this.checkSize(length);
|
this.checkSize(length);
|
||||||
this.rawBuffer[this.getWriteType(type)](value, this.offset);
|
this.rawBuffer[this.getWriteType(type)](value, this.offset);
|
||||||
this.increment(length);
|
this.increment(length);
|
||||||
}
|
};
|
||||||
|
|
||||||
WriteStream.prototype.writeRawBuffer = function(source, start, length) {
|
WriteStream.prototype.writeRawBuffer = function(source, start, length) {
|
||||||
if (!source) return;
|
if (!source) return;
|
||||||
this.checkSize(length);
|
this.checkSize(length);
|
||||||
source.copy(this.rawBuffer, this.offset, start, length);
|
source.copy(this.rawBuffer, this.offset, start, length);
|
||||||
this.increment(length);
|
this.increment(length);
|
||||||
}
|
};
|
||||||
|
|
||||||
WriteStream.prototype.write = function(type, value) {
|
WriteStream.prototype.write = function(type, value) {
|
||||||
if (isString(type)) {
|
if (isString(type)) {
|
||||||
@ -98,28 +100,29 @@ WriteStream.prototype.write = function(type, value) {
|
|||||||
} else {
|
} else {
|
||||||
this.writeToBuffer(type, value, calcLength(type));
|
this.writeToBuffer(type, value, calcLength(type));
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
WriteStream.prototype.writeString = function(string, type) {
|
WriteStream.prototype.writeString = function(string, type) {
|
||||||
var encoding = this.getEncoding(type), length = Buffer.byteLength(string, encoding);
|
var encoding = this.getEncoding(type),
|
||||||
|
length = Buffer.byteLength(string, encoding);
|
||||||
this.rawBuffer.write(string, this.offset, length, encoding);
|
this.rawBuffer.write(string, this.offset, length, encoding);
|
||||||
this.increment(length);
|
this.increment(length);
|
||||||
}
|
};
|
||||||
|
|
||||||
WriteStream.prototype.buffer = function() {
|
WriteStream.prototype.buffer = function() {
|
||||||
return this.rawBuffer.slice(0, this.contentSize);
|
return this.rawBuffer.slice(0, this.contentSize);
|
||||||
}
|
};
|
||||||
|
|
||||||
WriteStream.prototype.toReadBuffer = function() {
|
WriteStream.prototype.toReadBuffer = function() {
|
||||||
return new ReadStream(this.buffer());
|
return new ReadStream(this.buffer());
|
||||||
}
|
};
|
||||||
|
|
||||||
WriteStream.prototype.concat = function(newStream) {
|
WriteStream.prototype.concat = function(newStream) {
|
||||||
var newSize = this.size() + newStream.size();
|
var newSize = this.size() + newStream.size();
|
||||||
this.rawBuffer = Buffer.concat([this.buffer(), newStream.buffer()], newSize);
|
this.rawBuffer = Buffer.concat([this.buffer(), newStream.buffer()], newSize);
|
||||||
this.contentSize = newSize;
|
this.contentSize = newSize;
|
||||||
this.offset = newSize;
|
this.offset = newSize;
|
||||||
}
|
};
|
||||||
|
|
||||||
ReadStream = function(buffer) {
|
ReadStream = function(buffer) {
|
||||||
RWStream.call(this);
|
RWStream.call(this);
|
||||||
@ -131,26 +134,26 @@ util.inherits(ReadStream, RWStream);
|
|||||||
|
|
||||||
ReadStream.prototype.size = function() {
|
ReadStream.prototype.size = function() {
|
||||||
return this.rawBuffer.length;
|
return this.rawBuffer.length;
|
||||||
}
|
};
|
||||||
|
|
||||||
ReadStream.prototype.increment = function(add) {
|
ReadStream.prototype.increment = function(add) {
|
||||||
this.offset += add;
|
this.offset += add;
|
||||||
}
|
};
|
||||||
|
|
||||||
ReadStream.prototype.more = function(length) {
|
ReadStream.prototype.more = function(length) {
|
||||||
var newBuf = this.rawBuffer.slice(this.offset, this.offset + length);
|
var newBuf = this.rawBuffer.slice(this.offset, this.offset + length);
|
||||||
this.increment(length);
|
this.increment(length);
|
||||||
return new ReadStream(newBuf);
|
return new ReadStream(newBuf);
|
||||||
}
|
};
|
||||||
|
|
||||||
ReadStream.prototype.reset = function() {
|
ReadStream.prototype.reset = function() {
|
||||||
this.offset = 0;
|
this.offset = 0;
|
||||||
return this;
|
return this;
|
||||||
}
|
};
|
||||||
|
|
||||||
ReadStream.prototype.end = function() {
|
ReadStream.prototype.end = function() {
|
||||||
return this.offset >= this.size();
|
return this.offset >= this.size();
|
||||||
}
|
};
|
||||||
|
|
||||||
ReadStream.prototype.readFromBuffer = function(type, length) {
|
ReadStream.prototype.readFromBuffer = function(type, length) {
|
||||||
//this.checkSize(length);
|
//this.checkSize(length);
|
||||||
@ -158,7 +161,7 @@ ReadStream.prototype.readFromBuffer = function(type, length) {
|
|||||||
var value = this.rawBuffer[this.getReadType(type)](this.offset);
|
var value = this.rawBuffer[this.getReadType(type)](this.offset);
|
||||||
this.increment(length);
|
this.increment(length);
|
||||||
return value;
|
return value;
|
||||||
}
|
};
|
||||||
|
|
||||||
ReadStream.prototype.read = function(type, length) {
|
ReadStream.prototype.read = function(type, length) {
|
||||||
var value = null;
|
var value = null;
|
||||||
@ -169,68 +172,68 @@ ReadStream.prototype.read = function(type, length) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return value;
|
return value;
|
||||||
}
|
};
|
||||||
|
|
||||||
ReadStream.prototype.readString = function(length, type) {
|
ReadStream.prototype.readString = function(length, type) {
|
||||||
var encoding = this.getEncoding(type),
|
var encoding = this.getEncoding(type),
|
||||||
str = this.rawBuffer.toString(encoding, this.offset, this.offset + length);
|
str = this.rawBuffer.toString(encoding, this.offset, this.offset + length);
|
||||||
this.increment(length);
|
this.increment(length);
|
||||||
return str;
|
return str;
|
||||||
}
|
};
|
||||||
|
|
||||||
ReadStream.prototype.buffer = function() {
|
ReadStream.prototype.buffer = function() {
|
||||||
return this.rawBuffer;
|
return this.rawBuffer;
|
||||||
}
|
};
|
||||||
|
|
||||||
ReadStream.prototype.concat = function(newStream) {
|
ReadStream.prototype.concat = function(newStream) {
|
||||||
var newSize = this.size() + newStream.size();
|
var newSize = this.size() + newStream.size();
|
||||||
this.rawBuffer = Buffer.concat([this.buffer(), newStream.buffer()], newSize);
|
this.rawBuffer = Buffer.concat([this.buffer(), newStream.buffer()], newSize);
|
||||||
this.contentSize = newSize;
|
this.contentSize = newSize;
|
||||||
this.offset = newSize;
|
this.offset = newSize;
|
||||||
}
|
};
|
||||||
|
|
||||||
RWStream.writes = {};
|
RWStream.writes = {};
|
||||||
RWStream.writes[C.BIG_ENDIAN] = {};
|
RWStream.writes[C.BIG_ENDIAN] = {};
|
||||||
RWStream.writes[C.BIG_ENDIAN][C.TYPE_UINT8] = "writeUInt8";
|
RWStream.writes[C.BIG_ENDIAN][C.TYPE_UINT8] = 'writeUInt8';
|
||||||
RWStream.writes[C.BIG_ENDIAN][C.TYPE_UINT16] = "writeUInt16BE";
|
RWStream.writes[C.BIG_ENDIAN][C.TYPE_UINT16] = 'writeUInt16BE';
|
||||||
RWStream.writes[C.BIG_ENDIAN][C.TYPE_UINT32] = "writeUInt32BE";
|
RWStream.writes[C.BIG_ENDIAN][C.TYPE_UINT32] = 'writeUInt32BE';
|
||||||
RWStream.writes[C.BIG_ENDIAN][C.TYPE_INT8] = "writeInt8";
|
RWStream.writes[C.BIG_ENDIAN][C.TYPE_INT8] = 'writeInt8';
|
||||||
RWStream.writes[C.BIG_ENDIAN][C.TYPE_INT16] = "writeInt16BE";
|
RWStream.writes[C.BIG_ENDIAN][C.TYPE_INT16] = 'writeInt16BE';
|
||||||
RWStream.writes[C.BIG_ENDIAN][C.TYPE_INT32] = "writeInt32BE";
|
RWStream.writes[C.BIG_ENDIAN][C.TYPE_INT32] = 'writeInt32BE';
|
||||||
RWStream.writes[C.BIG_ENDIAN][C.TYPE_FLOAT] = "writeFloatBE";
|
RWStream.writes[C.BIG_ENDIAN][C.TYPE_FLOAT] = 'writeFloatBE';
|
||||||
RWStream.writes[C.BIG_ENDIAN][C.TYPE_DOUBLE] = "writeDoubleBE";
|
RWStream.writes[C.BIG_ENDIAN][C.TYPE_DOUBLE] = 'writeDoubleBE';
|
||||||
|
|
||||||
RWStream.writes[C.LITTLE_ENDIAN] = {};
|
RWStream.writes[C.LITTLE_ENDIAN] = {};
|
||||||
RWStream.writes[C.LITTLE_ENDIAN][C.TYPE_UINT8] = "writeUInt8";
|
RWStream.writes[C.LITTLE_ENDIAN][C.TYPE_UINT8] = 'writeUInt8';
|
||||||
RWStream.writes[C.LITTLE_ENDIAN][C.TYPE_UINT16] = "writeUInt16LE";
|
RWStream.writes[C.LITTLE_ENDIAN][C.TYPE_UINT16] = 'writeUInt16LE';
|
||||||
RWStream.writes[C.LITTLE_ENDIAN][C.TYPE_UINT32] = "writeUInt32LE";
|
RWStream.writes[C.LITTLE_ENDIAN][C.TYPE_UINT32] = 'writeUInt32LE';
|
||||||
RWStream.writes[C.LITTLE_ENDIAN][C.TYPE_INT8] = "writeInt8";
|
RWStream.writes[C.LITTLE_ENDIAN][C.TYPE_INT8] = 'writeInt8';
|
||||||
RWStream.writes[C.LITTLE_ENDIAN][C.TYPE_INT16] = "writeInt16LE";
|
RWStream.writes[C.LITTLE_ENDIAN][C.TYPE_INT16] = 'writeInt16LE';
|
||||||
RWStream.writes[C.LITTLE_ENDIAN][C.TYPE_INT32] = "writeInt32LE";
|
RWStream.writes[C.LITTLE_ENDIAN][C.TYPE_INT32] = 'writeInt32LE';
|
||||||
RWStream.writes[C.LITTLE_ENDIAN][C.TYPE_FLOAT] = "writeFloatLE";
|
RWStream.writes[C.LITTLE_ENDIAN][C.TYPE_FLOAT] = 'writeFloatLE';
|
||||||
RWStream.writes[C.LITTLE_ENDIAN][C.TYPE_DOUBLE] = "writeDoubleLE";
|
RWStream.writes[C.LITTLE_ENDIAN][C.TYPE_DOUBLE] = 'writeDoubleLE';
|
||||||
|
|
||||||
RWStream.reads = {};
|
RWStream.reads = {};
|
||||||
RWStream.reads[C.BIG_ENDIAN] = {};
|
RWStream.reads[C.BIG_ENDIAN] = {};
|
||||||
RWStream.reads[C.BIG_ENDIAN][C.TYPE_UINT8] = "readUInt8";
|
RWStream.reads[C.BIG_ENDIAN][C.TYPE_UINT8] = 'readUInt8';
|
||||||
RWStream.reads[C.BIG_ENDIAN][C.TYPE_UINT16] = "readUInt16BE";
|
RWStream.reads[C.BIG_ENDIAN][C.TYPE_UINT16] = 'readUInt16BE';
|
||||||
RWStream.reads[C.BIG_ENDIAN][C.TYPE_UINT32] = "readUInt32BE";
|
RWStream.reads[C.BIG_ENDIAN][C.TYPE_UINT32] = 'readUInt32BE';
|
||||||
RWStream.reads[C.BIG_ENDIAN][C.TYPE_INT8] = "readInt8";
|
RWStream.reads[C.BIG_ENDIAN][C.TYPE_INT8] = 'readInt8';
|
||||||
RWStream.reads[C.BIG_ENDIAN][C.TYPE_INT16] = "readInt16BE";
|
RWStream.reads[C.BIG_ENDIAN][C.TYPE_INT16] = 'readInt16BE';
|
||||||
RWStream.reads[C.BIG_ENDIAN][C.TYPE_INT32] = "readInt32BE";
|
RWStream.reads[C.BIG_ENDIAN][C.TYPE_INT32] = 'readInt32BE';
|
||||||
RWStream.reads[C.BIG_ENDIAN][C.TYPE_FLOAT] = "readFloatBE";
|
RWStream.reads[C.BIG_ENDIAN][C.TYPE_FLOAT] = 'readFloatBE';
|
||||||
RWStream.reads[C.BIG_ENDIAN][C.TYPE_DOUBLE] = "readDoubleBE";
|
RWStream.reads[C.BIG_ENDIAN][C.TYPE_DOUBLE] = 'readDoubleBE';
|
||||||
|
|
||||||
RWStream.reads[C.LITTLE_ENDIAN] = {};
|
RWStream.reads[C.LITTLE_ENDIAN] = {};
|
||||||
RWStream.reads[C.LITTLE_ENDIAN][C.TYPE_UINT8] = "readUInt8";
|
RWStream.reads[C.LITTLE_ENDIAN][C.TYPE_UINT8] = 'readUInt8';
|
||||||
RWStream.reads[C.LITTLE_ENDIAN][C.TYPE_UINT16] = "readUInt16LE";
|
RWStream.reads[C.LITTLE_ENDIAN][C.TYPE_UINT16] = 'readUInt16LE';
|
||||||
RWStream.reads[C.LITTLE_ENDIAN][C.TYPE_UINT32] = "readUInt32LE";
|
RWStream.reads[C.LITTLE_ENDIAN][C.TYPE_UINT32] = 'readUInt32LE';
|
||||||
RWStream.reads[C.LITTLE_ENDIAN][C.TYPE_INT8] = "readInt8";
|
RWStream.reads[C.LITTLE_ENDIAN][C.TYPE_INT8] = 'readInt8';
|
||||||
RWStream.reads[C.LITTLE_ENDIAN][C.TYPE_INT16] = "readInt16LE";
|
RWStream.reads[C.LITTLE_ENDIAN][C.TYPE_INT16] = 'readInt16LE';
|
||||||
RWStream.reads[C.LITTLE_ENDIAN][C.TYPE_INT32] = "readInt32LE";
|
RWStream.reads[C.LITTLE_ENDIAN][C.TYPE_INT32] = 'readInt32LE';
|
||||||
RWStream.reads[C.LITTLE_ENDIAN][C.TYPE_FLOAT] = "readFloatLE";
|
RWStream.reads[C.LITTLE_ENDIAN][C.TYPE_FLOAT] = 'readFloatLE';
|
||||||
RWStream.reads[C.LITTLE_ENDIAN][C.TYPE_DOUBLE] = "readDoubleLE";
|
RWStream.reads[C.LITTLE_ENDIAN][C.TYPE_DOUBLE] = 'readDoubleLE';
|
||||||
|
|
||||||
RWStream.encodings = {};
|
RWStream.encodings = {};
|
||||||
RWStream.encodings[C.TYPE_HEX] = "hex";
|
RWStream.encodings[C.TYPE_HEX] = 'hex';
|
||||||
RWStream.encodings[C.TYPE_ASCII] = "ascii";
|
RWStream.encodings[C.TYPE_ASCII] = 'ascii';
|
||||||
|
|||||||
@ -1,3 +0,0 @@
|
|||||||
Meteor.methods({
|
|
||||||
|
|
||||||
});
|
|
||||||
160
Packages/worklist/both/schema.js
Normal file
160
Packages/worklist/both/schema.js
Normal file
@ -0,0 +1,160 @@
|
|||||||
|
import { SimpleSchema } from 'meteor/aldeed:simple-schema';
|
||||||
|
|
||||||
|
export const DICOMWebRequestOptions = new SimpleSchema({
|
||||||
|
auth: {
|
||||||
|
type: String,
|
||||||
|
label: 'Username:Password Authentication String',
|
||||||
|
},
|
||||||
|
logRequests: {
|
||||||
|
type: Boolean,
|
||||||
|
defaultValue: true,
|
||||||
|
label: 'Log Requests?',
|
||||||
|
},
|
||||||
|
logResponses: {
|
||||||
|
type: Boolean,
|
||||||
|
defaultValue: false,
|
||||||
|
label: 'Log Responses?',
|
||||||
|
},
|
||||||
|
logTiming: {
|
||||||
|
type: Boolean,
|
||||||
|
defaultValue: true,
|
||||||
|
label: 'Log Timing?',
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
export const DICOMWebServer = new SimpleSchema({
|
||||||
|
name: {
|
||||||
|
type: String,
|
||||||
|
label: 'Name',
|
||||||
|
max: 100
|
||||||
|
},
|
||||||
|
wadoUriRoot: {
|
||||||
|
type: String,
|
||||||
|
label: 'WADO URI Root',
|
||||||
|
max: 1000
|
||||||
|
},
|
||||||
|
qidoRoot: {
|
||||||
|
type: String,
|
||||||
|
label: 'QIDO Root',
|
||||||
|
max: 1000
|
||||||
|
},
|
||||||
|
// TODO: Remove this
|
||||||
|
wadoUriRootNOTE: {
|
||||||
|
type: String,
|
||||||
|
label: 'WADO URI Root Note',
|
||||||
|
optional: true
|
||||||
|
},
|
||||||
|
wadoRoot: {
|
||||||
|
type: String,
|
||||||
|
label: 'WADO Root',
|
||||||
|
max: 1000
|
||||||
|
},
|
||||||
|
qidoSupportsIncludeField: {
|
||||||
|
type: Boolean,
|
||||||
|
label: 'QIDO Supports Include Field?',
|
||||||
|
defaultValue: false
|
||||||
|
},
|
||||||
|
imageRendering: {
|
||||||
|
type: String,
|
||||||
|
label: 'Image Rendering',
|
||||||
|
defaultValue: 'wadouri'
|
||||||
|
},
|
||||||
|
requestOptions: {
|
||||||
|
type: DICOMWebRequestOptions,
|
||||||
|
label: 'Request Options'
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
export const DIMSEPeer = new SimpleSchema({
|
||||||
|
host: {
|
||||||
|
type: String,
|
||||||
|
label: 'Host URL',
|
||||||
|
},
|
||||||
|
port: {
|
||||||
|
type: Number,
|
||||||
|
label: 'Port',
|
||||||
|
min: 1,
|
||||||
|
defaultValue: 11112,
|
||||||
|
max: 65535
|
||||||
|
},
|
||||||
|
aeTitle: {
|
||||||
|
type: String,
|
||||||
|
label: 'Application Entity (AE) Title',
|
||||||
|
},
|
||||||
|
default: {
|
||||||
|
type: Boolean,
|
||||||
|
label: 'Default?',
|
||||||
|
defaultValue: false
|
||||||
|
},
|
||||||
|
server: {
|
||||||
|
type: Boolean,
|
||||||
|
label: 'Server?',
|
||||||
|
defaultValue: false
|
||||||
|
},
|
||||||
|
supportsInstanceRetrievalByStudyUid: {
|
||||||
|
type: Boolean,
|
||||||
|
label: 'Supports instance retrieval by StudyUid?',
|
||||||
|
defaultValue: true
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
export const DIMSEServer = new SimpleSchema({
|
||||||
|
name: {
|
||||||
|
type: String,
|
||||||
|
label: 'Name',
|
||||||
|
max: 100
|
||||||
|
},
|
||||||
|
peers: {
|
||||||
|
type: [ DIMSEPeer ],
|
||||||
|
label: 'DIMSE Peers',
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
export const UISettings = new SimpleSchema({
|
||||||
|
studyListFunctionsEnabled: {
|
||||||
|
type: Boolean,
|
||||||
|
label: 'Study List Functions Enabled?',
|
||||||
|
defaultValue: true
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
export const PublicServerConfig = new SimpleSchema({
|
||||||
|
verifyEmail: {
|
||||||
|
type: Boolean,
|
||||||
|
label: 'Verify Email',
|
||||||
|
defaultValue: false
|
||||||
|
},
|
||||||
|
ui: {
|
||||||
|
type: UISettings,
|
||||||
|
label: 'UI Settings'
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
export const Servers = new SimpleSchema({
|
||||||
|
dicomWeb: {
|
||||||
|
type: [ DICOMWebServer ],
|
||||||
|
label: 'DICOMWeb Servers',
|
||||||
|
optional: true
|
||||||
|
},
|
||||||
|
dimse: {
|
||||||
|
type: [ DIMSEServer ],
|
||||||
|
label: 'DIMSE Servers',
|
||||||
|
optional: true
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
export const ServerConfiguration = new SimpleSchema({
|
||||||
|
servers: {
|
||||||
|
type: Servers,
|
||||||
|
label: 'Servers'
|
||||||
|
},
|
||||||
|
defaultServiceType: {
|
||||||
|
type: String,
|
||||||
|
label: 'Default Service Type',
|
||||||
|
defaultValue: 'dicomWeb'
|
||||||
|
},
|
||||||
|
public: {
|
||||||
|
type: PublicServerConfig,
|
||||||
|
label: 'Public Server Configuration',
|
||||||
|
}
|
||||||
|
});
|
||||||
@ -5,7 +5,7 @@ Package.describe({
|
|||||||
});
|
});
|
||||||
|
|
||||||
Package.onUse(function (api) {
|
Package.onUse(function (api) {
|
||||||
api.versionsFrom('1.3.5.1');
|
api.versionsFrom('1.4');
|
||||||
|
|
||||||
api.use('ecmascript');
|
api.use('ecmascript');
|
||||||
api.use('standard-app-packages');
|
api.use('standard-app-packages');
|
||||||
@ -15,6 +15,7 @@ Package.onUse(function (api) {
|
|||||||
api.use('practicalmeteor:loglevel');
|
api.use('practicalmeteor:loglevel');
|
||||||
api.use('rwatts:uuid');
|
api.use('rwatts:uuid');
|
||||||
api.use('silentcicero:jszip');
|
api.use('silentcicero:jszip');
|
||||||
|
api.use('aldeed:simple-schema');
|
||||||
|
|
||||||
// Note: MomentJS appears to be required for Bootstrap3 Datepicker, but not a dependency for some reason
|
// Note: MomentJS appears to be required for Bootstrap3 Datepicker, but not a dependency for some reason
|
||||||
api.use('momentjs:moment');
|
api.use('momentjs:moment');
|
||||||
@ -37,6 +38,9 @@ Package.onUse(function (api) {
|
|||||||
// console for debugging purposes
|
// console for debugging purposes
|
||||||
api.addFiles('log.js');
|
api.addFiles('log.js');
|
||||||
|
|
||||||
|
api.addFiles('both/collections.js', [ 'client', 'server' ]);
|
||||||
|
api.addFiles('both/schema.js', [ 'client', 'server' ]);
|
||||||
|
|
||||||
// Components
|
// Components
|
||||||
api.addFiles('client/components/worklist.html', 'client');
|
api.addFiles('client/components/worklist.html', 'client');
|
||||||
api.addFiles('client/components/worklist.js', 'client');
|
api.addFiles('client/components/worklist.js', 'client');
|
||||||
@ -78,6 +82,7 @@ Package.onUse(function (api) {
|
|||||||
|
|
||||||
// Server-side functions
|
// Server-side functions
|
||||||
api.addFiles('server/collections.js', 'server');
|
api.addFiles('server/collections.js', 'server');
|
||||||
|
api.addFiles('server/validateServerConfiguration.js', 'server');
|
||||||
api.addFiles('server/lib/namespace.js', 'server');
|
api.addFiles('server/lib/namespace.js', 'server');
|
||||||
api.addFiles('server/lib/encodeQueryData.js', 'server');
|
api.addFiles('server/lib/encodeQueryData.js', 'server');
|
||||||
api.addFiles('server/methods/getStudyMetadata.js', 'server');
|
api.addFiles('server/methods/getStudyMetadata.js', 'server');
|
||||||
@ -99,16 +104,12 @@ Package.onUse(function (api) {
|
|||||||
api.addFiles('server/services/remote/studies.js', 'server');
|
api.addFiles('server/services/remote/studies.js', 'server');
|
||||||
api.addFiles('server/services/remote/retrieveMetadata.js', 'server');
|
api.addFiles('server/services/remote/retrieveMetadata.js', 'server');
|
||||||
|
|
||||||
api.addFiles('both/collections.js', [ 'client', 'server' ]);
|
|
||||||
|
|
||||||
api.export('Services', 'server');
|
api.export('Services', 'server');
|
||||||
|
|
||||||
// Export Worklist helper functions for usage in Routes
|
// Export Worklist helper functions for usage in Routes
|
||||||
api.export('getTimepointName', 'client');
|
|
||||||
api.export('getStudyMetadata', 'client');
|
api.export('getStudyMetadata', 'client');
|
||||||
api.export('getStudiesMetadata', 'client');
|
api.export('getStudiesMetadata', 'client');
|
||||||
api.export('openNewTab', 'client');
|
api.export('openNewTab', 'client');
|
||||||
api.export('setWorklistSubscriptions', 'client');
|
|
||||||
api.export('switchToTab', 'client');
|
api.export('switchToTab', 'client');
|
||||||
api.export('progressDialog', 'client');
|
api.export('progressDialog', 'client');
|
||||||
api.export('Worklist');
|
api.export('Worklist');
|
||||||
|
|||||||
12
Packages/worklist/server/validateServerConfiguration.js
Normal file
12
Packages/worklist/server/validateServerConfiguration.js
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
import { Meteor } from 'meteor/meteor';
|
||||||
|
import { check } from 'meteor/check';
|
||||||
|
import { ServerConfiguration } from '../both/schema.js';
|
||||||
|
|
||||||
|
Meteor.startup(() => {
|
||||||
|
console.log('------ Testing Meteor Settings ------');
|
||||||
|
let config = ServerConfiguration.clean(Meteor.settings);
|
||||||
|
console.log(JSON.stringify(config, null, 2));
|
||||||
|
|
||||||
|
Meteor.settings = config;
|
||||||
|
check(config, ServerConfiguration);
|
||||||
|
});
|
||||||
Loading…
Reference in New Issue
Block a user