Skip to content

Commit

Permalink
polish
Browse files Browse the repository at this point in the history
  • Loading branch information
knopkem committed Apr 5, 2020
1 parent 5492c50 commit 0604de2
Show file tree
Hide file tree
Showing 4 changed files with 93 additions and 39 deletions.
65 changes: 60 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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"
},
Expand All @@ -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"
},
Expand All @@ -58,7 +63,7 @@ dimse.moveScu(JSON.stringify(
"ip" : "127.0.0.1",
"port": "5678"
},
"destination" : "IMEBRA",
"destination" : "DCMTK",
"tags" : [
{
"key": "0020000D",
Expand All @@ -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"
},
Expand Down Expand Up @@ -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)
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand All @@ -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",
Expand Down
21 changes: 1 addition & 20 deletions src/GetAsyncWorker.cc
Original file line number Diff line number Diff line change
Expand Up @@ -66,23 +66,8 @@ namespace
}
}

void prepareTS(E_TransferSyntax ts,
OFList<OFString> &syntaxes)
void prepareTS(E_TransferSyntax ts, OFList<OFString> &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:
Expand Down Expand Up @@ -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);
Expand Down
38 changes: 28 additions & 10 deletions src/ServerAsyncWorker.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down

0 comments on commit 0604de2

Please sign in to comment.