diff --git a/datasets/ebe.dcm b/datasets/ebe.dcm new file mode 100644 index 0000000..f4a4727 Binary files /dev/null and b/datasets/ebe.dcm differ diff --git a/examples/index.js b/examples/index.js index a536def..d61cf25 100644 --- a/examples/index.js +++ b/examples/index.js @@ -56,12 +56,14 @@ function performCFindMwl(host, port, callingAeTitle, calledAeTitle, opts) { function performCStore(host, port, callingAeTitle, calledAeTitle, opts) { const rootPath = process.cwd(); const elePath = path.join(rootPath, 'datasets', 'ele.dcm'); + const ebePath = path.join(rootPath, 'datasets', 'ebe.dcm'); const j2kPath = path.join(rootPath, 'datasets', 'j2k.dcm'); const srPath = path.join(rootPath, 'datasets', 'sr.dcm'); const pdfPath = path.join(rootPath, 'datasets', 'pdf.dcm'); const client = new Client(); client.addRequest(new CStoreRequest(elePath)); + client.addRequest(new CStoreRequest(ebePath)); client.addRequest(new CStoreRequest(j2kPath)); client.addRequest(new CStoreRequest(srPath)); client.addRequest(new CStoreRequest(pdfPath)); @@ -122,7 +124,8 @@ class ExampleScp extends Scp { transferSyntaxes.forEach((transferSyntax) => { if ( transferSyntax === TransferSyntax.ImplicitVRLittleEndian || - transferSyntax === TransferSyntax.ExplicitVRLittleEndian + transferSyntax === TransferSyntax.ExplicitVRLittleEndian || + transferSyntax === TransferSyntax.ExplicitVRBigEndian ) { context.setResult(PresentationContextResult.Accept, transferSyntax); } else { diff --git a/examples/index.ts b/examples/index.ts index 1efdf3c..e05343f 100644 --- a/examples/index.ts +++ b/examples/index.ts @@ -107,12 +107,14 @@ function performCStore( ) { const rootPath = process.cwd(); const elePath = path.join(rootPath, 'datasets', 'ele.dcm'); + const ebePath = path.join(rootPath, 'datasets', 'ebe.dcm'); const j2kPath = path.join(rootPath, 'datasets', 'j2k.dcm'); const srPath = path.join(rootPath, 'datasets', 'sr.dcm'); const pdfPath = path.join(rootPath, 'datasets', 'pdf.dcm'); const client = new Client(); client.addRequest(new CStoreRequest(elePath)); + client.addRequest(new CStoreRequest(ebePath)); client.addRequest(new CStoreRequest(j2kPath)); client.addRequest(new CStoreRequest(srPath)); client.addRequest(new CStoreRequest(pdfPath)); @@ -175,7 +177,8 @@ class ExampleScp extends Scp { transferSyntaxes.forEach((transferSyntax) => { if ( transferSyntax === TransferSyntax.ImplicitVRLittleEndian || - transferSyntax === TransferSyntax.ExplicitVRLittleEndian + transferSyntax === TransferSyntax.ExplicitVRLittleEndian || + transferSyntax === TransferSyntax.ExplicitVRBigEndian ) { context.setResult(PresentationContextResult.Accept, transferSyntax); } else { diff --git a/package-lock.json b/package-lock.json index 005cbe9..c1d4bff 100644 --- a/package-lock.json +++ b/package-lock.json @@ -17,24 +17,24 @@ }, "devDependencies": { "@types/async-eventemitter": "^0.2.4", - "@types/node": "^20.11.0", + "@types/node": "^20.11.19", "c8": "^9.1.0", "chai": "^4.3.10", "docdash": "^2.0.2", "eslint": "^8.56.0", "jsdoc": "^4.0.2", - "mocha": "^10.2.0", + "mocha": "^10.3.0", "mock-fs": "^5.2.0", - "nodemon": "^3.0.2", + "nodemon": "^3.0.3", "open-cli": "^8.0.0", - "prettier": "^3.2.2", + "prettier": "^3.2.5", "selfsigned": "^2.4.1", "shx": "^0.3.3", "terser-webpack-plugin": "^5.3.10", "ts-node": "^10.9.2", - "tsd": "^0.30.3", + "tsd": "^0.30.4", "typescript": "^5.3.3", - "webpack": "^5.89.0", + "webpack": "^5.90.2", "webpack-cli": "^5.1.4" }, "funding": { @@ -649,9 +649,9 @@ "dev": true }, "node_modules/@types/node": { - "version": "20.11.0", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.11.0.tgz", - "integrity": "sha512-o9bjXmDNcF7GbM4CNQpmi+TutCgap/K3w1JyKgxAjqx41zp9qlIAVFi0IhCNsJcXolEqLWhbFbEeL0PvYm4pcQ==", + "version": "20.11.19", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.11.19.tgz", + "integrity": "sha512-7xMnVEcZFu0DikYjWOlRq7NTPETrm7teqUT2WkQjrTIkEgUyyGdWsj/Zg8bEJt5TNklzbPD1X3fqfsHw3SpapQ==", "dev": true, "dependencies": { "undici-types": "~5.26.4" @@ -3245,9 +3245,9 @@ } }, "node_modules/mocha": { - "version": "10.2.0", - "resolved": "https://registry.npmjs.org/mocha/-/mocha-10.2.0.tgz", - "integrity": "sha512-IDY7fl/BecMwFHzoqF2sg/SHHANeBoMMXFlS9r0OXKDssYE1M5O43wUY/9BVPeIvfH2zmEbBfseqN9gBQZzXkg==", + "version": "10.3.0", + "resolved": "https://registry.npmjs.org/mocha/-/mocha-10.3.0.tgz", + "integrity": "sha512-uF2XJs+7xSLsrmIvn37i/wnc91nw7XjOQB8ccyx5aEgdnohr7n+rEiZP23WkCYHjilR6+EboEnbq/ZQDz4LSbg==", "dev": true, "dependencies": { "ansi-colors": "4.1.1", @@ -3257,13 +3257,12 @@ "diff": "5.0.0", "escape-string-regexp": "4.0.0", "find-up": "5.0.0", - "glob": "7.2.0", + "glob": "8.1.0", "he": "1.2.0", "js-yaml": "4.1.0", "log-symbols": "4.1.0", "minimatch": "5.0.1", "ms": "2.1.3", - "nanoid": "3.3.3", "serialize-javascript": "6.0.0", "strip-json-comments": "3.1.1", "supports-color": "8.1.1", @@ -3278,10 +3277,6 @@ }, "engines": { "node": ">= 14.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/mochajs" } }, "node_modules/mocha/node_modules/brace-expansion": { @@ -3304,6 +3299,25 @@ "wrap-ansi": "^7.0.0" } }, + "node_modules/mocha/node_modules/glob": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/glob/-/glob-8.1.0.tgz", + "integrity": "sha512-r8hpEjiQEYlF2QU0df3dS+nxxSIreXQS1qRhMJM0Q5NDdR386C7jb7Hwwod8Fgiuex+k0GFjgft18yvxm5XoCQ==", + "dev": true, + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^5.0.1", + "once": "^1.3.0" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, "node_modules/mocha/node_modules/minimatch": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.0.1.tgz", @@ -3378,18 +3392,6 @@ "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" }, - "node_modules/nanoid": { - "version": "3.3.3", - "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.3.tgz", - "integrity": "sha512-p1sjXuopFs0xg+fPASzQ28agW1oHD7xDsd9Xkf3T15H3c/cifrFHVwrh74PdoklAPi+i7MdRsE47vm2r6JoB+w==", - "dev": true, - "bin": { - "nanoid": "bin/nanoid.cjs" - }, - "engines": { - "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" - } - }, "node_modules/natural-compare": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", @@ -3427,9 +3429,9 @@ "dev": true }, "node_modules/nodemon": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/nodemon/-/nodemon-3.0.2.tgz", - "integrity": "sha512-9qIN2LNTrEzpOPBaWHTm4Asy1LxXLSickZStAQ4IZe7zsoIpD/A7LWxhZV3t4Zu352uBcqVnRsDXSMR2Sc3lTA==", + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/nodemon/-/nodemon-3.0.3.tgz", + "integrity": "sha512-7jH/NXbFPxVaMwmBCC2B9F/V6X1VkEdNgx3iu9jji8WxWcvhMWkmhNWhI5077zknOnZnBzba9hZP6bCPJLSReQ==", "dev": true, "dependencies": { "chokidar": "^3.5.2", @@ -3839,9 +3841,9 @@ } }, "node_modules/prettier": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.2.2.tgz", - "integrity": "sha512-HTByuKZzw7utPiDO523Tt2pLtEyK7OibUD9suEJQrPUCYQqrHr74GGX6VidMrovbf/I50mPqr8j/II6oBAuc5A==", + "version": "3.2.5", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.2.5.tgz", + "integrity": "sha512-3/GWa9aOC0YeD7LUfvOG2NiDyhOWRvt1k+rcKhOuYnMY24iiCphgneUfJDyFXd6rZCAnuLBv6UeAULtrhT/F4A==", "dev": true, "bin": { "prettier": "bin/prettier.cjs" @@ -4860,9 +4862,9 @@ } }, "node_modules/tsd": { - "version": "0.30.3", - "resolved": "https://registry.npmjs.org/tsd/-/tsd-0.30.3.tgz", - "integrity": "sha512-xoEp6JPqpT9Ti9wGX5qgy7URp0lrmxN7YkbsyphBzdc1SYiXvJYgRXSIVvSZz42+/Wd/R1kBOMbgGC6rtiKxqQ==", + "version": "0.30.4", + "resolved": "https://registry.npmjs.org/tsd/-/tsd-0.30.4.tgz", + "integrity": "sha512-ncC4SwAeUk0OTcXt5h8l0/gOLHJSp9ogosvOADT6QYzrl0ITm398B3wkz8YESqefIsEEwvYAU8bvo7/rcN/M0Q==", "dev": true, "dependencies": { "@tsd/typescript": "~5.3.3", @@ -5136,19 +5138,19 @@ } }, "node_modules/webpack": { - "version": "5.89.0", - "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.89.0.tgz", - "integrity": "sha512-qyfIC10pOr70V+jkmud8tMfajraGCZMBWJtrmuBymQKCrLTRejBI8STDp1MCyZu/QTdZSeacCQYpYNQVOzX5kw==", + "version": "5.90.2", + "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.90.2.tgz", + "integrity": "sha512-ziXu8ABGr0InCMEYFnHrYweinHK2PWrMqnwdHk2oK3rRhv/1B+2FnfwYv5oD+RrknK/Pp/Hmyvu+eAsaMYhzCw==", "dev": true, "dependencies": { "@types/eslint-scope": "^3.7.3", - "@types/estree": "^1.0.0", + "@types/estree": "^1.0.5", "@webassemblyjs/ast": "^1.11.5", "@webassemblyjs/wasm-edit": "^1.11.5", "@webassemblyjs/wasm-parser": "^1.11.5", "acorn": "^8.7.1", "acorn-import-assertions": "^1.9.0", - "browserslist": "^4.14.5", + "browserslist": "^4.21.10", "chrome-trace-event": "^1.0.2", "enhanced-resolve": "^5.15.0", "es-module-lexer": "^1.2.1", @@ -5162,7 +5164,7 @@ "neo-async": "^2.6.2", "schema-utils": "^3.2.0", "tapable": "^2.1.1", - "terser-webpack-plugin": "^5.3.7", + "terser-webpack-plugin": "^5.3.10", "watchpack": "^2.4.0", "webpack-sources": "^3.2.3" }, @@ -5984,9 +5986,9 @@ "dev": true }, "@types/node": { - "version": "20.11.0", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.11.0.tgz", - "integrity": "sha512-o9bjXmDNcF7GbM4CNQpmi+TutCgap/K3w1JyKgxAjqx41zp9qlIAVFi0IhCNsJcXolEqLWhbFbEeL0PvYm4pcQ==", + "version": "20.11.19", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.11.19.tgz", + "integrity": "sha512-7xMnVEcZFu0DikYjWOlRq7NTPETrm7teqUT2WkQjrTIkEgUyyGdWsj/Zg8bEJt5TNklzbPD1X3fqfsHw3SpapQ==", "dev": true, "requires": { "undici-types": "~5.26.4" @@ -7927,9 +7929,9 @@ "dev": true }, "mocha": { - "version": "10.2.0", - "resolved": "https://registry.npmjs.org/mocha/-/mocha-10.2.0.tgz", - "integrity": "sha512-IDY7fl/BecMwFHzoqF2sg/SHHANeBoMMXFlS9r0OXKDssYE1M5O43wUY/9BVPeIvfH2zmEbBfseqN9gBQZzXkg==", + "version": "10.3.0", + "resolved": "https://registry.npmjs.org/mocha/-/mocha-10.3.0.tgz", + "integrity": "sha512-uF2XJs+7xSLsrmIvn37i/wnc91nw7XjOQB8ccyx5aEgdnohr7n+rEiZP23WkCYHjilR6+EboEnbq/ZQDz4LSbg==", "dev": true, "requires": { "ansi-colors": "4.1.1", @@ -7939,13 +7941,12 @@ "diff": "5.0.0", "escape-string-regexp": "4.0.0", "find-up": "5.0.0", - "glob": "7.2.0", + "glob": "8.1.0", "he": "1.2.0", "js-yaml": "4.1.0", "log-symbols": "4.1.0", "minimatch": "5.0.1", "ms": "2.1.3", - "nanoid": "3.3.3", "serialize-javascript": "6.0.0", "strip-json-comments": "3.1.1", "supports-color": "8.1.1", @@ -7975,6 +7976,19 @@ "wrap-ansi": "^7.0.0" } }, + "glob": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/glob/-/glob-8.1.0.tgz", + "integrity": "sha512-r8hpEjiQEYlF2QU0df3dS+nxxSIreXQS1qRhMJM0Q5NDdR386C7jb7Hwwod8Fgiuex+k0GFjgft18yvxm5XoCQ==", + "dev": true, + "requires": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^5.0.1", + "once": "^1.3.0" + } + }, "minimatch": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.0.1.tgz", @@ -8033,12 +8047,6 @@ "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" }, - "nanoid": { - "version": "3.3.3", - "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.3.tgz", - "integrity": "sha512-p1sjXuopFs0xg+fPASzQ28agW1oHD7xDsd9Xkf3T15H3c/cifrFHVwrh74PdoklAPi+i7MdRsE47vm2r6JoB+w==", - "dev": true - }, "natural-compare": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", @@ -8073,9 +8081,9 @@ "dev": true }, "nodemon": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/nodemon/-/nodemon-3.0.2.tgz", - "integrity": "sha512-9qIN2LNTrEzpOPBaWHTm4Asy1LxXLSickZStAQ4IZe7zsoIpD/A7LWxhZV3t4Zu352uBcqVnRsDXSMR2Sc3lTA==", + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/nodemon/-/nodemon-3.0.3.tgz", + "integrity": "sha512-7jH/NXbFPxVaMwmBCC2B9F/V6X1VkEdNgx3iu9jji8WxWcvhMWkmhNWhI5077zknOnZnBzba9hZP6bCPJLSReQ==", "dev": true, "requires": { "chokidar": "^3.5.2", @@ -8366,9 +8374,9 @@ "dev": true }, "prettier": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.2.2.tgz", - "integrity": "sha512-HTByuKZzw7utPiDO523Tt2pLtEyK7OibUD9suEJQrPUCYQqrHr74GGX6VidMrovbf/I50mPqr8j/II6oBAuc5A==", + "version": "3.2.5", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.2.5.tgz", + "integrity": "sha512-3/GWa9aOC0YeD7LUfvOG2NiDyhOWRvt1k+rcKhOuYnMY24iiCphgneUfJDyFXd6rZCAnuLBv6UeAULtrhT/F4A==", "dev": true }, "pretty-format": { @@ -9066,9 +9074,9 @@ } }, "tsd": { - "version": "0.30.3", - "resolved": "https://registry.npmjs.org/tsd/-/tsd-0.30.3.tgz", - "integrity": "sha512-xoEp6JPqpT9Ti9wGX5qgy7URp0lrmxN7YkbsyphBzdc1SYiXvJYgRXSIVvSZz42+/Wd/R1kBOMbgGC6rtiKxqQ==", + "version": "0.30.4", + "resolved": "https://registry.npmjs.org/tsd/-/tsd-0.30.4.tgz", + "integrity": "sha512-ncC4SwAeUk0OTcXt5h8l0/gOLHJSp9ogosvOADT6QYzrl0ITm398B3wkz8YESqefIsEEwvYAU8bvo7/rcN/M0Q==", "dev": true, "requires": { "@tsd/typescript": "~5.3.3", @@ -9263,19 +9271,19 @@ } }, "webpack": { - "version": "5.89.0", - "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.89.0.tgz", - "integrity": "sha512-qyfIC10pOr70V+jkmud8tMfajraGCZMBWJtrmuBymQKCrLTRejBI8STDp1MCyZu/QTdZSeacCQYpYNQVOzX5kw==", + "version": "5.90.2", + "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.90.2.tgz", + "integrity": "sha512-ziXu8ABGr0InCMEYFnHrYweinHK2PWrMqnwdHk2oK3rRhv/1B+2FnfwYv5oD+RrknK/Pp/Hmyvu+eAsaMYhzCw==", "dev": true, "requires": { "@types/eslint-scope": "^3.7.3", - "@types/estree": "^1.0.0", + "@types/estree": "^1.0.5", "@webassemblyjs/ast": "^1.11.5", "@webassemblyjs/wasm-edit": "^1.11.5", "@webassemblyjs/wasm-parser": "^1.11.5", "acorn": "^8.7.1", "acorn-import-assertions": "^1.9.0", - "browserslist": "^4.14.5", + "browserslist": "^4.21.10", "chrome-trace-event": "^1.0.2", "enhanced-resolve": "^5.15.0", "es-module-lexer": "^1.2.1", @@ -9289,7 +9297,7 @@ "neo-async": "^2.6.2", "schema-utils": "^3.2.0", "tapable": "^2.1.1", - "terser-webpack-plugin": "^5.3.7", + "terser-webpack-plugin": "^5.3.10", "watchpack": "^2.4.0", "webpack-sources": "^3.2.3" }, diff --git a/package.json b/package.json index 783fbfc..9b8219e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "dcmjs-dimse", - "version": "0.1.24", + "version": "0.1.25", "description": "DICOM DIMSE implementation for Node.js using dcmjs", "main": "build/dcmjs-dimse.min.js", "module": "build/dcmjs-dimse.min.js", @@ -51,24 +51,24 @@ }, "devDependencies": { "@types/async-eventemitter": "^0.2.4", - "@types/node": "^20.11.0", + "@types/node": "^20.11.19", "c8": "^9.1.0", "chai": "^4.3.10", "docdash": "^2.0.2", "eslint": "^8.56.0", "jsdoc": "^4.0.2", - "mocha": "^10.2.0", + "mocha": "^10.3.0", "mock-fs": "^5.2.0", - "nodemon": "^3.0.2", + "nodemon": "^3.0.3", "open-cli": "^8.0.0", - "prettier": "^3.2.2", + "prettier": "^3.2.5", "selfsigned": "^2.4.1", "shx": "^0.3.3", "terser-webpack-plugin": "^5.3.10", "ts-node": "^10.9.2", - "tsd": "^0.30.3", + "tsd": "^0.30.4", "typescript": "^5.3.3", - "webpack": "^5.89.0", + "webpack": "^5.90.2", "webpack-cli": "^5.1.4" } } diff --git a/src/Dataset.js b/src/Dataset.js index a163d03..a5637b5 100644 --- a/src/Dataset.js +++ b/src/Dataset.js @@ -271,13 +271,15 @@ class Dataset { const stream = new ReadBufferStream( buffer.buffer.slice(buffer.byteOffset, buffer.byteOffset + buffer.byteLength) ); - // Use the proper syntax length (based on transfer syntax UID) + // Use the proper encoding and endianness (based on transfer syntax UID) // since dcmjs doesn't do that internally. - let syntaxLengthTypeToDecode = + const syntaxTypeToDecode = transferSyntaxUid === TransferSyntax.ImplicitVRLittleEndian ? TransferSyntax.ImplicitVRLittleEndian - : TransferSyntax.ExplicitVRLittleEndian; - const denaturalizedDataset = DicomMessage._read(stream, syntaxLengthTypeToDecode, readOptions); + : transferSyntaxUid === TransferSyntax.ExplicitVRBigEndian + ? TransferSyntax.ExplicitVRBigEndian + : TransferSyntax.ExplicitVRLittleEndian; + const denaturalizedDataset = DicomMessage._read(stream, syntaxTypeToDecode, readOptions); return DicomMetaDictionary.naturalizeDataset(denaturalizedDataset); } diff --git a/src/version.js b/src/version.js index ff90669..74727ce 100644 --- a/src/version.js +++ b/src/version.js @@ -1 +1 @@ -module.exports = '0.1.24'; +module.exports = '0.1.25';