@radicalimaging/static-wado-creator 1.6.10 → 1.6.11
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/dist/index.js +84811 -54896
- package/lib/DeleteStudy.js +9 -14
- package/lib/RejectInstance.js +4 -15
- package/lib/StaticWado.js +92 -147
- package/lib/createMain.js +3 -3
- package/lib/createPart10.js +19 -23
- package/lib/createThumbnail.js +27 -45
- package/lib/deleteMain.js +2 -2
- package/lib/groupMain.js +2 -2
- package/lib/index.js +6 -6
- package/lib/indexMain.js +2 -2
- package/lib/instanceMain.js +2 -2
- package/lib/metadataMain.js +2 -2
- package/lib/mkdicomwebConfig.js +157 -165
- package/lib/model/TagLists.js +5 -17
- package/lib/model/uids.js +29 -29
- package/lib/operation/InstanceDeduplicate.js +14 -19
- package/lib/operation/ScanStudy.js +11 -18
- package/lib/operation/StudyData.js +87 -156
- package/lib/operation/ThumbnailService.js +29 -54
- package/lib/operation/adapter/decodeImage.js +2 -2
- package/lib/operation/adapter/getImageInfo.js +7 -8
- package/lib/operation/adapter/transcodeImage.js +95 -146
- package/lib/operation/extractImageFrames.js +13 -17
- package/lib/operation/getDataSet.js +9 -43
- package/lib/operation/getEncapsulatedImageFrame.js +7 -19
- package/lib/operation/getNumberOfFrames.js +2 -2
- package/lib/operation/getUncompressedImageFrame.js +2 -10
- package/lib/operation/getVR.js +5 -5
- package/lib/operation/getValue.js +42 -65
- package/lib/operation/validateMetadata.js +4 -4
- package/lib/program/index.js +2 -5
- package/lib/rejectMain.js +2 -2
- package/lib/serverMain.js +8 -14
- package/lib/util/IdCreator.js +8 -17
- package/lib/util/adaptProgramOpts.js +2 -2
- package/lib/util/compressionOptionParser.js +5 -14
- package/lib/util/resultsReport.ts +67 -68
- package/lib/writer/CompleteStudyWriter.js +24 -37
- package/lib/writer/DeduplicateWriter.js +7 -8
- package/lib/writer/ExpandUriPath.js +3 -5
- package/lib/writer/HashDataWriter.js +18 -18
- package/lib/writer/ImageFrameWriter.js +20 -33
- package/lib/writer/MultipartHeader.js +1 -1
- package/lib/writer/RawDicomWriter.js +12 -13
- package/lib/writer/ThumbnailWriter.js +2 -2
- package/lib/writer/VideoWriter.js +23 -34
- package/lib/writer/WriteMultipart.js +4 -6
- package/lib/writer/WriteStream.js +14 -20
- package/package.json +1 -1
- package/lib/writer/static-dicomweb.code-workspace +0 -8
package/lib/createThumbnail.js
CHANGED
|
@@ -1,15 +1,11 @@
|
|
|
1
|
-
const {
|
|
2
|
-
|
|
3
|
-
readBulkData,
|
|
4
|
-
handleHomeRelative,
|
|
5
|
-
} = require("@radicalimaging/static-wado-util");
|
|
6
|
-
const dcmjs = require("dcmjs");
|
|
1
|
+
const { Tags, readBulkData, handleHomeRelative } = require('@radicalimaging/static-wado-util');
|
|
2
|
+
const dcmjs = require('dcmjs');
|
|
7
3
|
|
|
8
|
-
const StaticWado = require(
|
|
9
|
-
const adaptProgramOpts = require(
|
|
10
|
-
const WriteStream = require(
|
|
4
|
+
const StaticWado = require('./StaticWado');
|
|
5
|
+
const adaptProgramOpts = require('./util/adaptProgramOpts');
|
|
6
|
+
const WriteStream = require('./writer/WriteStream');
|
|
11
7
|
|
|
12
|
-
const UncompressedLEIExplicit =
|
|
8
|
+
const UncompressedLEIExplicit = '1.2.840.10008.1.2.1';
|
|
13
9
|
const { DicomDict, DicomMetaDictionary } = dcmjs.data;
|
|
14
10
|
|
|
15
11
|
const fileMetaInformationVersionArray = new Uint8Array(2);
|
|
@@ -17,18 +13,18 @@ fileMetaInformationVersionArray[1] = 1;
|
|
|
17
13
|
|
|
18
14
|
const readBulkDataValue = async (studyDir, instance, value, options) => {
|
|
19
15
|
const { BulkDataURI } = value;
|
|
20
|
-
value.vr =
|
|
16
|
+
value.vr = 'OB';
|
|
21
17
|
const seriesUid = Tags.getValue(instance, Tags.SeriesInstanceUID);
|
|
22
18
|
const numberOfFrames = Tags.getValue(instance, Tags.NumberOfFrames) || 1;
|
|
23
|
-
if (BulkDataURI.indexOf(
|
|
19
|
+
if (BulkDataURI.indexOf('/frames') !== -1) {
|
|
24
20
|
const seriesDir = `${studyDir}/series/${seriesUid}`;
|
|
25
21
|
if (options?.frame === false) {
|
|
26
22
|
return;
|
|
27
23
|
}
|
|
28
24
|
// Really only support a limited number of frames based on memory size
|
|
29
25
|
value.Value = [];
|
|
30
|
-
if (typeof options?.frame ===
|
|
31
|
-
console.noQuiet(
|
|
26
|
+
if (typeof options?.frame === 'number') {
|
|
27
|
+
console.noQuiet('Reading frame', options.frame);
|
|
32
28
|
const bulk = await readBulkData(seriesDir, BulkDataURI, options.frame);
|
|
33
29
|
if (!bulk) {
|
|
34
30
|
return;
|
|
@@ -38,7 +34,7 @@ const readBulkDataValue = async (studyDir, instance, value, options) => {
|
|
|
38
34
|
value.contentType = bulk.contentType;
|
|
39
35
|
return;
|
|
40
36
|
}
|
|
41
|
-
console.noQuiet(
|
|
37
|
+
console.noQuiet('Reading frames', 1, '...', numberOfFrames);
|
|
42
38
|
for (let frame = 1; frame <= numberOfFrames; frame++) {
|
|
43
39
|
const bulk = await readBulkData(seriesDir, BulkDataURI, frame);
|
|
44
40
|
if (!bulk) break;
|
|
@@ -62,15 +58,15 @@ const readBinaryData = async (dir, instance, options = { frame: true }) => {
|
|
|
62
58
|
}
|
|
63
59
|
if (!v.vr) {
|
|
64
60
|
const value0 = v.Value?.[0];
|
|
65
|
-
if (typeof value0 ===
|
|
66
|
-
v.vr =
|
|
61
|
+
if (typeof value0 === 'string') {
|
|
62
|
+
v.vr = 'LT';
|
|
67
63
|
} else {
|
|
68
|
-
console.log(
|
|
64
|
+
console.log('Deleting', tag, v.Value, v);
|
|
69
65
|
delete instance[tag];
|
|
70
66
|
}
|
|
71
67
|
continue;
|
|
72
68
|
}
|
|
73
|
-
if (v.vr ===
|
|
69
|
+
if (v.vr === 'SQ' && v.Values?.length) {
|
|
74
70
|
await Promise.all(v.Values.map(readBinaryData));
|
|
75
71
|
continue;
|
|
76
72
|
}
|
|
@@ -92,35 +88,26 @@ module.exports = async function createThumbnail(options, program) {
|
|
|
92
88
|
const importer = new StaticWado(finalOptions);
|
|
93
89
|
const studyInstanceUid = program.args[0];
|
|
94
90
|
const dir = `${importer.options.rootDir}/studies/${studyInstanceUid}`;
|
|
95
|
-
console.noQuiet(
|
|
91
|
+
console.noQuiet('Creating thumbnail for', studyInstanceUid, dir);
|
|
96
92
|
const study = await importer.callback.scanStudy(studyInstanceUid);
|
|
97
93
|
const outputPath = `./studies/${studyInstanceUid}`;
|
|
98
|
-
const { sopInstanceUid, seriesInstanceUid, seriesThumbnail, studyThumbnail } =
|
|
99
|
-
options;
|
|
94
|
+
const { sopInstanceUid, seriesInstanceUid, seriesThumbnail, studyThumbnail } = options;
|
|
100
95
|
const sops = sopInstanceUid ? new Set() : null;
|
|
101
96
|
if (sopInstanceUid) {
|
|
102
|
-
for (const sop of sopInstanceUid.split(
|
|
97
|
+
for (const sop of sopInstanceUid.split(',').map(s => s.trim())) {
|
|
103
98
|
sops.add(sop);
|
|
104
99
|
}
|
|
105
100
|
}
|
|
106
101
|
const promises = [];
|
|
107
102
|
|
|
108
103
|
const writeThumbnail = async (id, buffer) => {
|
|
109
|
-
console.verbose(
|
|
110
|
-
await importer.callback.thumbWriter(
|
|
111
|
-
id.sopInstanceRootPath,
|
|
112
|
-
"thumbnail",
|
|
113
|
-
buffer,
|
|
114
|
-
);
|
|
104
|
+
console.verbose('Write thumbnail', id, buffer);
|
|
105
|
+
await importer.callback.thumbWriter(id.sopInstanceRootPath, 'thumbnail', buffer);
|
|
115
106
|
if (seriesThumbnail) {
|
|
116
|
-
await importer.callback.thumbWriter(
|
|
117
|
-
id.seriesRootPath,
|
|
118
|
-
"thumbnail",
|
|
119
|
-
buffer,
|
|
120
|
-
);
|
|
107
|
+
await importer.callback.thumbWriter(id.seriesRootPath, 'thumbnail', buffer);
|
|
121
108
|
}
|
|
122
109
|
if (studyThumbnail) {
|
|
123
|
-
await importer.callback.thumbWriter(id.studyPath,
|
|
110
|
+
await importer.callback.thumbWriter(id.studyPath, 'thumbnail', buffer);
|
|
124
111
|
}
|
|
125
112
|
};
|
|
126
113
|
|
|
@@ -143,21 +130,16 @@ module.exports = async function createThumbnail(options, program) {
|
|
|
143
130
|
|
|
144
131
|
await readBinaryData(dir, instance, codecOptions);
|
|
145
132
|
|
|
146
|
-
const availableTransferSyntaxUID = Tags.getValue(
|
|
147
|
-
instance,
|
|
148
|
-
Tags.AvailableTransferSyntaxUID,
|
|
149
|
-
);
|
|
133
|
+
const availableTransferSyntaxUID = Tags.getValue(instance, Tags.AvailableTransferSyntaxUID);
|
|
150
134
|
const pixelData = Tags.getValue(instance, Tags.PixelData);
|
|
151
135
|
if (!pixelData) {
|
|
152
|
-
console.warn(
|
|
136
|
+
console.warn('No pixel data found in instance');
|
|
153
137
|
continue;
|
|
154
138
|
}
|
|
155
139
|
const transferSyntaxUid =
|
|
156
140
|
instance[Tags.PixelData].transferSyntaxUid || availableTransferSyntaxUID;
|
|
157
|
-
const frame = Array.isArray(pixelData.Value)
|
|
158
|
-
|
|
159
|
-
: pixelData;
|
|
160
|
-
console.verbose("Use transfer syntax uid:", transferSyntaxUid);
|
|
141
|
+
const frame = Array.isArray(pixelData.Value) ? pixelData.Value[0] : pixelData;
|
|
142
|
+
console.verbose('Use transfer syntax uid:', transferSyntaxUid);
|
|
161
143
|
const id = importer.callback.uids({
|
|
162
144
|
studyInstanceUid,
|
|
163
145
|
seriesInstanceUid: Tags.getValue(instance, Tags.SeriesInstanceUID),
|
|
@@ -170,7 +152,7 @@ module.exports = async function createThumbnail(options, program) {
|
|
|
170
152
|
null,
|
|
171
153
|
instance,
|
|
172
154
|
id.transferSyntaxUid,
|
|
173
|
-
writeThumbnail.bind(null, id)
|
|
155
|
+
writeThumbnail.bind(null, id)
|
|
174
156
|
);
|
|
175
157
|
promises.push(promise);
|
|
176
158
|
if (seriesThumbnail) {
|
package/lib/deleteMain.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const StaticWado = require(
|
|
2
|
-
const adaptProgramOpts = require(
|
|
1
|
+
const StaticWado = require('./StaticWado');
|
|
2
|
+
const adaptProgramOpts = require('./util/adaptProgramOpts');
|
|
3
3
|
|
|
4
4
|
module.exports = function deleteMain(options, program) {
|
|
5
5
|
const finalOptions = adaptProgramOpts(options, {
|
package/lib/groupMain.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const StaticWado = require(
|
|
2
|
-
const adaptProgramOpts = require(
|
|
1
|
+
const StaticWado = require('./StaticWado');
|
|
2
|
+
const adaptProgramOpts = require('./util/adaptProgramOpts');
|
|
3
3
|
|
|
4
4
|
module.exports = function createMain(options, program) {
|
|
5
5
|
const finalOptions = adaptProgramOpts(options, {
|
package/lib/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
const mkdicomwebConfig = require(
|
|
2
|
-
const StaticWado = require(
|
|
3
|
-
const { configureProgram } = require(
|
|
1
|
+
const mkdicomwebConfig = require('./mkdicomwebConfig');
|
|
2
|
+
const StaticWado = require('./StaticWado');
|
|
3
|
+
const { configureProgram } = require('./program/index.js');
|
|
4
4
|
|
|
5
5
|
StaticWado.mkdicomwebConfig = mkdicomwebConfig;
|
|
6
|
-
StaticWado.createMain = require(
|
|
7
|
-
StaticWado.deleteMain = require(
|
|
8
|
-
StaticWado.adaptProgramOpts = require(
|
|
6
|
+
StaticWado.createMain = require('./createMain');
|
|
7
|
+
StaticWado.deleteMain = require('./deleteMain');
|
|
8
|
+
StaticWado.adaptProgramOpts = require('./util/adaptProgramOpts');
|
|
9
9
|
StaticWado.configureProgram = configureProgram;
|
|
10
10
|
|
|
11
11
|
module.exports = StaticWado;
|
package/lib/indexMain.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const StaticWado = require(
|
|
2
|
-
const adaptProgramOpts = require(
|
|
1
|
+
const StaticWado = require('./StaticWado');
|
|
2
|
+
const adaptProgramOpts = require('./util/adaptProgramOpts');
|
|
3
3
|
|
|
4
4
|
module.exports = function createMain(options) {
|
|
5
5
|
const finalOptions = adaptProgramOpts(options, {
|
package/lib/instanceMain.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const StaticWado = require(
|
|
2
|
-
const adaptProgramOpts = require(
|
|
1
|
+
const StaticWado = require('./StaticWado');
|
|
2
|
+
const adaptProgramOpts = require('./util/adaptProgramOpts');
|
|
3
3
|
|
|
4
4
|
module.exports = function createMain(options, program) {
|
|
5
5
|
const finalOptions = adaptProgramOpts(options, {
|
package/lib/metadataMain.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const StaticWado = require(
|
|
2
|
-
const adaptProgramOpts = require(
|
|
1
|
+
const StaticWado = require('./StaticWado');
|
|
2
|
+
const adaptProgramOpts = require('./util/adaptProgramOpts');
|
|
3
3
|
|
|
4
4
|
module.exports = function createMain(options, program) {
|
|
5
5
|
const finalOptions = adaptProgramOpts(options, {
|