@fnndsc/salsa 3.15.0 → 3.16.0
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/dicom/dictionary.d.ts +42 -0
- package/dist/dicom/dictionary.js +221 -0
- package/dist/dicom/dictionary.js.map +1 -0
- package/dist/dicom/index.d.ts +7 -0
- package/dist/dicom/index.js +24 -0
- package/dist/dicom/index.js.map +1 -0
- package/dist/dicom/series.d.ts +120 -0
- package/dist/dicom/series.js +209 -0
- package/dist/dicom/series.js.map +1 -0
- package/dist/dicom/tags.d.ts +80 -0
- package/dist/dicom/tags.js +234 -0
- package/dist/dicom/tags.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/retrieve/watch.d.ts +4 -0
- package/dist/retrieve/watch.js +29 -6
- package/dist/retrieve/watch.js.map +1 -1
- package/package.json +5 -3
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file The static knowledge a tag listing needs beyond the DICOM dictionary:
|
|
3
|
+
* which module a tag belongs to, which tags carry identifying information,
|
|
4
|
+
* and how a handful of coded values read in words.
|
|
5
|
+
*
|
|
6
|
+
* All three are surfaces' concerns as much as the kernel's, so they live
|
|
7
|
+
* once, here, and every surface renders from the same answer: grouping
|
|
8
|
+
* decides where a row sits, the PHI flag decides whether it is shown or
|
|
9
|
+
* redacted, decoding gives a human the meaning of `MR` or `HFS`. The kernel
|
|
10
|
+
* flags and decodes; it never strips.
|
|
11
|
+
*
|
|
12
|
+
* @module
|
|
13
|
+
*/
|
|
14
|
+
/** Where a tag sits in a grouped listing. */
|
|
15
|
+
export type DicomTagGroup = 'meta' | 'patient' | 'study' | 'series' | 'image' | 'equipment' | 'private' | 'other';
|
|
16
|
+
/** The groups in the order a listing shows them. */
|
|
17
|
+
export declare const DICOM_TAG_GROUPS: readonly DicomTagGroup[];
|
|
18
|
+
/**
|
|
19
|
+
* Places a tag in its listing group.
|
|
20
|
+
*
|
|
21
|
+
* @param groupNumber - The tag's group number (the `gggg` of `(gggg,eeee)`).
|
|
22
|
+
* @param name - The dictionary name, when the tag has one.
|
|
23
|
+
* @returns The listing group.
|
|
24
|
+
*/
|
|
25
|
+
export declare function tagGroup_of(groupNumber: number, name: string | undefined): DicomTagGroup;
|
|
26
|
+
/**
|
|
27
|
+
* Tags that identify a person or an institution. Flagged on the model so a
|
|
28
|
+
* surface can redact; never stripped by the kernel.
|
|
29
|
+
*/
|
|
30
|
+
export declare const DICOM_PHI_TAGS: ReadonlySet<string>;
|
|
31
|
+
/** Transfer syntaxes by UID. A renderer's decoder support is judged against these. */
|
|
32
|
+
export declare const TRANSFER_SYNTAX_NAMES: Readonly<Record<string, string>>;
|
|
33
|
+
/**
|
|
34
|
+
* Reads a coded value in words, for the short list of tags a reader meets
|
|
35
|
+
* first. SOP class UIDs are named by the caller through the dictionary.
|
|
36
|
+
*
|
|
37
|
+
* @param name - The tag's dictionary name.
|
|
38
|
+
* @param value - The tag's formatted value.
|
|
39
|
+
* @returns The decoded words, or undefined when the tag is not coded or the
|
|
40
|
+
* code is unknown.
|
|
41
|
+
*/
|
|
42
|
+
export declare function tagValue_decode(name: string, value: string): string | undefined;
|
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @file The static knowledge a tag listing needs beyond the DICOM dictionary:
|
|
4
|
+
* which module a tag belongs to, which tags carry identifying information,
|
|
5
|
+
* and how a handful of coded values read in words.
|
|
6
|
+
*
|
|
7
|
+
* All three are surfaces' concerns as much as the kernel's, so they live
|
|
8
|
+
* once, here, and every surface renders from the same answer: grouping
|
|
9
|
+
* decides where a row sits, the PHI flag decides whether it is shown or
|
|
10
|
+
* redacted, decoding gives a human the meaning of `MR` or `HFS`. The kernel
|
|
11
|
+
* flags and decodes; it never strips.
|
|
12
|
+
*
|
|
13
|
+
* @module
|
|
14
|
+
*/
|
|
15
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
+
exports.TRANSFER_SYNTAX_NAMES = exports.DICOM_PHI_TAGS = exports.DICOM_TAG_GROUPS = void 0;
|
|
17
|
+
exports.tagGroup_of = tagGroup_of;
|
|
18
|
+
exports.tagValue_decode = tagValue_decode;
|
|
19
|
+
/** The groups in the order a listing shows them. */
|
|
20
|
+
exports.DICOM_TAG_GROUPS = [
|
|
21
|
+
'patient',
|
|
22
|
+
'study',
|
|
23
|
+
'series',
|
|
24
|
+
'image',
|
|
25
|
+
'equipment',
|
|
26
|
+
'meta',
|
|
27
|
+
'private',
|
|
28
|
+
'other',
|
|
29
|
+
];
|
|
30
|
+
/**
|
|
31
|
+
* Named tags whose module the group number alone gets wrong. Group 0008 mixes
|
|
32
|
+
* study, series and image identity; 0018 mixes acquisition and equipment;
|
|
33
|
+
* 0020 mixes study, series and image position.
|
|
34
|
+
*/
|
|
35
|
+
const GROUP_BY_NAME = {
|
|
36
|
+
// 0008: series identity and content
|
|
37
|
+
Modality: 'series',
|
|
38
|
+
SeriesDate: 'series',
|
|
39
|
+
SeriesTime: 'series',
|
|
40
|
+
SeriesDescription: 'series',
|
|
41
|
+
BodyPartExamined: 'series',
|
|
42
|
+
ProtocolName: 'series',
|
|
43
|
+
// 0008: image identity
|
|
44
|
+
SOPClassUID: 'image',
|
|
45
|
+
SOPInstanceUID: 'image',
|
|
46
|
+
ImageType: 'image',
|
|
47
|
+
ContentDate: 'image',
|
|
48
|
+
ContentTime: 'image',
|
|
49
|
+
AcquisitionDate: 'image',
|
|
50
|
+
AcquisitionTime: 'image',
|
|
51
|
+
AcquisitionNumber: 'image',
|
|
52
|
+
// 0008: equipment
|
|
53
|
+
Manufacturer: 'equipment',
|
|
54
|
+
ManufacturerModelName: 'equipment',
|
|
55
|
+
StationName: 'equipment',
|
|
56
|
+
InstitutionName: 'equipment',
|
|
57
|
+
InstitutionAddress: 'equipment',
|
|
58
|
+
InstitutionalDepartmentName: 'equipment',
|
|
59
|
+
// 0018: equipment
|
|
60
|
+
DeviceSerialNumber: 'equipment',
|
|
61
|
+
SoftwareVersions: 'equipment',
|
|
62
|
+
MagneticFieldStrength: 'equipment',
|
|
63
|
+
// 0020: study
|
|
64
|
+
StudyInstanceUID: 'study',
|
|
65
|
+
StudyID: 'study',
|
|
66
|
+
// 0020: series
|
|
67
|
+
SeriesInstanceUID: 'series',
|
|
68
|
+
SeriesNumber: 'series',
|
|
69
|
+
FrameOfReferenceUID: 'series',
|
|
70
|
+
PositionReferenceIndicator: 'series',
|
|
71
|
+
PatientPosition: 'series',
|
|
72
|
+
// 0020: image
|
|
73
|
+
InstanceNumber: 'image',
|
|
74
|
+
ImagePositionPatient: 'image',
|
|
75
|
+
ImageOrientationPatient: 'image',
|
|
76
|
+
SliceLocation: 'image',
|
|
77
|
+
ImageComments: 'image',
|
|
78
|
+
NumberOfFrames: 'image',
|
|
79
|
+
};
|
|
80
|
+
/** Module by tag group number, for tags the name table does not place. */
|
|
81
|
+
const GROUP_BY_NUMBER = {
|
|
82
|
+
0x0002: 'meta',
|
|
83
|
+
0x0008: 'study',
|
|
84
|
+
0x0010: 'patient',
|
|
85
|
+
0x0018: 'series',
|
|
86
|
+
0x0020: 'image',
|
|
87
|
+
0x0028: 'image',
|
|
88
|
+
0x0032: 'study',
|
|
89
|
+
0x0038: 'patient',
|
|
90
|
+
0x0040: 'study',
|
|
91
|
+
0x0054: 'series',
|
|
92
|
+
0x0070: 'image',
|
|
93
|
+
0x0088: 'series',
|
|
94
|
+
0x3006: 'image',
|
|
95
|
+
0x7fe0: 'image',
|
|
96
|
+
};
|
|
97
|
+
/**
|
|
98
|
+
* Places a tag in its listing group.
|
|
99
|
+
*
|
|
100
|
+
* @param groupNumber - The tag's group number (the `gggg` of `(gggg,eeee)`).
|
|
101
|
+
* @param name - The dictionary name, when the tag has one.
|
|
102
|
+
* @returns The listing group.
|
|
103
|
+
*/
|
|
104
|
+
function tagGroup_of(groupNumber, name) {
|
|
105
|
+
if (groupNumber % 2 === 1)
|
|
106
|
+
return 'private';
|
|
107
|
+
if (name !== undefined && GROUP_BY_NAME[name] !== undefined)
|
|
108
|
+
return GROUP_BY_NAME[name];
|
|
109
|
+
return GROUP_BY_NUMBER[groupNumber] ?? 'other';
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Tags that identify a person or an institution. Flagged on the model so a
|
|
113
|
+
* surface can redact; never stripped by the kernel.
|
|
114
|
+
*/
|
|
115
|
+
exports.DICOM_PHI_TAGS = new Set([
|
|
116
|
+
'PatientName',
|
|
117
|
+
'PatientID',
|
|
118
|
+
'PatientBirthDate',
|
|
119
|
+
'PatientBirthTime',
|
|
120
|
+
'PatientAddress',
|
|
121
|
+
'PatientTelephoneNumbers',
|
|
122
|
+
'OtherPatientIDs',
|
|
123
|
+
'OtherPatientNames',
|
|
124
|
+
'PatientMotherBirthName',
|
|
125
|
+
'InstitutionName',
|
|
126
|
+
'InstitutionAddress',
|
|
127
|
+
'ReferringPhysicianName',
|
|
128
|
+
'PerformingPhysicianName',
|
|
129
|
+
'OperatorsName',
|
|
130
|
+
'PhysiciansOfRecord',
|
|
131
|
+
'NameOfPhysiciansReadingStudy',
|
|
132
|
+
'AccessionNumber',
|
|
133
|
+
]);
|
|
134
|
+
/** Words for the coded values a reader meets first. */
|
|
135
|
+
const MODALITY_NAMES = {
|
|
136
|
+
MR: 'Magnetic Resonance',
|
|
137
|
+
CT: 'Computed Tomography',
|
|
138
|
+
PT: 'Positron Emission Tomography',
|
|
139
|
+
NM: 'Nuclear Medicine',
|
|
140
|
+
US: 'Ultrasound',
|
|
141
|
+
CR: 'Computed Radiography',
|
|
142
|
+
DX: 'Digital Radiography',
|
|
143
|
+
MG: 'Mammography',
|
|
144
|
+
RF: 'Radio Fluoroscopy',
|
|
145
|
+
XA: 'X-Ray Angiography',
|
|
146
|
+
OT: 'Other',
|
|
147
|
+
SR: 'Structured Report',
|
|
148
|
+
SEG: 'Segmentation',
|
|
149
|
+
RTSTRUCT: 'RT Structure Set',
|
|
150
|
+
RTDOSE: 'RT Dose',
|
|
151
|
+
RTPLAN: 'RT Plan',
|
|
152
|
+
PR: 'Presentation State',
|
|
153
|
+
KO: 'Key Object Selection',
|
|
154
|
+
DOC: 'Document',
|
|
155
|
+
};
|
|
156
|
+
const PATIENT_SEX_NAMES = {
|
|
157
|
+
M: 'Male',
|
|
158
|
+
F: 'Female',
|
|
159
|
+
O: 'Other',
|
|
160
|
+
};
|
|
161
|
+
const PATIENT_POSITION_NAMES = {
|
|
162
|
+
HFS: 'Head First Supine',
|
|
163
|
+
HFP: 'Head First Prone',
|
|
164
|
+
HFDR: 'Head First Decubitus Right',
|
|
165
|
+
HFDL: 'Head First Decubitus Left',
|
|
166
|
+
FFS: 'Feet First Supine',
|
|
167
|
+
FFP: 'Feet First Prone',
|
|
168
|
+
FFDR: 'Feet First Decubitus Right',
|
|
169
|
+
FFDL: 'Feet First Decubitus Left',
|
|
170
|
+
};
|
|
171
|
+
const PHOTOMETRIC_NAMES = {
|
|
172
|
+
MONOCHROME1: 'Greyscale, minimum is white',
|
|
173
|
+
MONOCHROME2: 'Greyscale, minimum is black',
|
|
174
|
+
RGB: 'Colour, RGB',
|
|
175
|
+
'PALETTE COLOR': 'Colour, palette',
|
|
176
|
+
YBR_FULL: 'Colour, YBR full',
|
|
177
|
+
YBR_FULL_422: 'Colour, YBR 4:2:2',
|
|
178
|
+
YBR_RCT: 'Colour, YBR reversible',
|
|
179
|
+
YBR_ICT: 'Colour, YBR irreversible',
|
|
180
|
+
};
|
|
181
|
+
/** Transfer syntaxes by UID. A renderer's decoder support is judged against these. */
|
|
182
|
+
exports.TRANSFER_SYNTAX_NAMES = {
|
|
183
|
+
'1.2.840.10008.1.2': 'Implicit VR Little Endian',
|
|
184
|
+
'1.2.840.10008.1.2.1': 'Explicit VR Little Endian',
|
|
185
|
+
'1.2.840.10008.1.2.1.99': 'Deflated Explicit VR Little Endian',
|
|
186
|
+
'1.2.840.10008.1.2.2': 'Explicit VR Big Endian',
|
|
187
|
+
'1.2.840.10008.1.2.4.50': 'JPEG Baseline (8-bit)',
|
|
188
|
+
'1.2.840.10008.1.2.4.51': 'JPEG Extended (12-bit)',
|
|
189
|
+
'1.2.840.10008.1.2.4.57': 'JPEG Lossless',
|
|
190
|
+
'1.2.840.10008.1.2.4.70': 'JPEG Lossless SV1',
|
|
191
|
+
'1.2.840.10008.1.2.4.80': 'JPEG-LS Lossless',
|
|
192
|
+
'1.2.840.10008.1.2.4.81': 'JPEG-LS Near-Lossless',
|
|
193
|
+
'1.2.840.10008.1.2.4.90': 'JPEG 2000 Lossless',
|
|
194
|
+
'1.2.840.10008.1.2.4.91': 'JPEG 2000',
|
|
195
|
+
'1.2.840.10008.1.2.4.201': 'High-Throughput JPEG 2000 Lossless',
|
|
196
|
+
'1.2.840.10008.1.2.4.202': 'High-Throughput JPEG 2000 Lossless RPCL',
|
|
197
|
+
'1.2.840.10008.1.2.4.203': 'High-Throughput JPEG 2000',
|
|
198
|
+
'1.2.840.10008.1.2.5': 'RLE Lossless',
|
|
199
|
+
};
|
|
200
|
+
/** Decoders by tag name; each answers with words or nothing. */
|
|
201
|
+
const DECODERS = {
|
|
202
|
+
Modality: (value) => MODALITY_NAMES[value],
|
|
203
|
+
PatientSex: (value) => PATIENT_SEX_NAMES[value],
|
|
204
|
+
PatientPosition: (value) => PATIENT_POSITION_NAMES[value],
|
|
205
|
+
PhotometricInterpretation: (value) => PHOTOMETRIC_NAMES[value],
|
|
206
|
+
TransferSyntaxUID: (value) => exports.TRANSFER_SYNTAX_NAMES[value],
|
|
207
|
+
};
|
|
208
|
+
/**
|
|
209
|
+
* Reads a coded value in words, for the short list of tags a reader meets
|
|
210
|
+
* first. SOP class UIDs are named by the caller through the dictionary.
|
|
211
|
+
*
|
|
212
|
+
* @param name - The tag's dictionary name.
|
|
213
|
+
* @param value - The tag's formatted value.
|
|
214
|
+
* @returns The decoded words, or undefined when the tag is not coded or the
|
|
215
|
+
* code is unknown.
|
|
216
|
+
*/
|
|
217
|
+
function tagValue_decode(name, value) {
|
|
218
|
+
const decoder = DECODERS[name];
|
|
219
|
+
return decoder === undefined ? undefined : decoder(value);
|
|
220
|
+
}
|
|
221
|
+
//# sourceMappingURL=dictionary.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dictionary.js","sourceRoot":"","sources":["../../src/dicom/dictionary.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;GAYG;;;AAqGH,kCAIC;AAmHD,0CAGC;AAlND,oDAAoD;AACvC,QAAA,gBAAgB,GAA6B;IACxD,SAAS;IACT,OAAO;IACP,QAAQ;IACR,OAAO;IACP,WAAW;IACX,MAAM;IACN,SAAS;IACT,OAAO;CACR,CAAC;AAEF;;;;GAIG;AACH,MAAM,aAAa,GAA4C;IAC7D,oCAAoC;IACpC,QAAQ,EAAE,QAAQ;IAClB,UAAU,EAAE,QAAQ;IACpB,UAAU,EAAE,QAAQ;IACpB,iBAAiB,EAAE,QAAQ;IAC3B,gBAAgB,EAAE,QAAQ;IAC1B,YAAY,EAAE,QAAQ;IACtB,uBAAuB;IACvB,WAAW,EAAE,OAAO;IACpB,cAAc,EAAE,OAAO;IACvB,SAAS,EAAE,OAAO;IAClB,WAAW,EAAE,OAAO;IACpB,WAAW,EAAE,OAAO;IACpB,eAAe,EAAE,OAAO;IACxB,eAAe,EAAE,OAAO;IACxB,iBAAiB,EAAE,OAAO;IAC1B,kBAAkB;IAClB,YAAY,EAAE,WAAW;IACzB,qBAAqB,EAAE,WAAW;IAClC,WAAW,EAAE,WAAW;IACxB,eAAe,EAAE,WAAW;IAC5B,kBAAkB,EAAE,WAAW;IAC/B,2BAA2B,EAAE,WAAW;IACxC,kBAAkB;IAClB,kBAAkB,EAAE,WAAW;IAC/B,gBAAgB,EAAE,WAAW;IAC7B,qBAAqB,EAAE,WAAW;IAClC,cAAc;IACd,gBAAgB,EAAE,OAAO;IACzB,OAAO,EAAE,OAAO;IAChB,eAAe;IACf,iB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use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
/**
|
|
18
|
+
* @file DICOM in the kernel: tag reading and the series as a folder.
|
|
19
|
+
* @module
|
|
20
|
+
*/
|
|
21
|
+
__exportStar(require("./dictionary.js"), exports);
|
|
22
|
+
__exportStar(require("./tags.js"), exports);
|
|
23
|
+
__exportStar(require("./series.js"), exports);
|
|
24
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/dicom/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA;;;GAGG;AACH,kDAAgC;AAChC,4CAA0B;AAC1B,8CAA4B"}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file The series as the kernel knows it.
|
|
3
|
+
*
|
|
4
|
+
* A DICOM series in ChRIS is a folder of files. Files are the truth; a
|
|
5
|
+
* viewer hides them. This module answers "what is this folder as a series"
|
|
6
|
+
* without walking every file: the listing gives the count, the bytes and
|
|
7
|
+
* the order (oxidicom names each file by its InstanceNumber, so the name
|
|
8
|
+
* sorts the stack), and one header read gives identity, modality and
|
|
9
|
+
* geometry. A full positional sort is a volume renderer's business and is
|
|
10
|
+
* deferred to it.
|
|
11
|
+
*
|
|
12
|
+
* Headers read once are kept, keyed by path, so a tag listing that follows
|
|
13
|
+
* a scroll costs nothing on the second visit.
|
|
14
|
+
*
|
|
15
|
+
* @module
|
|
16
|
+
*/
|
|
17
|
+
import { type Result } from '@fnndsc/cumin';
|
|
18
|
+
import type { VFSItem } from '../vfs/provider.js';
|
|
19
|
+
import { type DicomTagSet } from './tags.js';
|
|
20
|
+
/** How a folder is read; injected so the summary is testable without a daemon. */
|
|
21
|
+
export interface DicomFolderIO {
|
|
22
|
+
list(path: string): Promise<Result<VFSItem[]>>;
|
|
23
|
+
readBinary(path: string): Promise<Result<Buffer>>;
|
|
24
|
+
}
|
|
25
|
+
/** The real folder reader: the VFS for listings, CFS for bytes. */
|
|
26
|
+
export declare const dicomFolderIO_default: DicomFolderIO;
|
|
27
|
+
/** How a folder's files are ordered into a stack. */
|
|
28
|
+
export type DicomSeriesOrder = 'filename' | 'unknown';
|
|
29
|
+
/** The voxel grid, from one header. */
|
|
30
|
+
export interface DicomGeometry {
|
|
31
|
+
rows: number;
|
|
32
|
+
columns: number;
|
|
33
|
+
/** Row and column spacing in mm. */
|
|
34
|
+
pixelSpacing?: [number, number];
|
|
35
|
+
sliceThickness?: number;
|
|
36
|
+
spacingBetweenSlices?: number;
|
|
37
|
+
}
|
|
38
|
+
/** What one folder is as a series. */
|
|
39
|
+
export interface DicomSeriesSummary {
|
|
40
|
+
path: string;
|
|
41
|
+
seriesInstanceUID?: string;
|
|
42
|
+
studyInstanceUID?: string;
|
|
43
|
+
modality: string;
|
|
44
|
+
seriesDescription: string;
|
|
45
|
+
seriesNumber?: number;
|
|
46
|
+
/** DICOM files in the folder. */
|
|
47
|
+
instances: number;
|
|
48
|
+
/** Frames in the header read; one for a classic single-frame file. */
|
|
49
|
+
frames: number;
|
|
50
|
+
order: DicomSeriesOrder;
|
|
51
|
+
geometry?: DicomGeometry;
|
|
52
|
+
transferSyntax?: {
|
|
53
|
+
uid: string;
|
|
54
|
+
name?: string;
|
|
55
|
+
};
|
|
56
|
+
/** Sum of the folder's DICOM file sizes. */
|
|
57
|
+
bytes: number;
|
|
58
|
+
/** The file whose header answered, first in stack order. */
|
|
59
|
+
header: string;
|
|
60
|
+
/** Files ordered for a stack, first to last. */
|
|
61
|
+
files: string[];
|
|
62
|
+
/** Annotation files found for the series' UID. */
|
|
63
|
+
annotations: string[];
|
|
64
|
+
}
|
|
65
|
+
/** Options for a series summary. */
|
|
66
|
+
export interface DicomSeriesOptions {
|
|
67
|
+
/** Where annotation folders live; `<root>/<SeriesInstanceUID>` is listed when given. */
|
|
68
|
+
annotationRoot?: string;
|
|
69
|
+
}
|
|
70
|
+
/** A folder's DICOM files, ordered. */
|
|
71
|
+
export interface DicomFolderListing {
|
|
72
|
+
files: Array<{
|
|
73
|
+
path: string;
|
|
74
|
+
size: number;
|
|
75
|
+
}>;
|
|
76
|
+
order: DicomSeriesOrder;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Reads one file's header through the cache.
|
|
80
|
+
*
|
|
81
|
+
* @param path - The file's VFS path.
|
|
82
|
+
* @param io - The folder reader.
|
|
83
|
+
* @returns The tag set, or an error when the file could not be read or parsed.
|
|
84
|
+
*/
|
|
85
|
+
export declare function dicomHeader_get(path: string, io?: DicomFolderIO): Promise<Result<DicomTagSet>>;
|
|
86
|
+
/**
|
|
87
|
+
* Forgets every cached header.
|
|
88
|
+
*/
|
|
89
|
+
export declare function dicomHeaderCache_clear(): void;
|
|
90
|
+
/**
|
|
91
|
+
* Lists a folder's DICOM files in stack order.
|
|
92
|
+
*
|
|
93
|
+
* Order is `filename` when every file starts with a number and a dash
|
|
94
|
+
* (oxidicom's `<InstanceNumber>-<SOPInstanceUID>.dcm`), sorted by that number;
|
|
95
|
+
* otherwise `unknown`, sorted by name.
|
|
96
|
+
*
|
|
97
|
+
* @param folder - The folder's VFS path.
|
|
98
|
+
* @param io - The folder reader.
|
|
99
|
+
* @returns The ordered files with sizes, or an error when the folder cannot be listed.
|
|
100
|
+
*/
|
|
101
|
+
export declare function dicomFolder_list(folder: string, io?: DicomFolderIO): Promise<Result<DicomFolderListing>>;
|
|
102
|
+
/**
|
|
103
|
+
* Picks at most `cap` files spread evenly across the stack, always keeping
|
|
104
|
+
* the first and the last.
|
|
105
|
+
*
|
|
106
|
+
* @param files - The ordered files.
|
|
107
|
+
* @param cap - The most to keep.
|
|
108
|
+
* @returns The chosen files, in order.
|
|
109
|
+
*/
|
|
110
|
+
export declare function dicomFiles_sample<T>(files: T[], cap: number): T[];
|
|
111
|
+
/**
|
|
112
|
+
* Summarizes a folder as a series from its listing and one header.
|
|
113
|
+
*
|
|
114
|
+
* @param folder - The folder's VFS path.
|
|
115
|
+
* @param options - Where to look for annotations.
|
|
116
|
+
* @param io - The folder reader.
|
|
117
|
+
* @returns The summary; an error when the folder cannot be listed, holds no
|
|
118
|
+
* DICOM files, or its first file cannot be read.
|
|
119
|
+
*/
|
|
120
|
+
export declare function dicomSeries_summarize(folder: string, options?: DicomSeriesOptions, io?: DicomFolderIO): Promise<Result<DicomSeriesSummary>>;
|
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.dicomFolderIO_default = void 0;
|
|
4
|
+
exports.dicomHeader_get = dicomHeader_get;
|
|
5
|
+
exports.dicomHeaderCache_clear = dicomHeaderCache_clear;
|
|
6
|
+
exports.dicomFolder_list = dicomFolder_list;
|
|
7
|
+
exports.dicomFiles_sample = dicomFiles_sample;
|
|
8
|
+
exports.dicomSeries_summarize = dicomSeries_summarize;
|
|
9
|
+
/**
|
|
10
|
+
* @file The series as the kernel knows it.
|
|
11
|
+
*
|
|
12
|
+
* A DICOM series in ChRIS is a folder of files. Files are the truth; a
|
|
13
|
+
* viewer hides them. This module answers "what is this folder as a series"
|
|
14
|
+
* without walking every file: the listing gives the count, the bytes and
|
|
15
|
+
* the order (oxidicom names each file by its InstanceNumber, so the name
|
|
16
|
+
* sorts the stack), and one header read gives identity, modality and
|
|
17
|
+
* geometry. A full positional sort is a volume renderer's business and is
|
|
18
|
+
* deferred to it.
|
|
19
|
+
*
|
|
20
|
+
* Headers read once are kept, keyed by path, so a tag listing that follows
|
|
21
|
+
* a scroll costs nothing on the second visit.
|
|
22
|
+
*
|
|
23
|
+
* @module
|
|
24
|
+
*/
|
|
25
|
+
const cumin_1 = require("@fnndsc/cumin");
|
|
26
|
+
const dispatcher_js_1 = require("../vfs/dispatcher.js");
|
|
27
|
+
const index_js_1 = require("../files/index.js");
|
|
28
|
+
const dictionary_js_1 = require("./dictionary.js");
|
|
29
|
+
const tags_js_1 = require("./tags.js");
|
|
30
|
+
/** The real folder reader: the VFS for listings, CFS for bytes. */
|
|
31
|
+
exports.dicomFolderIO_default = {
|
|
32
|
+
list: (path) => dispatcher_js_1.vfsDispatcher.list(path),
|
|
33
|
+
readBinary: (path) => (0, index_js_1.fileContent_getBinary)(path),
|
|
34
|
+
};
|
|
35
|
+
/** Headers kept by path. Bounded; the oldest entry leaves first. */
|
|
36
|
+
const HEADER_CACHE_LIMIT = 4096;
|
|
37
|
+
const headerCache = new Map();
|
|
38
|
+
/**
|
|
39
|
+
* Reads one file's header through the cache.
|
|
40
|
+
*
|
|
41
|
+
* @param path - The file's VFS path.
|
|
42
|
+
* @param io - The folder reader.
|
|
43
|
+
* @returns The tag set, or an error when the file could not be read or parsed.
|
|
44
|
+
*/
|
|
45
|
+
async function dicomHeader_get(path, io = exports.dicomFolderIO_default) {
|
|
46
|
+
const cached = headerCache.get(path);
|
|
47
|
+
if (cached !== undefined)
|
|
48
|
+
return (0, cumin_1.Ok)(cached);
|
|
49
|
+
const bytes = await io.readBinary(path);
|
|
50
|
+
if (!bytes.ok)
|
|
51
|
+
return (0, cumin_1.Err)();
|
|
52
|
+
const parsed = (0, tags_js_1.dicomTags_read)(bytes.value);
|
|
53
|
+
if (!parsed.ok)
|
|
54
|
+
return (0, cumin_1.Err)();
|
|
55
|
+
if (headerCache.size >= HEADER_CACHE_LIMIT) {
|
|
56
|
+
const oldest = headerCache.keys().next().value;
|
|
57
|
+
if (oldest !== undefined)
|
|
58
|
+
headerCache.delete(oldest);
|
|
59
|
+
}
|
|
60
|
+
headerCache.set(path, parsed.value);
|
|
61
|
+
return parsed;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Forgets every cached header.
|
|
65
|
+
*/
|
|
66
|
+
function dicomHeaderCache_clear() {
|
|
67
|
+
headerCache.clear();
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Lists a folder's DICOM files in stack order.
|
|
71
|
+
*
|
|
72
|
+
* Order is `filename` when every file starts with a number and a dash
|
|
73
|
+
* (oxidicom's `<InstanceNumber>-<SOPInstanceUID>.dcm`), sorted by that number;
|
|
74
|
+
* otherwise `unknown`, sorted by name.
|
|
75
|
+
*
|
|
76
|
+
* @param folder - The folder's VFS path.
|
|
77
|
+
* @param io - The folder reader.
|
|
78
|
+
* @returns The ordered files with sizes, or an error when the folder cannot be listed.
|
|
79
|
+
*/
|
|
80
|
+
async function dicomFolder_list(folder, io = exports.dicomFolderIO_default) {
|
|
81
|
+
const listing = await io.list(folder);
|
|
82
|
+
if (!listing.ok)
|
|
83
|
+
return (0, cumin_1.Err)();
|
|
84
|
+
const base = folder.endsWith('/') ? folder.slice(0, -1) : folder;
|
|
85
|
+
const entries = listing.value.filter((item) => item.type === 'file' && /\.dcm$/i.test(item.name));
|
|
86
|
+
const numbered = entries.length > 0 && entries.every((item) => /^\d+-/.test(item.name));
|
|
87
|
+
const sorted = [...entries].sort((a, b) => numbered ? parseInt(a.name, 10) - parseInt(b.name, 10) || a.name.localeCompare(b.name) : a.name.localeCompare(b.name));
|
|
88
|
+
return (0, cumin_1.Ok)({
|
|
89
|
+
files: sorted.map((item) => ({ path: `${base}/${item.name}`, size: item.size })),
|
|
90
|
+
order: numbered ? 'filename' : 'unknown',
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Picks at most `cap` files spread evenly across the stack, always keeping
|
|
95
|
+
* the first and the last.
|
|
96
|
+
*
|
|
97
|
+
* @param files - The ordered files.
|
|
98
|
+
* @param cap - The most to keep.
|
|
99
|
+
* @returns The chosen files, in order.
|
|
100
|
+
*/
|
|
101
|
+
function dicomFiles_sample(files, cap) {
|
|
102
|
+
if (cap <= 0)
|
|
103
|
+
return [];
|
|
104
|
+
if (files.length <= cap)
|
|
105
|
+
return files;
|
|
106
|
+
if (cap === 1)
|
|
107
|
+
return [files[0]];
|
|
108
|
+
const chosen = [];
|
|
109
|
+
const step = (files.length - 1) / (cap - 1);
|
|
110
|
+
for (let i = 0; i < cap; i++)
|
|
111
|
+
chosen.push(files[Math.round(i * step)]);
|
|
112
|
+
return chosen;
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Summarizes a folder as a series from its listing and one header.
|
|
116
|
+
*
|
|
117
|
+
* @param folder - The folder's VFS path.
|
|
118
|
+
* @param options - Where to look for annotations.
|
|
119
|
+
* @param io - The folder reader.
|
|
120
|
+
* @returns The summary; an error when the folder cannot be listed, holds no
|
|
121
|
+
* DICOM files, or its first file cannot be read.
|
|
122
|
+
*/
|
|
123
|
+
async function dicomSeries_summarize(folder, options = {}, io = exports.dicomFolderIO_default) {
|
|
124
|
+
const listed = await dicomFolder_list(folder, io);
|
|
125
|
+
if (!listed.ok || listed.value.files.length === 0)
|
|
126
|
+
return (0, cumin_1.Err)();
|
|
127
|
+
const files = listed.value.files;
|
|
128
|
+
const header = await dicomHeader_get(files[0].path, io);
|
|
129
|
+
if (!header.ok)
|
|
130
|
+
return (0, cumin_1.Err)();
|
|
131
|
+
const tags = header.value.tags;
|
|
132
|
+
const seriesInstanceUID = tagText_of(tags, 'SeriesInstanceUID');
|
|
133
|
+
const summary = {
|
|
134
|
+
path: folder,
|
|
135
|
+
...(seriesInstanceUID !== undefined ? { seriesInstanceUID } : {}),
|
|
136
|
+
...(tagText_of(tags, 'StudyInstanceUID') !== undefined ? { studyInstanceUID: tagText_of(tags, 'StudyInstanceUID') } : {}),
|
|
137
|
+
modality: tagText_of(tags, 'Modality') ?? 'OT',
|
|
138
|
+
seriesDescription: tagText_of(tags, 'SeriesDescription') ?? '',
|
|
139
|
+
...(tagNumber_of(tags, 'SeriesNumber') !== undefined ? { seriesNumber: tagNumber_of(tags, 'SeriesNumber') } : {}),
|
|
140
|
+
instances: files.length,
|
|
141
|
+
frames: tagNumber_of(tags, 'NumberOfFrames') ?? 1,
|
|
142
|
+
order: listed.value.order,
|
|
143
|
+
...(geometry_of(tags) !== undefined ? { geometry: geometry_of(tags) } : {}),
|
|
144
|
+
...(header.value.transferSyntaxUID !== undefined
|
|
145
|
+
? {
|
|
146
|
+
transferSyntax: {
|
|
147
|
+
uid: header.value.transferSyntaxUID,
|
|
148
|
+
...(dictionary_js_1.TRANSFER_SYNTAX_NAMES[header.value.transferSyntaxUID] !== undefined ? { name: dictionary_js_1.TRANSFER_SYNTAX_NAMES[header.value.transferSyntaxUID] } : {}),
|
|
149
|
+
},
|
|
150
|
+
}
|
|
151
|
+
: {}),
|
|
152
|
+
bytes: files.reduce((total, file) => total + file.size, 0),
|
|
153
|
+
header: files[0].path,
|
|
154
|
+
files: files.map((file) => file.path),
|
|
155
|
+
annotations: [],
|
|
156
|
+
};
|
|
157
|
+
if (options.annotationRoot !== undefined && seriesInstanceUID !== undefined) {
|
|
158
|
+
const root = options.annotationRoot.endsWith('/') ? options.annotationRoot.slice(0, -1) : options.annotationRoot;
|
|
159
|
+
const found = await io.list(`${root}/${seriesInstanceUID}`);
|
|
160
|
+
if (found.ok) {
|
|
161
|
+
summary.annotations = found.value
|
|
162
|
+
.filter((item) => item.type === 'file')
|
|
163
|
+
.map((item) => `${root}/${seriesInstanceUID}/${item.name}`)
|
|
164
|
+
.sort();
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
return (0, cumin_1.Ok)(summary);
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* A tag's text, or nothing when absent or empty.
|
|
171
|
+
*/
|
|
172
|
+
function tagText_of(tags, name) {
|
|
173
|
+
const tag = (0, tags_js_1.dicomTag_find)(tags, name);
|
|
174
|
+
return tag === undefined || tag.value === '' ? undefined : tag.value;
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* A tag's first value as a number, or nothing when absent or not numeric.
|
|
178
|
+
*/
|
|
179
|
+
function tagNumber_of(tags, name) {
|
|
180
|
+
const text = tagText_of(tags, name);
|
|
181
|
+
if (text === undefined)
|
|
182
|
+
return undefined;
|
|
183
|
+
const parsed = Number(text.split('\\')[0]);
|
|
184
|
+
return Number.isFinite(parsed) ? parsed : undefined;
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* The voxel grid from a header, when it has one.
|
|
188
|
+
*/
|
|
189
|
+
function geometry_of(tags) {
|
|
190
|
+
const rows = tagNumber_of(tags, 'Rows');
|
|
191
|
+
const columns = tagNumber_of(tags, 'Columns');
|
|
192
|
+
if (rows === undefined || columns === undefined)
|
|
193
|
+
return undefined;
|
|
194
|
+
const geometry = { rows, columns };
|
|
195
|
+
const spacing = tagText_of(tags, 'PixelSpacing');
|
|
196
|
+
if (spacing !== undefined) {
|
|
197
|
+
const parts = spacing.split('\\').map(Number);
|
|
198
|
+
if (parts.length === 2 && parts.every(Number.isFinite))
|
|
199
|
+
geometry.pixelSpacing = [parts[0], parts[1]];
|
|
200
|
+
}
|
|
201
|
+
const thickness = tagNumber_of(tags, 'SliceThickness');
|
|
202
|
+
if (thickness !== undefined)
|
|
203
|
+
geometry.sliceThickness = thickness;
|
|
204
|
+
const between = tagNumber_of(tags, 'SpacingBetweenSlices');
|
|
205
|
+
if (between !== undefined)
|
|
206
|
+
geometry.spacingBetweenSlices = between;
|
|
207
|
+
return geometry;
|
|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@fnndsc/cumin';
|
|
2
|
+
import { type DicomTagGroup } from './dictionary.js';
|
|
3
|
+
/** One element of a DICOM dataset, as every surface sees it. */
|
|
4
|
+
export interface DicomTag {
|
|
5
|
+
/** `(gggg,eeee)`, upper-case hex. */
|
|
6
|
+
tag: string;
|
|
7
|
+
/** Dictionary name; `PrivateTag` or `Unknown` when the dictionary has none. */
|
|
8
|
+
name: string;
|
|
9
|
+
vr: string;
|
|
10
|
+
/** The value in text. Multi-valued elements join with `\`; bulk data reads `<N bytes>`. */
|
|
11
|
+
value: string;
|
|
12
|
+
group: DicomTagGroup;
|
|
13
|
+
/** True when the tag identifies a person or an institution. */
|
|
14
|
+
phi: boolean;
|
|
15
|
+
/** Words for a coded value, when the kernel knows them. */
|
|
16
|
+
decoded?: string;
|
|
17
|
+
/** Sequence items, each a dataset of its own. */
|
|
18
|
+
items?: DicomTag[][];
|
|
19
|
+
}
|
|
20
|
+
/** Everything read from one file. */
|
|
21
|
+
export interface DicomTagSet {
|
|
22
|
+
tags: DicomTag[];
|
|
23
|
+
/** From the file meta group; absent for a bare dataset. */
|
|
24
|
+
transferSyntaxUID?: string;
|
|
25
|
+
}
|
|
26
|
+
/** A tag whose value changes across a folder. */
|
|
27
|
+
export interface DicomVaryingTag {
|
|
28
|
+
tag: string;
|
|
29
|
+
name: string;
|
|
30
|
+
vr: string;
|
|
31
|
+
group: DicomTagGroup;
|
|
32
|
+
phi: boolean;
|
|
33
|
+
/** How many distinct values the folder holds. */
|
|
34
|
+
distinct: number;
|
|
35
|
+
/** The value in the first file, in folder order. */
|
|
36
|
+
first: string;
|
|
37
|
+
/** The value in the last file, in folder order. */
|
|
38
|
+
last: string;
|
|
39
|
+
/** Every file's value, in folder order. Files without the tag carry `null`. */
|
|
40
|
+
values: Array<{
|
|
41
|
+
path: string;
|
|
42
|
+
value: string | null;
|
|
43
|
+
}>;
|
|
44
|
+
}
|
|
45
|
+
/** What a folder of files shares and what changes across it. */
|
|
46
|
+
export interface DicomTagsSummary {
|
|
47
|
+
constant: DicomTag[];
|
|
48
|
+
varying: DicomVaryingTag[];
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Reads the elements of a DICOM file.
|
|
52
|
+
*
|
|
53
|
+
* @param bytes - The whole file, Part 10 header included.
|
|
54
|
+
* @returns The tag set, or an error when the bytes are not a DICOM file.
|
|
55
|
+
*/
|
|
56
|
+
export declare function dicomTags_read(bytes: Buffer): Result<DicomTagSet>;
|
|
57
|
+
/**
|
|
58
|
+
* Finds one tag by name in a tag set's top level.
|
|
59
|
+
*
|
|
60
|
+
* @param tags - The tags to search.
|
|
61
|
+
* @param name - The dictionary name.
|
|
62
|
+
* @returns The tag, or undefined.
|
|
63
|
+
*/
|
|
64
|
+
export declare function dicomTag_find(tags: DicomTag[], name: string): DicomTag | undefined;
|
|
65
|
+
/**
|
|
66
|
+
* Tells constant from varying across a folder's files, in folder order.
|
|
67
|
+
*
|
|
68
|
+
* A tag is constant when every file carries it with the same value
|
|
69
|
+
* (sequences compare by their items). Anything else, including a tag some
|
|
70
|
+
* files lack, is varying, with its first and last value and its distinct
|
|
71
|
+
* count. Files that failed to read are the caller's to report; they are not
|
|
72
|
+
* passed here.
|
|
73
|
+
*
|
|
74
|
+
* @param files - Each file's path and tag set, in folder order.
|
|
75
|
+
* @returns The summary.
|
|
76
|
+
*/
|
|
77
|
+
export declare function dicomTags_summarize(files: Array<{
|
|
78
|
+
path: string;
|
|
79
|
+
tags: DicomTagSet;
|
|
80
|
+
}>): DicomTagsSummary;
|
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.dicomTags_read = dicomTags_read;
|
|
7
|
+
exports.dicomTag_find = dicomTag_find;
|
|
8
|
+
exports.dicomTags_summarize = dicomTags_summarize;
|
|
9
|
+
/**
|
|
10
|
+
* @file DICOM tag reading: one parser for every surface.
|
|
11
|
+
*
|
|
12
|
+
* A DICOM file is a dictionary of elements. Reading one here gives every
|
|
13
|
+
* surface the same answer: the tag, its dictionary name and VR, its value in
|
|
14
|
+
* text, the module it belongs to, whether it identifies someone, and words
|
|
15
|
+
* for the coded values a reader meets first. Sequences keep their items.
|
|
16
|
+
* Across a folder, the same reader tells constant from varying: what the
|
|
17
|
+
* series shares against what changes slice by slice.
|
|
18
|
+
*
|
|
19
|
+
* Bulk values (pixel data and friends) are never rendered as bytes; the
|
|
20
|
+
* listing says how many bytes there were. Long text is carried whole on the
|
|
21
|
+
* model; a surface that bounds it says so.
|
|
22
|
+
*
|
|
23
|
+
* @module
|
|
24
|
+
*/
|
|
25
|
+
const dcmjs_1 = __importDefault(require("dcmjs"));
|
|
26
|
+
const cumin_1 = require("@fnndsc/cumin");
|
|
27
|
+
const dictionary_js_1 = require("./dictionary.js");
|
|
28
|
+
/** VRs whose values are bulk bytes, never text. */
|
|
29
|
+
const BULK_VRS = new Set(['OB', 'OW', 'OF', 'OD', 'OL', 'OV', 'UN']);
|
|
30
|
+
/** Group numbers whose every element is a sequence item boundary or padding. */
|
|
31
|
+
const STRUCTURAL_TAGS = new Set(['FFFEE000', 'FFFEE00D', 'FFFEE0DD']);
|
|
32
|
+
/**
|
|
33
|
+
* Reads the elements of a DICOM file.
|
|
34
|
+
*
|
|
35
|
+
* @param bytes - The whole file, Part 10 header included.
|
|
36
|
+
* @returns The tag set, or an error when the bytes are not a DICOM file.
|
|
37
|
+
*/
|
|
38
|
+
function dicomTags_read(bytes) {
|
|
39
|
+
const buffer = new Uint8Array(bytes).slice().buffer;
|
|
40
|
+
try {
|
|
41
|
+
const message = dcmjs_1.default.data.DicomMessage.readFile(buffer, { ignoreErrors: true });
|
|
42
|
+
const meta = dict_flatten(message.meta);
|
|
43
|
+
const body = dict_flatten(message.dict);
|
|
44
|
+
const syntax = meta.find((tag) => tag.name === 'TransferSyntaxUID');
|
|
45
|
+
return (0, cumin_1.Ok)({
|
|
46
|
+
tags: [...meta, ...body],
|
|
47
|
+
...(syntax !== undefined ? { transferSyntaxUID: syntax.value } : {}),
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
catch {
|
|
51
|
+
return (0, cumin_1.Err)();
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Turns a raw dictionary into tags, in tag order, sequences nested.
|
|
56
|
+
*
|
|
57
|
+
* @param dict - A dcmjs dictionary keyed by `ggggeeee`.
|
|
58
|
+
* @returns The tags.
|
|
59
|
+
*/
|
|
60
|
+
function dict_flatten(dict) {
|
|
61
|
+
const keys = Object.keys(dict)
|
|
62
|
+
.filter((key) => /^[0-9A-Fa-f]{8}$/.test(key) && !STRUCTURAL_TAGS.has(key.toUpperCase()))
|
|
63
|
+
.sort();
|
|
64
|
+
return keys.map((key) => element_toTag(key, dict[key]));
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Renders one element as a tag.
|
|
68
|
+
*
|
|
69
|
+
* @param key - The `ggggeeee` key.
|
|
70
|
+
* @param element - The raw element.
|
|
71
|
+
* @returns The tag.
|
|
72
|
+
*/
|
|
73
|
+
function element_toTag(key, element) {
|
|
74
|
+
const upper = key.toUpperCase();
|
|
75
|
+
const tag = `(${upper.slice(0, 4)},${upper.slice(4)})`;
|
|
76
|
+
const groupNumber = parseInt(upper.slice(0, 4), 16);
|
|
77
|
+
const entry = dcmjs_1.default.data.DicomMetaDictionary.dictionary[tag];
|
|
78
|
+
const isPrivate = groupNumber % 2 === 1;
|
|
79
|
+
const name = entry?.name ?? (isPrivate ? 'PrivateTag' : 'Unknown');
|
|
80
|
+
const vr = element.vr || entry?.vr || 'UN';
|
|
81
|
+
const values = element.Value ?? [];
|
|
82
|
+
const result = {
|
|
83
|
+
tag,
|
|
84
|
+
name,
|
|
85
|
+
vr,
|
|
86
|
+
value: '',
|
|
87
|
+
group: (0, dictionary_js_1.tagGroup_of)(groupNumber, entry?.name),
|
|
88
|
+
phi: dictionary_js_1.DICOM_PHI_TAGS.has(name),
|
|
89
|
+
};
|
|
90
|
+
if (vr === 'SQ') {
|
|
91
|
+
const items = values.map((item) => dict_flatten(item));
|
|
92
|
+
result.items = items;
|
|
93
|
+
result.value = `${items.length} item${items.length === 1 ? '' : 's'}`;
|
|
94
|
+
return result;
|
|
95
|
+
}
|
|
96
|
+
if (BULK_VRS.has(vr)) {
|
|
97
|
+
result.value = `<${bulk_bytes(values)} bytes>`;
|
|
98
|
+
return result;
|
|
99
|
+
}
|
|
100
|
+
result.value = values.map((value) => value_text(value, vr)).join('\\');
|
|
101
|
+
const decoded = decoded_of(name, result.value);
|
|
102
|
+
if (decoded !== undefined)
|
|
103
|
+
result.decoded = decoded;
|
|
104
|
+
return result;
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Sums the bytes of a bulk value list.
|
|
108
|
+
*
|
|
109
|
+
* @param values - Buffers or typed arrays.
|
|
110
|
+
* @returns Total byte length.
|
|
111
|
+
*/
|
|
112
|
+
function bulk_bytes(values) {
|
|
113
|
+
let total = 0;
|
|
114
|
+
for (const value of values) {
|
|
115
|
+
if (value instanceof ArrayBuffer)
|
|
116
|
+
total += value.byteLength;
|
|
117
|
+
else if (ArrayBuffer.isView(value))
|
|
118
|
+
total += value.byteLength;
|
|
119
|
+
}
|
|
120
|
+
return total;
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* One value in text. Person names are alphabetic components; everything
|
|
124
|
+
* else is its string form.
|
|
125
|
+
*
|
|
126
|
+
* @param value - The raw value.
|
|
127
|
+
* @param vr - The element's VR.
|
|
128
|
+
* @returns The text.
|
|
129
|
+
*/
|
|
130
|
+
function value_text(value, vr) {
|
|
131
|
+
if (vr === 'PN' && value !== null && typeof value === 'object') {
|
|
132
|
+
const parts = value;
|
|
133
|
+
return String(parts.Alphabetic ?? parts.Ideographic ?? parts.Phonetic ?? '');
|
|
134
|
+
}
|
|
135
|
+
if (value === null || value === undefined)
|
|
136
|
+
return '';
|
|
137
|
+
return String(value);
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* Words for a coded value: the short dictionary list, plus SOP class UIDs
|
|
141
|
+
* named through dcmjs.
|
|
142
|
+
*
|
|
143
|
+
* @param name - The tag's name.
|
|
144
|
+
* @param value - The tag's text value.
|
|
145
|
+
* @returns Words, or nothing.
|
|
146
|
+
*/
|
|
147
|
+
function decoded_of(name, value) {
|
|
148
|
+
if (name === 'SOPClassUID' || name === 'MediaStorageSOPClassUID') {
|
|
149
|
+
return dcmjs_1.default.data.DicomMetaDictionary.sopClassNamesByUID[value];
|
|
150
|
+
}
|
|
151
|
+
return (0, dictionary_js_1.tagValue_decode)(name, value);
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* Finds one tag by name in a tag set's top level.
|
|
155
|
+
*
|
|
156
|
+
* @param tags - The tags to search.
|
|
157
|
+
* @param name - The dictionary name.
|
|
158
|
+
* @returns The tag, or undefined.
|
|
159
|
+
*/
|
|
160
|
+
function dicomTag_find(tags, name) {
|
|
161
|
+
return tags.find((tag) => tag.name === name);
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* Tells constant from varying across a folder's files, in folder order.
|
|
165
|
+
*
|
|
166
|
+
* A tag is constant when every file carries it with the same value
|
|
167
|
+
* (sequences compare by their items). Anything else, including a tag some
|
|
168
|
+
* files lack, is varying, with its first and last value and its distinct
|
|
169
|
+
* count. Files that failed to read are the caller's to report; they are not
|
|
170
|
+
* passed here.
|
|
171
|
+
*
|
|
172
|
+
* @param files - Each file's path and tag set, in folder order.
|
|
173
|
+
* @returns The summary.
|
|
174
|
+
*/
|
|
175
|
+
function dicomTags_summarize(files) {
|
|
176
|
+
const order = [];
|
|
177
|
+
const byTag = new Map();
|
|
178
|
+
for (const file of files) {
|
|
179
|
+
const seen = new Map();
|
|
180
|
+
for (const tag of file.tags.tags) {
|
|
181
|
+
if (!byTag.has(tag.tag)) {
|
|
182
|
+
byTag.set(tag.tag, new Map());
|
|
183
|
+
order.push(tag.tag);
|
|
184
|
+
}
|
|
185
|
+
seen.set(tag.tag, tag);
|
|
186
|
+
}
|
|
187
|
+
for (const [key, tag] of seen)
|
|
188
|
+
byTag.get(key).set(file.path, tag);
|
|
189
|
+
}
|
|
190
|
+
const constant = [];
|
|
191
|
+
const varying = [];
|
|
192
|
+
for (const key of order.sort()) {
|
|
193
|
+
const perFile = byTag.get(key);
|
|
194
|
+
const values = files.map((file) => {
|
|
195
|
+
const tag = perFile.get(file.path);
|
|
196
|
+
return { path: file.path, value: tag === undefined ? null : tag_comparable(tag) };
|
|
197
|
+
});
|
|
198
|
+
const distinctValues = new Set(values.map((entry) => entry.value));
|
|
199
|
+
const sample = perFile.values().next().value;
|
|
200
|
+
if (distinctValues.size === 1 && !distinctValues.has(null)) {
|
|
201
|
+
constant.push(sample);
|
|
202
|
+
continue;
|
|
203
|
+
}
|
|
204
|
+
const present = values.filter((entry) => entry.value !== null);
|
|
205
|
+
varying.push({
|
|
206
|
+
tag: sample.tag,
|
|
207
|
+
name: sample.name,
|
|
208
|
+
vr: sample.vr,
|
|
209
|
+
group: sample.group,
|
|
210
|
+
phi: sample.phi,
|
|
211
|
+
distinct: distinctValues.size - (distinctValues.has(null) ? 1 : 0),
|
|
212
|
+
first: present[0].value,
|
|
213
|
+
last: present[present.length - 1].value,
|
|
214
|
+
values: values.map((entry) => ({
|
|
215
|
+
path: entry.path,
|
|
216
|
+
value: entry.value === null ? null : perFile.get(entry.path).value,
|
|
217
|
+
})),
|
|
218
|
+
});
|
|
219
|
+
}
|
|
220
|
+
return { constant, varying };
|
|
221
|
+
}
|
|
222
|
+
/**
|
|
223
|
+
* The value a tag is compared by across files: its text, or for a sequence
|
|
224
|
+
* the text of its items.
|
|
225
|
+
*
|
|
226
|
+
* @param tag - The tag.
|
|
227
|
+
* @returns A comparable string.
|
|
228
|
+
*/
|
|
229
|
+
function tag_comparable(tag) {
|
|
230
|
+
if (tag.items === undefined)
|
|
231
|
+
return tag.value;
|
|
232
|
+
return JSON.stringify(tag.items.map((item) => item.map((inner) => `${inner.tag}=${tag_comparable(inner)}`)));
|
|
233
|
+
}
|
|
234
|
+
//# sourceMappingURL=tags.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tags.js","sourceRoot":"","sources":["../../src/dicom/tags.ts"],"names":[],"mappings":";;;;;AAiFA,wCAcC;AA+GD,sCAEC;AAcD,kDA8CC;AA5QD;;;;;;;;;;;;;;;GAeG;AACH,kDAA0B;AAE1B,yCAAqD;AACrD,mDAAmG;AAkDnG,mDAAmD;AACnD,MAAM,QAAQ,GAAwB,IAAI,GAAG,CAAS,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC;AAElG,gFAAgF;AAChF,MAAM,eAAe,GAAwB,IAAI,GAAG,CAAS,CAAC,UAAU,EAAE,UAAU,EAAE,UAAU,CAAC,CAAC,CAAC;AAEnG;;;;;GAKG;AACH,SAAgB,cAAc,CAAC,KAAa;IAC1C,MAAM,MAAM,GAAgB,IAAI,UAAU,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,CAAC,MAAqB,CAAC;IAChF,IAAI,CAAC;QACH,MAAM,OAAO,GAAG,eAAK,CAAC,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAC,MAAM,EAAE,EAAE,YAAY,EAAE,IAAI,EAAE,CAAC,CAAC;QACjF,MAAM,IAAI,GAAe,YAAY,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QACpD,MAAM,IAAI,GAAe,YAAY,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QACpD,MAAM,MAAM,GAAyB,IAAI,CAAC,IAAI,CAAC,CAAC,GAAa,EAAW,EAAE,CAAC,GAAG,CAAC,IAAI,KAAK,mBAAmB,CAAC,CAAC;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YAClE,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,KAAe;YACjC,IAAI,EAAE,OAAO,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,KAAe;YACjD,MAAM,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAA0C,EAAE,CAAC,CAAC;gBACrE,IAAI,EAAE,KAAK,CAAC,IAAI;gBAChB,KAAK,EAAE,KAAK,CAAC,KAAK,KAAK,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAE,CAAC,KAAK;aACpE,CAAC,CAAC;SACJ,CAAC,CAAC;IACL,CAAC;IACD,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC;AAC/B,CAAC;AAED;;;;;;GAMG;AACH,SAAS,cAAc,CAAC,GAAa;IACnC,IAAI,GAAG,CAAC,KAAK,KAAK,SAAS;QAAE,OAAO,GAAG,CAAC,KAAK,CAAC;IAC9C,OAAO,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAgB,EAAY,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,KAAe,EAAU,EAAE,CAAC,GAAG,KAAK,CAAC,GAAG,IAAI,cAAc,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;AACvJ,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -10,6 +10,7 @@ export * from './context/index.js';
|
|
|
10
10
|
export * from './store/index.js';
|
|
11
11
|
export * from './pipelines/index.js';
|
|
12
12
|
export * from './pacs/index.js';
|
|
13
|
+
export * from './dicom/index.js';
|
|
13
14
|
export * from './retrieve/watch.js';
|
|
14
15
|
export * from './vfs/index.js';
|
|
15
16
|
export * from './tags/index.js';
|
package/dist/index.js
CHANGED
|
@@ -27,6 +27,7 @@ __exportStar(require("./context/index.js"), exports);
|
|
|
27
27
|
__exportStar(require("./store/index.js"), exports);
|
|
28
28
|
__exportStar(require("./pipelines/index.js"), exports);
|
|
29
29
|
__exportStar(require("./pacs/index.js"), exports);
|
|
30
|
+
__exportStar(require("./dicom/index.js"), exports);
|
|
30
31
|
__exportStar(require("./retrieve/watch.js"), exports);
|
|
31
32
|
__exportStar(require("./vfs/index.js"), exports);
|
|
32
33
|
__exportStar(require("./tags/index.js"), exports);
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;;;;;;;;;AAEH,mDAAiC;AACjC,qDAAmC;AACnC,mDAAiC;AACjC,qDAAmC;AACnC,qDAAmC;AACnC,mDAAiC;AACjC,uDAAqC;AACrC,kDAAgC;AAChC,sDAAoC;AACpC,iDAA+B;AAC/B,kDAAgC;AAChC,oDAAkC;AAClC,yDAAuC;AACvC,6DAA2C;AAC3C,uDAAqC;AACrC,qDAAmC;AACnC,kDAAgC;AAChC,mDAAiC;AACjC,mDAAygB;AAAhgB,4GAAA,iBAAiB,OAAA;AAAE,8GAAA,mBAAmB,OAAA;AAAE,sHAAA,2BAA2B,OAAA;AAAE,6GAAA,kBAAkB,OAAA;AAAE,8GAAA,mBAAmB,OAAA;AAAE,6GAAA,kBAAkB,OAAA;AAAE,gHAAA,qBAAqB,OAAA;AAAE,qHAAA,0BAA0B,OAAA;AAAE,sHAAA,2BAA2B,OAAA;AAAE,gHAAA,qBAAqB,OAAA;AAA8B,0GAAA,eAAe,OAAA;AAAE,6GAAA,kBAAkB,OAAA;AAAE,yGAAA,cAAc,OAAA;AAAE,+GAAA,oBAAoB,OAAA;AAAE,0GAAA,eAAe,OAAA;AAAE,+GAAA,oBAAoB,OAAA;AAAE,8GAAA,mBAAmB,OAAA;AAAE,+GAAA,oBAAoB,OAAA;AAAE,0GAAA,eAAe,OAAA;AAAE,8GAAA,mBAAmB,OAAA;AAAE,iHAA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iB,OAAA;AAE3C,mDAAyE;AAAhE,gHAAA,gBAAgB,OAAA;AAAE,iHAAA,iBAAiB,OAAA;AAC5C,iDAAyD;AAAhD,mHAAA,oBAAoB,OAAA"}
|
package/dist/retrieve/watch.d.ts
CHANGED
|
@@ -26,6 +26,9 @@ export type RetrieveProgressStatus = 'running' | 'done' | 'unconfirmed' | 'error
|
|
|
26
26
|
* @property actualFiles - Most recent file count from LONK progress updates.
|
|
27
27
|
* @property lastProgressFiles - `actualFiles` at the last progress tick (stall detection).
|
|
28
28
|
* @property lastProgressTime - Timestamp of the last progress tick.
|
|
29
|
+
* @property firstFileTime - When this series' first file arrived; 0 while it
|
|
30
|
+
* is still waiting its turn. The long stop counts from here, so a series
|
|
31
|
+
* queued behind a dozen others is not charged for the wait.
|
|
29
32
|
* @property startTime - Timestamp when the retrieve was fired.
|
|
30
33
|
* @property lonkConfirmed - True only after an explicit LONK `done` or a storage confirmation.
|
|
31
34
|
* @property cubePathDir - CUBE folder the series landed in (resolved post-pull).
|
|
@@ -42,6 +45,7 @@ export interface RetrieveTask {
|
|
|
42
45
|
actualFiles: number;
|
|
43
46
|
lastProgressFiles: number;
|
|
44
47
|
lastProgressTime: number;
|
|
48
|
+
firstFileTime: number;
|
|
45
49
|
startTime: number;
|
|
46
50
|
lonkConfirmed: boolean;
|
|
47
51
|
cubePathDir: string | null;
|
package/dist/retrieve/watch.js
CHANGED
|
@@ -62,6 +62,7 @@ function retrieveTask_make(info) {
|
|
|
62
62
|
actualFiles: 0,
|
|
63
63
|
lastProgressFiles: 0,
|
|
64
64
|
lastProgressTime: Date.now(),
|
|
65
|
+
firstFileTime: 0,
|
|
65
66
|
startTime: 0,
|
|
66
67
|
lonkConfirmed: false,
|
|
67
68
|
cubePathDir: null,
|
|
@@ -240,6 +241,11 @@ async function retrieve_fireAndWatch(tasks, pacsserver, client, events = {}, pha
|
|
|
240
241
|
await new Promise((resolve) => {
|
|
241
242
|
let resolved = false;
|
|
242
243
|
let reconnectsLeft = WATCH_RECONNECT_ATTEMPTS;
|
|
244
|
+
// When this watch last saw life from the PACS, on ANY of its series.
|
|
245
|
+
// Quiet is a property of the watch, not of each series: a PACS busy
|
|
246
|
+
// sending the first series has not gone silent on the ten queued
|
|
247
|
+
// behind it, and they cannot report files they have not been sent yet.
|
|
248
|
+
let lastActivityAt = Date.now();
|
|
243
249
|
const done = () => {
|
|
244
250
|
if (resolved)
|
|
245
251
|
return;
|
|
@@ -290,6 +296,9 @@ async function retrieve_fireAndWatch(tasks, pacsserver, client, events = {}, pha
|
|
|
290
296
|
return;
|
|
291
297
|
}
|
|
292
298
|
ws = replacement;
|
|
299
|
+
// A reconnection is a new view, not new silence: charging the
|
|
300
|
+
// gap to the PACS would declare the study dead on reconnect.
|
|
301
|
+
lastActivityAt = Date.now();
|
|
293
302
|
socket_listen();
|
|
294
303
|
})
|
|
295
304
|
.catch(() => socket_replace());
|
|
@@ -302,17 +311,27 @@ async function retrieve_fireAndWatch(tasks, pacsserver, client, events = {}, pha
|
|
|
302
311
|
continue;
|
|
303
312
|
}
|
|
304
313
|
allTerminal = false;
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
emit(t, 'timeout');
|
|
308
|
-
continue;
|
|
309
|
-
}
|
|
314
|
+
// A series that began and then stopped is stalled on its own
|
|
315
|
+
// evidence: it was being sent, and it no longer is.
|
|
310
316
|
if (t.actualFiles > 0 && now - t.lastProgressTime > STALL_TIMEOUT_MS) {
|
|
311
317
|
t.status = 'stalled';
|
|
312
318
|
emit(t, 'stalled');
|
|
313
319
|
continue;
|
|
314
320
|
}
|
|
315
|
-
|
|
321
|
+
// The long stop: a series that trickles and never ends. Counted
|
|
322
|
+
// from its first file, never from the fire, so waiting a turn in a
|
|
323
|
+
// large study costs a series nothing.
|
|
324
|
+
if (t.firstFileTime > 0 && now - t.firstFileTime > SERIES_TIMEOUT_MS) {
|
|
325
|
+
t.status = 'timeout';
|
|
326
|
+
emit(t, 'timeout');
|
|
327
|
+
continue;
|
|
328
|
+
}
|
|
329
|
+
// Nothing has arrived for this series. That is evidence of a lost
|
|
330
|
+
// retrieve only when nothing has arrived for ANY of them. Charged
|
|
331
|
+
// per series from its own fire time, this declared every series
|
|
332
|
+
// after the first few dead fifteen seconds into any study large
|
|
333
|
+
// enough that the PACS served them in turn.
|
|
334
|
+
if (t.startTime > 0 && t.actualFiles === 0 && now - lastActivityAt > NO_ACTIVITY_TIMEOUT_MS) {
|
|
316
335
|
t.status = 'pulled';
|
|
317
336
|
t.lonkConfirmed = false;
|
|
318
337
|
emit(t, 'unconfirmed');
|
|
@@ -334,11 +353,14 @@ async function retrieve_fireAndWatch(tasks, pacsserver, client, events = {}, pha
|
|
|
334
353
|
const t = taskByUID.get(seriesUID);
|
|
335
354
|
if (!t)
|
|
336
355
|
return;
|
|
356
|
+
lastActivityAt = Date.now();
|
|
337
357
|
if ('ndicom' in message && typeof message.ndicom === 'number') {
|
|
338
358
|
const n = message.ndicom;
|
|
339
359
|
t.actualFiles = n;
|
|
340
360
|
t.lastProgressFiles = n;
|
|
341
361
|
t.lastProgressTime = Date.now();
|
|
362
|
+
if (t.firstFileTime === 0 && n > 0)
|
|
363
|
+
t.firstFileTime = t.lastProgressTime;
|
|
342
364
|
if (t.status === 'pending')
|
|
343
365
|
t.status = 'pulling';
|
|
344
366
|
emit(t, 'running');
|
|
@@ -410,6 +432,7 @@ async function retrieve_confirmLoop(allTasks, retryMax, pacsserver, client, even
|
|
|
410
432
|
t.actualFiles = 0;
|
|
411
433
|
t.lastProgressFiles = 0;
|
|
412
434
|
t.lastProgressTime = Date.now();
|
|
435
|
+
t.firstFileTime = 0;
|
|
413
436
|
t.startTime = 0;
|
|
414
437
|
t.lonkConfirmed = false;
|
|
415
438
|
t.syntheticQueryId = null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"watch.js","sourceRoot":"","sources":["../../src/retrieve/watch.ts"],"names":[],"mappings":";;;;;AA+HA,8CAmBC;AAQD,8DAKC;AAUD,gEAeC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CAAC,CAAC,gBAAgB,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;YAChC,CAAC,CAAC,aAAa,GAAG,CAAC,CAAC;YACpB,CAAC,CAAC,SAAS,GAAG,CAAC,CAAC;YAChB,CAAC,CAAC,aAAa,GAAG,KAAK,CAAC;YACxB,CAAC,CAAC,gBAAgB,GAAG,IAAI,CAAC;YAC1B,CAAC,CAAC,UAAU,GAAG,IAAI,CAAC;YACpB,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC,EAAE,SAAS,EAAE,UAAU,CAAC,CAAC;QAC1C,CAAC;QAED,iBAAiB,IAAI,MAAM,qBAAqB,CAAC,eAAe,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,CAAC,CAAC;QAE1G,eAAe,GAAG,eAAe,CAAC,MAAM,CACtC,CAAC,CAAe,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,KAAK,QAAQ,IAAI,CAAC,CAAC,CAAC,aAAa,CAC/D,CAAC;IACJ,CAAC;IAED,KAAK,MAAM,CAAC,IAAI,eAAe,EAAE,CAAC;QAChC,CAAC,CAAC,MAAM,GAAG,OAAO,CAAC;QACnB,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC,EAAE,OAAO,EAAE,UAAU,CAAC,CAAC;IACxC,CAAC;IACD,OAAO,iBAAiB,CAAC;AAC3B,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fnndsc/salsa",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.16.0",
|
|
4
4
|
"description": "Shared Application Logic and Service Assets for ChRIS",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -56,11 +56,13 @@
|
|
|
56
56
|
},
|
|
57
57
|
"overrides": {
|
|
58
58
|
"glob": "^10.0.0",
|
|
59
|
-
"inflight": "npm:@aashutoshrathi/word-wrap@^1.2.6"
|
|
59
|
+
"inflight": "npm:@aashutoshrathi/word-wrap@^1.2.6",
|
|
60
|
+
"adm-zip": "npm:empty-npm-package@1.0.0"
|
|
60
61
|
},
|
|
61
62
|
"dependencies": {
|
|
62
|
-
"@fnndsc/cumin": "^3.21.
|
|
63
|
+
"@fnndsc/cumin": "^3.21.1",
|
|
63
64
|
"axios": "^1.6.8",
|
|
65
|
+
"dcmjs": "^0.52.0",
|
|
64
66
|
"ws": "^8.21.0"
|
|
65
67
|
}
|
|
66
68
|
}
|