diff --git a/README.md b/README.md index 70d1d1f..5b89e85 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ [![Greenkeeper badge](https://badges.greenkeeper.io/knopkem/dicom-dimse-native.svg)](https://greenkeeper.io/) # dicom-dimse-native -Nodejs native addon for DICOM DIMSE services using the IMEBRA DICOM c++ toolkit. +Nodejs native addon for DICOM DIMSE services using the DCMTK DICOM c++ toolkit. # supported DIMSE services * C-Echo-scu @@ -25,13 +25,15 @@ Otherwise install will try to compile the sources for your platform, you will ne * a working c++ compiler (vs 2015+ or g++5.3+) ## Examples + +# Store-SCP ``` const dimse = require('dicom-dimse-native'); dimse.startScp(JSON.stringify( { "source": { - "aet": "IMEBRA", + "aet": "DCMTK", "ip" : "127.0.0.1", "port": "9999" }, @@ -45,11 +47,14 @@ dimse.startScp(JSON.stringify( console.log(result); } }); +``` +# Move-SCU +``` dimse.moveScu(JSON.stringify( { "source": { - "aet": "IMEBRA", + "aet": "DCMTK", "ip" : "127.0.0.1", "port": "9999" }, @@ -58,7 +63,7 @@ dimse.moveScu(JSON.stringify( "ip" : "127.0.0.1", "port": "5678" }, - "destination" : "IMEBRA", + "destination" : "DCMTK", "tags" : [ { "key": "0020000D", @@ -78,11 +83,50 @@ dimse.moveScu(JSON.stringify( console.log(result); } }); +``` +# Get-SCU +``` +dimse.getScu(JSON.stringify( + { + "source": { + "aet": "DCMTK", + "ip" : "127.0.0.1", + "port": "9999" + }, + "target": { + "aet": "CONQUESTSRV1", + "ip" : "127.0.0.1", + "port": "5678" + }, + "storagePath": "./data" + "tags" : [ + { + "key": "0020000D", + "value": "1.3.46.670589.11.0.1.1996082307380006", + }, + { + "key": "00080052", + "value": "STUDY", + }, + ] + } +), (result) => { + try { + console.log(JSON.parse(result)); + } + catch { + console.log(result); + } +}); +``` + +# Find-SCU +``` dimse.findScu(JSON.stringify( { "source": { - "aet": "IMEBRA", + "aet": "DCMTK", "ip" : "127.0.0.1", "port": "9999" }, @@ -116,5 +160,16 @@ dimse.findScu(JSON.stringify( }); ``` +# Result Format: +``` +{ + code: 0 (success) / 1 (pending) / 2 (failure), + container: null / 'qido formatted result (only c-find)', + messsage: 'request succeeded' / 'descriptive problem', + status: 'success' / 'pending' / 'failure' +} +``` + + ## License [![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fknopkem%2Fdicom-dimse-native.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fknopkem%2Fdicom-dimse-native?ref=badge_large) diff --git a/package.json b/package.json index df9ce7e..c49c4bd 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "dicom-dimse-native", - "version": "0.1.5", - "description": "native addon using imebra dicom toolkit", + "version": "1.0.0", + "description": "native addon using DCMTK dicom toolkit", "main": "index.js", "scripts": { "install": "npx prebuild-install -r napi || npx cmake-js compile", @@ -13,12 +13,12 @@ "NATIVE", "DICOM-DIMSE", "DICOM-DIMSE-NATIVE", - "IMEBRA", + "DCMTK", "NETWORK", "DICOMJS" ], "author": "Michael Knopke", - "license": "GPL-3.0-or-later", + "license": "ISC", "dependencies": { "bindings": "^1.5.0", "node-addon-api": "^2.0.0", diff --git a/src/GetAsyncWorker.cc b/src/GetAsyncWorker.cc index ac0e3cb..72f275b 100644 --- a/src/GetAsyncWorker.cc +++ b/src/GetAsyncWorker.cc @@ -66,23 +66,8 @@ namespace } } - void prepareTS(E_TransferSyntax ts, - OFList &syntaxes) + void prepareTS(E_TransferSyntax ts, OFList &syntaxes) { - /* - ** We prefer to use Explicitly encoded transfer syntaxes. - ** If we are running on a Little Endian machine we prefer - ** LittleEndianExplicitTransferSyntax to BigEndianTransferSyntax. - ** Some SCP implementations will just select the first transfer - ** syntax they support (this is not part of the standard) so - ** organize the proposed transfer syntaxes to take advantage - ** of such behavior. - ** - ** The presentation contexts proposed here are only used for - ** C-FIND and C-MOVE, so there is no need to support compressed - ** transmission. - */ - switch (ts) { case EXS_LittleEndianImplicit: @@ -116,10 +101,6 @@ namespace { syntaxes.push_back(xfer.getXferID()); } - /* We prefer explicit transfer syntaxes. - * If we are running on a Little Endian machine we prefer - * LittleEndianExplicitTransferSyntax to BigEndianTransferSyntax. - */ if (gLocalByteOrder == EBO_LittleEndian) /* defined in dcxfer.h */ { syntaxes.push_back(UID_LittleEndianExplicitTransferSyntax); diff --git a/src/ServerAsyncWorker.cc b/src/ServerAsyncWorker.cc index db8634e..2c40fb4 100644 --- a/src/ServerAsyncWorker.cc +++ b/src/ServerAsyncWorker.cc @@ -270,18 +270,36 @@ OFCondition acceptAssociation(T_ASC_Network *net, DcmAssociationConfiguration &a goto cleanup; } - if (gLocalByteOrder == EBO_LittleEndian) /* defined in dcxfer.h */ + // accept all ts + transferSyntaxes[0] = UID_JPEG2000TransferSyntax; + transferSyntaxes[1] = UID_JPEG2000LosslessOnlyTransferSyntax; + transferSyntaxes[2] = UID_JPEGProcess2_4TransferSyntax; + transferSyntaxes[3] = UID_JPEGProcess1TransferSyntax; + transferSyntaxes[4] = UID_JPEGProcess14SV1TransferSyntax; + transferSyntaxes[5] = UID_JPEGLSLossyTransferSyntax; + transferSyntaxes[6] = UID_JPEGLSLosslessTransferSyntax; + transferSyntaxes[7] = UID_RLELosslessTransferSyntax; + transferSyntaxes[8] = UID_MPEG2MainProfileAtMainLevelTransferSyntax; + transferSyntaxes[9] = UID_MPEG2MainProfileAtHighLevelTransferSyntax; + transferSyntaxes[10] = UID_MPEG4HighProfileLevel4_1TransferSyntax; + transferSyntaxes[11] = UID_MPEG4BDcompatibleHighProfileLevel4_1TransferSyntax; + transferSyntaxes[12] = UID_MPEG4HighProfileLevel4_2_For2DVideoTransferSyntax; + transferSyntaxes[13] = UID_MPEG4HighProfileLevel4_2_For3DVideoTransferSyntax; + transferSyntaxes[14] = UID_MPEG4StereoHighProfileLevel4_2TransferSyntax; + transferSyntaxes[15] = UID_HEVCMainProfileLevel5_1TransferSyntax; + transferSyntaxes[16] = UID_HEVCMain10ProfileLevel5_1TransferSyntax; + transferSyntaxes[17] = UID_DeflatedExplicitVRLittleEndianTransferSyntax; + + if (gLocalByteOrder == EBO_LittleEndian) { - transferSyntaxes[0] = UID_LittleEndianExplicitTransferSyntax; - transferSyntaxes[1] = UID_BigEndianExplicitTransferSyntax; + transferSyntaxes[18] = UID_LittleEndianExplicitTransferSyntax; + transferSyntaxes[19] = UID_BigEndianExplicitTransferSyntax; + } else { + transferSyntaxes[18] = UID_BigEndianExplicitTransferSyntax; + transferSyntaxes[19] = UID_LittleEndianExplicitTransferSyntax; } - else - { - transferSyntaxes[0] = UID_BigEndianExplicitTransferSyntax; - transferSyntaxes[1] = UID_LittleEndianExplicitTransferSyntax; - } - transferSyntaxes[2] = UID_LittleEndianImplicitTransferSyntax; - numTransferSyntaxes = 3; + transferSyntaxes[20] = UID_LittleEndianImplicitTransferSyntax; + numTransferSyntaxes = 21; { /* accept the Verification SOP Class if presented */