@radicalimaging/static-wado-creator 0.6.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +285 -0
- package/bin/mkdicomweb.js +9 -0
- package/lib/DeleteStudy.js +14 -0
- package/lib/RejectInstance.js +17 -0
- package/lib/StaticWado.js +206 -0
- package/lib/createMain.js +14 -0
- package/lib/deleteMain.js +12 -0
- package/lib/dictionary/Tags.js +111 -0
- package/lib/dictionary/dataDictionary.js +22268 -0
- package/lib/groupMain.js +14 -0
- package/lib/index.js +8 -0
- package/lib/instanceMain.js +13 -0
- package/lib/metadataMain.js +14 -0
- package/lib/mkdicomwebConfig.js +149 -0
- package/lib/model/TagLists.js +151 -0
- package/lib/model/uids.js +42 -0
- package/lib/operation/InstanceDeduplicate.js +100 -0
- package/lib/operation/ScanStudy.js +20 -0
- package/lib/operation/StudyData.js +416 -0
- package/lib/operation/ThumbnailService.js +184 -0
- package/lib/operation/adapter/asyncIterableToBuffer.js +112 -0
- package/lib/operation/adapter/decodeImage.js +9 -0
- package/lib/operation/adapter/getImageInfo.js +21 -0
- package/lib/operation/adapter/transcodeImage.js +303 -0
- package/lib/operation/extractImageFrames.js +41 -0
- package/lib/operation/getDataSet.js +60 -0
- package/lib/operation/getEncapsulatedImageFrame.js +23 -0
- package/lib/operation/getNumberOfFrames.js +13 -0
- package/lib/operation/getUncompressedImageFrame.js +7 -0
- package/lib/operation/getVR.js +16 -0
- package/lib/operation/getValue.js +193 -0
- package/lib/program/index.js +15 -0
- package/lib/rejectMain.js +12 -0
- package/lib/util/IdCreator.js +25 -0
- package/lib/util/adaptProgramOpts.js +58 -0
- package/lib/util/compressionOptionParser.js +13 -0
- package/lib/writer/CompleteStudyWriter.js +88 -0
- package/lib/writer/DeduplicateWriter.js +32 -0
- package/lib/writer/ExpandUriPath.js +15 -0
- package/lib/writer/HashDataWriter.js +59 -0
- package/lib/writer/ImageFrameWriter.js +31 -0
- package/lib/writer/JSONWriter.js +18 -0
- package/lib/writer/MultipartAttribute.js +8 -0
- package/lib/writer/MultipartHeader.js +14 -0
- package/lib/writer/ThumbnailWriter.js +21 -0
- package/lib/writer/VideoWriter.js +52 -0
- package/lib/writer/WriteMultipart.js +22 -0
- package/lib/writer/WriteStream.js +51 -0
- package/package.json +75 -0
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
const { v4: uuid } = require("uuid");
|
|
2
|
+
|
|
3
|
+
const WriteMultipart = async (writeStream, headers, content) => {
|
|
4
|
+
const boundaryId = uuid();
|
|
5
|
+
await writeStream.write(`--BOUNDARY_${boundaryId}\r\n`);
|
|
6
|
+
for (let i = 0; i < headers.length; i++) {
|
|
7
|
+
const header = headers[i];
|
|
8
|
+
await writeStream.write(`${header.headerName}: ${header.headerValue}`);
|
|
9
|
+
if (header.attributes) {
|
|
10
|
+
for (let j = 0; j < header.attributes.length; j++) {
|
|
11
|
+
const attribute = header.attributes[j];
|
|
12
|
+
await writeStream.write(`;${attribute.attributeName}=${attribute.attributeValue}`);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
await writeStream.write("\r\n");
|
|
16
|
+
}
|
|
17
|
+
await writeStream.write("\r\n");
|
|
18
|
+
await writeStream.write(content);
|
|
19
|
+
await writeStream.write(`\r\n--BOUNDARY_${boundaryId}--`);
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
module.exports = WriteMultipart;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
const fs = require("fs");
|
|
2
|
+
const zlib = require("zlib");
|
|
3
|
+
const path = require("path");
|
|
4
|
+
|
|
5
|
+
/** Create an optionally gzipped stream,
|
|
6
|
+
* where the write operations are performed in order executed,
|
|
7
|
+
* and don't require synchronization, only the 'close' operation
|
|
8
|
+
* requires syncing.
|
|
9
|
+
*/
|
|
10
|
+
const WriteStream = (dir, nameSrc, options = {}) => {
|
|
11
|
+
const isGzip = nameSrc.indexOf(".gz") != -1 || options.gzip;
|
|
12
|
+
const name = (isGzip && nameSrc.indexOf(".gz") === -1 && `${nameSrc}.gz`) || nameSrc;
|
|
13
|
+
if (options.mkdir) fs.mkdirSync(dir, { recursive: true });
|
|
14
|
+
|
|
15
|
+
const tempName = path.join(dir, `tempFile-${Math.round(Math.random() * 1000000000)}`);
|
|
16
|
+
const finalName = path.join(dir, name);
|
|
17
|
+
const rawStream = fs.createWriteStream(tempName);
|
|
18
|
+
const closePromise = new Promise((resolve) => {
|
|
19
|
+
rawStream.on("close", () => {
|
|
20
|
+
resolve("closed");
|
|
21
|
+
});
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
let writeStream = rawStream;
|
|
25
|
+
if (isGzip) {
|
|
26
|
+
writeStream = zlib.createGzip();
|
|
27
|
+
writeStream.pipe(rawStream);
|
|
28
|
+
writeStream.on("close", () => {
|
|
29
|
+
rawStream.close();
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
async function close() {
|
|
34
|
+
await this.writeStream.end();
|
|
35
|
+
await this.closePromise;
|
|
36
|
+
await fs.rename(tempName, finalName, () => true); // console.log('Renamed', tempName,finalName));
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
return {
|
|
40
|
+
writeStream,
|
|
41
|
+
closePromise,
|
|
42
|
+
|
|
43
|
+
write(data) {
|
|
44
|
+
return this.writeStream.write(data);
|
|
45
|
+
},
|
|
46
|
+
|
|
47
|
+
close,
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
module.exports = WriteStream;
|
package/package.json
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@radicalimaging/static-wado-creator",
|
|
3
|
+
"version": "0.6.4",
|
|
4
|
+
"description": "Library to convert DICOMP10 to DICOMweb format. Original upstream: https://github.com/chafey/dicomp10-to-dicomweb-js",
|
|
5
|
+
"publishConfig": {
|
|
6
|
+
"access": "public"
|
|
7
|
+
},
|
|
8
|
+
"keywords": [
|
|
9
|
+
"StaticWado",
|
|
10
|
+
"DICOM",
|
|
11
|
+
"DICOMweb"
|
|
12
|
+
],
|
|
13
|
+
"author": [
|
|
14
|
+
"Chris Hafey <chafey@gmail.com>",
|
|
15
|
+
"Bill Wallace <bill.wallace@radicalimaging.com>"
|
|
16
|
+
],
|
|
17
|
+
"contributors": [
|
|
18
|
+
"Rodolfo Costa <rodolfo.costa@radicalimaging.com>"
|
|
19
|
+
],
|
|
20
|
+
"engines": {
|
|
21
|
+
"node": ">=14.18.1",
|
|
22
|
+
"npm": ">=6.14.15",
|
|
23
|
+
"yarn": ">=1.22.4"
|
|
24
|
+
},
|
|
25
|
+
"repository": {
|
|
26
|
+
"type": "git",
|
|
27
|
+
"url": "https://github.com/OHIF/static-wado",
|
|
28
|
+
"directory": "packages/static-wado-creator"
|
|
29
|
+
},
|
|
30
|
+
"bugs": {
|
|
31
|
+
"url": "https://github.com/OHIF/static-wado/issues"
|
|
32
|
+
},
|
|
33
|
+
"homepage": "https://github.com/OHIF/static-wado#readme",
|
|
34
|
+
"license": "ISC",
|
|
35
|
+
"main": "lib/index.js",
|
|
36
|
+
"directories": {
|
|
37
|
+
"lib": "lib",
|
|
38
|
+
"bin": "bin"
|
|
39
|
+
},
|
|
40
|
+
"files": [
|
|
41
|
+
"bin",
|
|
42
|
+
"lib"
|
|
43
|
+
],
|
|
44
|
+
"bin": {
|
|
45
|
+
"mkdicomweb": "bin/mkdicomweb.js",
|
|
46
|
+
"mkdicomwebdeduplicated": "bin/mkdicomwebdeduplicated.js",
|
|
47
|
+
"mkdicomwebdeduplicatedgroup": "bin/mkdicomwebdeduplicatedgroup.js",
|
|
48
|
+
"mkdicomwebinstances": "bin/mkdicomwebinstances.js",
|
|
49
|
+
"mkdicomwebstudy": "bin/mkdicomwebstudy.js"
|
|
50
|
+
},
|
|
51
|
+
"scripts": {
|
|
52
|
+
"test": "jest --config ./jest.config.js",
|
|
53
|
+
"build": "echo \"No build yet\" && exit 0",
|
|
54
|
+
"link:exec": "npm link",
|
|
55
|
+
"lint": "npx eslint --color \"*(bin|lib)/**/*.{js,mjs}\"",
|
|
56
|
+
"lint:fix": "npx eslint --fix --color \"*(bin|lib)/**/*.{js,mjs}\""
|
|
57
|
+
},
|
|
58
|
+
"jest": {
|
|
59
|
+
"verbose": true
|
|
60
|
+
},
|
|
61
|
+
"dependencies": {
|
|
62
|
+
"@cornerstonejs/dicom-codec": "^0.1.3",
|
|
63
|
+
"@radicalimaging/static-cs-lite": "^0.0.2",
|
|
64
|
+
"@radicalimaging/static-wado-util": "^0.6.2",
|
|
65
|
+
"canvas": "^2.9.1",
|
|
66
|
+
"config-point": "^0.5.0",
|
|
67
|
+
"dicom-parser": "^1.8.13",
|
|
68
|
+
"glob": "^7.2.0",
|
|
69
|
+
"uuid": "^8.3.2",
|
|
70
|
+
"node-object-hash": "^2.3.10"
|
|
71
|
+
},
|
|
72
|
+
"devDependencies": {
|
|
73
|
+
"must": "^0.13.4"
|
|
74
|
+
}
|
|
75
|
+
}
|