@fnndsc/salsa 4.5.6 → 4.6.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/README.md +0 -2
- package/dist/compute/index.d.ts +0 -9
- package/dist/compute/index.js +0 -16
- package/dist/compute/index.js.map +1 -1
- package/dist/dag/feedData.js +166 -73
- package/dist/dag/feedData.js.map +1 -1
- package/dist/dag/feedLoad.d.ts +1 -1
- package/dist/dag/feedLoad.js +6 -4
- package/dist/dag/feedLoad.js.map +1 -1
- package/dist/dicom/pixels.js +95 -36
- package/dist/dicom/pixels.js.map +1 -1
- package/dist/dicom/series.d.ts +4 -1
- package/dist/dicom/series.js +80 -31
- package/dist/dicom/series.js.map +1 -1
- package/dist/dicom/tags.d.ts +28 -0
- package/dist/dicom/tags.js +30 -0
- package/dist/dicom/tags.js.map +1 -1
- package/dist/files/copy.d.ts +197 -0
- package/dist/files/copy.js +636 -0
- package/dist/files/copy.js.map +1 -0
- package/dist/files/copyFolder.d.ts +103 -0
- package/dist/files/copyFolder.js +199 -0
- package/dist/files/copyFolder.js.map +1 -0
- package/dist/files/create.d.ts +178 -0
- package/dist/files/create.js +444 -0
- package/dist/files/create.js.map +1 -0
- package/dist/files/download.d.ts +188 -0
- package/dist/files/download.js +541 -0
- package/dist/files/download.js.map +1 -0
- package/dist/files/index.d.ts +69 -141
- package/dist/files/index.js +184 -535
- package/dist/files/index.js.map +1 -1
- package/dist/files/listing.d.ts +132 -0
- package/dist/files/listing.js +179 -0
- package/dist/files/listing.js.map +1 -0
- package/dist/files/move.d.ts +125 -0
- package/dist/files/move.js +334 -0
- package/dist/files/move.js.map +1 -0
- package/dist/files/pathMapper.d.ts +24 -1
- package/dist/files/pathMapper.js +108 -47
- package/dist/files/pathMapper.js.map +1 -1
- package/dist/files/proof.d.ts +315 -0
- package/dist/files/proof.js +574 -0
- package/dist/files/proof.js.map +1 -0
- package/dist/files/removal.d.ts +223 -0
- package/dist/files/removal.js +318 -0
- package/dist/files/removal.js.map +1 -0
- package/dist/files/replace.d.ts +175 -0
- package/dist/files/replace.js +582 -0
- package/dist/files/replace.js.map +1 -0
- package/dist/files/upload.d.ts +205 -0
- package/dist/files/upload.js +478 -0
- package/dist/files/upload.js.map +1 -0
- package/dist/index.d.ts +14 -2
- package/dist/index.js +45 -32
- package/dist/index.js.map +1 -1
- package/dist/jobs/index.d.ts +1 -1
- package/dist/jobs/index.js +2 -2
- package/dist/jobs/index.js.map +1 -1
- package/dist/jobs/jobOps.d.ts +20 -13
- package/dist/jobs/jobOps.js +41 -37
- package/dist/jobs/jobOps.js.map +1 -1
- package/dist/pacs/anonymise.d.ts +17 -36
- package/dist/pacs/anonymise.js +29 -67
- package/dist/pacs/anonymise.js.map +1 -1
- package/dist/pipelines/index.d.ts +1 -13
- package/dist/pipelines/index.js +0 -38
- package/dist/pipelines/index.js.map +1 -1
- package/dist/pipelines/invocation.js +321 -167
- package/dist/pipelines/invocation.js.map +1 -1
- package/dist/pipelines/manifest.js.map +1 -1
- package/dist/pipelines/packages.d.ts +11 -8
- package/dist/pipelines/packages.js +253 -77
- package/dist/pipelines/packages.js.map +1 -1
- package/dist/plugins/adminToken.d.ts +67 -0
- package/dist/plugins/adminToken.js +77 -0
- package/dist/plugins/adminToken.js.map +1 -0
- package/dist/plugins/index.d.ts +0 -7
- package/dist/plugins/index.js +0 -16
- package/dist/plugins/index.js.map +1 -1
- package/dist/plugins/peer_search.d.ts +0 -15
- package/dist/plugins/peer_search.js +0 -25
- package/dist/plugins/peer_search.js.map +1 -1
- package/dist/plugins/plugin_add.d.ts +14 -2
- package/dist/plugins/plugin_add.js +42 -13
- package/dist/plugins/plugin_add.js.map +1 -1
- package/dist/plugins/plugin_docker.d.ts +25 -0
- package/dist/plugins/plugin_docker.js +33 -0
- package/dist/plugins/plugin_docker.js.map +1 -1
- package/dist/plugins/plugin_register.d.ts +0 -10
- package/dist/plugins/plugin_register.js +3 -54
- package/dist/plugins/plugin_register.js.map +1 -1
- package/dist/plugins/plugin_sync.js +45 -22
- package/dist/plugins/plugin_sync.js.map +1 -1
- package/dist/plugins/plugin_validate.js +47 -13
- package/dist/plugins/plugin_validate.js.map +1 -1
- package/dist/plugins/store_import.d.ts +0 -9
- package/dist/plugins/store_import.js +3 -29
- package/dist/plugins/store_import.js.map +1 -1
- package/dist/retrieve/task.d.ts +137 -0
- package/dist/retrieve/task.js +41 -0
- package/dist/retrieve/task.js.map +1 -0
- package/dist/retrieve/watch.d.ts +2 -118
- package/dist/retrieve/watch.js +452 -321
- package/dist/retrieve/watch.js.map +1 -1
- package/dist/vfs/providers/etc.d.ts +6 -4
- package/dist/vfs/providers/etc.js +12 -4
- package/dist/vfs/providers/etc.js.map +1 -1
- package/dist/vfs/providers/native.d.ts +116 -39
- package/dist/vfs/providers/native.js +291 -347
- package/dist/vfs/providers/native.js.map +1 -1
- package/dist/vfs/providers/pacs.d.ts +29 -3
- package/dist/vfs/providers/pacs.js +303 -73
- package/dist/vfs/providers/pacs.js.map +1 -1
- package/dist/vfs/providers/pacs_content.js +22 -6
- package/dist/vfs/providers/pacs_content.js.map +1 -1
- package/dist/vfs/providers/proc/backfill.d.ts +46 -0
- package/dist/vfs/providers/proc/backfill.js +147 -0
- package/dist/vfs/providers/proc/backfill.js.map +1 -0
- package/dist/vfs/providers/proc/book.d.ts +176 -0
- package/dist/vfs/providers/proc/book.js +73 -0
- package/dist/vfs/providers/proc/book.js.map +1 -0
- package/dist/vfs/providers/proc/catchup.d.ts +69 -0
- package/dist/vfs/providers/proc/catchup.js +125 -0
- package/dist/vfs/providers/proc/catchup.js.map +1 -0
- package/dist/vfs/providers/proc/feedIndex.d.ts +146 -0
- package/dist/vfs/providers/proc/feedIndex.js +354 -0
- package/dist/vfs/providers/proc/feedIndex.js.map +1 -0
- package/dist/vfs/providers/proc/feedTopology.d.ts +85 -0
- package/dist/vfs/providers/proc/feedTopology.js +192 -0
- package/dist/vfs/providers/proc/feedTopology.js.map +1 -0
- package/dist/vfs/providers/proc/locate.d.ts +60 -0
- package/dist/vfs/providers/proc/locate.js +103 -0
- package/dist/vfs/providers/proc/locate.js.map +1 -0
- package/dist/vfs/providers/proc/path.d.ts +50 -0
- package/dist/vfs/providers/proc/path.js +106 -0
- package/dist/vfs/providers/proc/path.js.map +1 -0
- package/dist/vfs/providers/proc/roster.d.ts +95 -0
- package/dist/vfs/providers/proc/roster.js +425 -0
- package/dist/vfs/providers/proc/roster.js.map +1 -0
- package/dist/vfs/providers/proc/rows.d.ts +120 -0
- package/dist/vfs/providers/proc/rows.js +181 -0
- package/dist/vfs/providers/proc/rows.js.map +1 -0
- package/dist/vfs/providers/proc/subtree.d.ts +73 -0
- package/dist/vfs/providers/proc/subtree.js +125 -0
- package/dist/vfs/providers/proc/subtree.js.map +1 -0
- package/dist/vfs/providers/proc/sweep.d.ts +89 -0
- package/dist/vfs/providers/proc/sweep.js +297 -0
- package/dist/vfs/providers/proc/sweep.js.map +1 -0
- package/dist/vfs/providers/proc.d.ts +47 -346
- package/dist/vfs/providers/proc.js +349 -1806
- package/dist/vfs/providers/proc.js.map +1 -1
- package/dist/vfs/providers/share.js +4 -1
- package/dist/vfs/providers/share.js.map +1 -1
- package/package.json +3 -3
- package/dist/pacs/resultDecode.d.ts +0 -13
- package/dist/pacs/resultDecode.js +0 -19
- package/dist/pacs/resultDecode.js.map +0 -1
package/dist/dicom/series.js
CHANGED
|
@@ -19,7 +19,10 @@ exports.dicomSeries_summarize = dicomSeries_summarize;
|
|
|
19
19
|
* deferred to it.
|
|
20
20
|
*
|
|
21
21
|
* Headers read once are kept, keyed by path, so a tag listing that follows
|
|
22
|
-
* a scroll costs nothing on the second visit.
|
|
22
|
+
* a scroll costs nothing on the second visit. They are what one identity
|
|
23
|
+
* was able to read: emptied when the identity changes, and neither read
|
|
24
|
+
* nor kept by work done as another user (`sudo`) or begun under an
|
|
25
|
+
* identity since replaced.
|
|
23
26
|
*
|
|
24
27
|
* @module
|
|
25
28
|
*/
|
|
@@ -44,7 +47,8 @@ const headerCache = new Map();
|
|
|
44
47
|
* @returns The tag set, or an error when the file could not be read or parsed.
|
|
45
48
|
*/
|
|
46
49
|
async function dicomHeader_get(path, io = exports.dicomFolderIO_default) {
|
|
47
|
-
const
|
|
50
|
+
const began = (0, cumin_1.identityEpoch_get)();
|
|
51
|
+
const cached = (0, cumin_1.identityCache_usable)() ? headerCache.get(path) : undefined;
|
|
48
52
|
if (cached !== undefined)
|
|
49
53
|
return (0, cumin_1.Ok)(cached);
|
|
50
54
|
const bytes = await io.readBinary(path);
|
|
@@ -53,6 +57,9 @@ async function dicomHeader_get(path, io = exports.dicomFolderIO_default) {
|
|
|
53
57
|
const parsed = (0, tags_js_1.dicomTags_read)(bytes.value);
|
|
54
58
|
if (!parsed.ok)
|
|
55
59
|
return (0, cumin_1.Err)();
|
|
60
|
+
// Kept only for the identity the read was made as, while it is still the one connected.
|
|
61
|
+
if (!(0, cumin_1.identityCache_usable)() || began !== (0, cumin_1.identityEpoch_get)())
|
|
62
|
+
return parsed;
|
|
56
63
|
if (headerCache.size >= HEADER_CACHE_LIMIT) {
|
|
57
64
|
const oldest = headerCache.keys().next().value;
|
|
58
65
|
if (oldest !== undefined)
|
|
@@ -105,6 +112,8 @@ async function dicomHeaderPrefix_get(path) {
|
|
|
105
112
|
function dicomHeaderCache_clear() {
|
|
106
113
|
headerCache.clear();
|
|
107
114
|
}
|
|
115
|
+
// A header is what one identity could read: at a change of identity every one goes.
|
|
116
|
+
(0, cumin_1.identityChange_listen)(() => { headerCache.clear(); });
|
|
108
117
|
/**
|
|
109
118
|
* Lists a folder's DICOM files in stack order.
|
|
110
119
|
*
|
|
@@ -167,9 +176,30 @@ async function dicomSeries_summarize(folder, options = {}, io = exports.dicomFol
|
|
|
167
176
|
const header = await dicomHeader_get(files[0].path, io);
|
|
168
177
|
if (!header.ok)
|
|
169
178
|
return (0, cumin_1.Err)();
|
|
170
|
-
const
|
|
179
|
+
const summary = seriesSummary_build(folder, listed.value, header.value);
|
|
180
|
+
const seriesInstanceUID = summary.seriesInstanceUID;
|
|
181
|
+
if (options.annotationRoot !== undefined && seriesInstanceUID !== undefined) {
|
|
182
|
+
const found = await seriesAnnotations_list(options.annotationRoot, seriesInstanceUID, io);
|
|
183
|
+
if (found !== null)
|
|
184
|
+
summary.annotations = found;
|
|
185
|
+
}
|
|
186
|
+
return (0, cumin_1.Ok)(summary);
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* A series summary from its listing and its first file's header, before
|
|
190
|
+
* any annotations are looked for: what the header does not say is left
|
|
191
|
+
* out, or defaulted (modality OT, no description, one frame).
|
|
192
|
+
*
|
|
193
|
+
* @param folder - The folder's VFS path.
|
|
194
|
+
* @param listing - The folder's DICOM files in stack order; at least one.
|
|
195
|
+
* @param header - The first file's header.
|
|
196
|
+
* @returns The summary, its annotations empty.
|
|
197
|
+
*/
|
|
198
|
+
function seriesSummary_build(folder, listing, header) {
|
|
199
|
+
const files = listing.files;
|
|
200
|
+
const tags = header.tags;
|
|
171
201
|
const seriesInstanceUID = tagText_find(tags, 'SeriesInstanceUID');
|
|
172
|
-
|
|
202
|
+
return {
|
|
173
203
|
path: folder,
|
|
174
204
|
...(seriesInstanceUID !== undefined ? { seriesInstanceUID } : {}),
|
|
175
205
|
...(tagText_find(tags, 'StudyInstanceUID') !== undefined ? { studyInstanceUID: tagText_find(tags, 'StudyInstanceUID') } : {}),
|
|
@@ -178,40 +208,59 @@ async function dicomSeries_summarize(folder, options = {}, io = exports.dicomFol
|
|
|
178
208
|
...(tagNumber_find(tags, 'SeriesNumber') !== undefined ? { seriesNumber: tagNumber_find(tags, 'SeriesNumber') } : {}),
|
|
179
209
|
instances: files.length,
|
|
180
210
|
frames: tagNumber_find(tags, 'NumberOfFrames') ?? 1,
|
|
181
|
-
order:
|
|
211
|
+
order: listing.order,
|
|
182
212
|
...(geometry_extract(tags) !== undefined ? { geometry: geometry_extract(tags) } : {}),
|
|
183
|
-
...(header.
|
|
184
|
-
? {
|
|
185
|
-
transferSyntax: {
|
|
186
|
-
uid: header.value.transferSyntaxUID,
|
|
187
|
-
...(dictionary_js_1.TRANSFER_SYNTAX_NAMES[header.value.transferSyntaxUID] !== undefined ? { name: dictionary_js_1.TRANSFER_SYNTAX_NAMES[header.value.transferSyntaxUID] } : {}),
|
|
188
|
-
},
|
|
189
|
-
}
|
|
190
|
-
: {}),
|
|
213
|
+
...transferSyntaxField_build(header.transferSyntaxUID),
|
|
191
214
|
bytes: files.reduce((total, file) => total + file.size, 0),
|
|
192
215
|
header: files[0].path,
|
|
193
216
|
files: files.map((file) => file.path),
|
|
194
217
|
annotations: [],
|
|
195
218
|
};
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
219
|
+
}
|
|
220
|
+
/**
|
|
221
|
+
* A summary's transfer syntax field: its UID, and its name when the
|
|
222
|
+
* dictionary has one; nothing when the header carries no file meta.
|
|
223
|
+
*
|
|
224
|
+
* @param uid - The header's transfer syntax UID, if any.
|
|
225
|
+
* @returns The field to spread into a summary, or an empty object.
|
|
226
|
+
*/
|
|
227
|
+
function transferSyntaxField_build(uid) {
|
|
228
|
+
if (uid === undefined)
|
|
229
|
+
return {};
|
|
230
|
+
return {
|
|
231
|
+
transferSyntax: {
|
|
232
|
+
uid,
|
|
233
|
+
...(dictionary_js_1.TRANSFER_SYNTAX_NAMES[uid] !== undefined ? { name: dictionary_js_1.TRANSFER_SYNTAX_NAMES[uid] } : {}),
|
|
234
|
+
},
|
|
235
|
+
};
|
|
236
|
+
}
|
|
237
|
+
/**
|
|
238
|
+
* A series' annotation files, under a folder named by its UID below the
|
|
239
|
+
* annotation root.
|
|
240
|
+
*
|
|
241
|
+
* Most series have no annotations, and the folder that would hold them
|
|
242
|
+
* does not exist. Asking is how we find out — so the listing's failure is
|
|
243
|
+
* an ANSWER here, not a fault: left on the stack it made a perfectly good
|
|
244
|
+
* `dcm series` readout exit non-zero, which stopped any manifest that read
|
|
245
|
+
* a header.
|
|
246
|
+
*
|
|
247
|
+
* @param annotationRoot - Where annotations are kept, with or without a trailing slash.
|
|
248
|
+
* @param seriesInstanceUID - The series.
|
|
249
|
+
* @param io - The folder reader.
|
|
250
|
+
* @returns The files' paths, sorted, or null when the folder could not be listed.
|
|
251
|
+
*/
|
|
252
|
+
async function seriesAnnotations_list(annotationRoot, seriesInstanceUID, io) {
|
|
253
|
+
const root = annotationRoot.endsWith('/') ? annotationRoot.slice(0, -1) : annotationRoot;
|
|
254
|
+
const mark = cumin_1.errorStack.checkpoint_mark();
|
|
255
|
+
const found = await io.list(`${root}/${seriesInstanceUID}`);
|
|
256
|
+
if (!found.ok) {
|
|
257
|
+
cumin_1.errorStack.checkpoint_drain(mark);
|
|
258
|
+
return null;
|
|
213
259
|
}
|
|
214
|
-
return
|
|
260
|
+
return found.value
|
|
261
|
+
.filter((item) => item.type === 'file')
|
|
262
|
+
.map((item) => `${root}/${seriesInstanceUID}/${item.name}`)
|
|
263
|
+
.sort();
|
|
215
264
|
}
|
|
216
265
|
/**
|
|
217
266
|
* A tag's text, or nothing when absent or empty.
|
package/dist/dicom/series.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"series.js","sourceRoot":"","sources":["../../src/dicom/series.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"series.js","sourceRoot":"","sources":["../../src/dicom/series.ts"],"names":[],"mappings":";;;AAmGA,0CAgBC;AAaD,sDAuBC;AAKD,wDAEC;AAgBD,4CAeC;AAUD,8CAQC;AAWD,sDAkBC;AA5OD;;;;;;;;;;;;;;;;;;GAkBG;AACH,yCAAiI;AACjI,wDAAqD;AAErD,gDAAuF;AACvF,mDAAwD;AACxD,uCAA2F;AAQ3F,mEAAmE;A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C,CAAC;IACvE,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;QAC1B,MAAM,KAAK,GAAa,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;QACxD,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,IAAI,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC;YAAE,QAAQ,CAAC,YAAY,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;IACvG,CAAC;IACD,MAAM,SAAS,GAAuB,cAAc,CAAC,IAAI,EAAE,gBAAgB,CAAC,CAAC;IAC7E,IAAI,SAAS,KAAK,SAAS;QAAE,QAAQ,CAAC,cAAc,GAAG,SAAS,CAAC;IACjE,MAAM,OAAO,GAAuB,cAAc,CAAC,IAAI,EAAE,sBAAsB,CAAC,CAAC;IACjF,IAAI,OAAO,KAAK,SAAS;QAAE,QAAQ,CAAC,oBAAoB,GAAG,OAAO,CAAC;IACnE,OAAO,QAAQ,CAAC;AAClB,CAAC"}
|
package/dist/dicom/tags.d.ts
CHANGED
|
@@ -81,3 +81,31 @@ export declare function dicomTags_summarize(files: Array<{
|
|
|
81
81
|
path: string;
|
|
82
82
|
tags: DicomTagSet;
|
|
83
83
|
}>): DicomTagsSummary;
|
|
84
|
+
/**
|
|
85
|
+
* What the DICOM dictionary says of a key.
|
|
86
|
+
*
|
|
87
|
+
* @example
|
|
88
|
+
* ```ts
|
|
89
|
+
* const entry: DicomKeyEntry = { name: 'FrameOfReferenceUID', vr: 'UI' };
|
|
90
|
+
* ```
|
|
91
|
+
*/
|
|
92
|
+
export interface DicomKeyEntry {
|
|
93
|
+
/** The keyword. */
|
|
94
|
+
readonly name: string;
|
|
95
|
+
/** The value representation. */
|
|
96
|
+
readonly vr: string;
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* What the DICOM dictionary says of a key: its keyword and its VR. A key is
|
|
100
|
+
* a keyword (`FrameOfReferenceUID`) or a tag in any of the spellings a
|
|
101
|
+
* question uses (`00200052`, `0020,0052`, `(0020,0052)`).
|
|
102
|
+
*
|
|
103
|
+
* @param key - The key, as typed.
|
|
104
|
+
* @returns The keyword and VR, or null when the dictionary does not know it.
|
|
105
|
+
*
|
|
106
|
+
* @example
|
|
107
|
+
* ```ts
|
|
108
|
+
* dicomKey_describe('(0020,0052)'); // { name: 'FrameOfReferenceUID', vr: 'UI' }
|
|
109
|
+
* ```
|
|
110
|
+
*/
|
|
111
|
+
export declare function dicomKey_describe(key: string): DicomKeyEntry | null;
|
package/dist/dicom/tags.js
CHANGED
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.dicomTags_read = dicomTags_read;
|
|
7
7
|
exports.dicomTag_find = dicomTag_find;
|
|
8
8
|
exports.dicomTags_summarize = dicomTags_summarize;
|
|
9
|
+
exports.dicomKey_describe = dicomKey_describe;
|
|
9
10
|
/**
|
|
10
11
|
* @file DICOM tag reading: one parser for every surface.
|
|
11
12
|
*
|
|
@@ -238,4 +239,33 @@ function tag_comparable(tag) {
|
|
|
238
239
|
return tag.value;
|
|
239
240
|
return JSON.stringify(tag.items.map((item) => item.map((inner) => `${inner.tag}=${tag_comparable(inner)}`)));
|
|
240
241
|
}
|
|
242
|
+
/** A tag written as eight hex digits, with or without its comma. */
|
|
243
|
+
const TAG_HEX = /^([0-9a-fA-F]{4}),?([0-9a-fA-F]{4})$/;
|
|
244
|
+
/**
|
|
245
|
+
* What the DICOM dictionary says of a key: its keyword and its VR. A key is
|
|
246
|
+
* a keyword (`FrameOfReferenceUID`) or a tag in any of the spellings a
|
|
247
|
+
* question uses (`00200052`, `0020,0052`, `(0020,0052)`).
|
|
248
|
+
*
|
|
249
|
+
* @param key - The key, as typed.
|
|
250
|
+
* @returns The keyword and VR, or null when the dictionary does not know it.
|
|
251
|
+
*
|
|
252
|
+
* @example
|
|
253
|
+
* ```ts
|
|
254
|
+
* dicomKey_describe('(0020,0052)'); // { name: 'FrameOfReferenceUID', vr: 'UI' }
|
|
255
|
+
* ```
|
|
256
|
+
*/
|
|
257
|
+
function dicomKey_describe(key) {
|
|
258
|
+
const hex = TAG_HEX.exec(key.replace(/[\s()]/g, ''));
|
|
259
|
+
const dictionary = dcmjs_1.default.data.DicomMetaDictionary;
|
|
260
|
+
return dictionaryEntry_read(hex === null ? dictionary.nameMap[key] : dictionary.dictionary[`(${hex[1].toUpperCase()},${hex[2].toUpperCase()})`]);
|
|
261
|
+
}
|
|
262
|
+
/**
|
|
263
|
+
* A dictionary entry as a key's description, or null for none.
|
|
264
|
+
*
|
|
265
|
+
* @param entry - What the dictionary held under the key, if anything.
|
|
266
|
+
* @returns The keyword and VR, or null.
|
|
267
|
+
*/
|
|
268
|
+
function dictionaryEntry_read(entry) {
|
|
269
|
+
return entry === undefined ? null : { name: entry.name, vr: entry.vr };
|
|
270
|
+
}
|
|
241
271
|
//# sourceMappingURL=tags.js.map
|
package/dist/dicom/tags.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tags.js","sourceRoot":"","sources":["../../src/dicom/tags.ts"],"names":[],"mappings":";;;;;AAoFA,wCAiBC;AA+GD,sCAEC;AAcD,kDA8CC;
|
|
1
|
+
{"version":3,"file":"tags.js","sourceRoot":"","sources":["../../src/dicom/tags.ts"],"names":[],"mappings":";;;;;AAoFA,wCAiBC;AA+GD,sCAEC;AAcD,kDA8CC;AA6CD,8CAIC;AAnUD;;;;;;;;;;;;;;;GAeG;AACH,kDAA0B;AAE1B,yCAAqD;AACrD,mDAAuG;AAkDvG,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,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,CAAC,IAAI,EAAE,EAAE,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC;AACzE,CAAC"}
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file Copying inside CUBE, create-only: nothing a copy writes lands on a name something already holds.
|
|
3
|
+
*
|
|
4
|
+
* CUBE has no copy; a copy downloads each file and stores it again. Its
|
|
5
|
+
* source is proved first, fresh on the copy's one client (one folder at the
|
|
6
|
+
* path), and read whole by id: that folder's folders, files and links each
|
|
7
|
+
* read in full at its own collections, every row placed directly inside
|
|
8
|
+
* the folder it was listed in, each folder below then read by the id its
|
|
9
|
+
* row gave, never found again by a path or through the session's memo of
|
|
10
|
+
* lookups. A listing refused, one cut short, or a row that cannot be
|
|
11
|
+
* placed fails the copy before anything is written; each file's bytes are
|
|
12
|
+
* then read by the id that walk gave it, on the same client. Each source
|
|
13
|
+
* folder's names are settled as it is read, before anything is written: a
|
|
14
|
+
* holder listed twice is one, and a name distinct holders share (two
|
|
15
|
+
* files, a folder and a file) is refused and said, and nothing is copied
|
|
16
|
+
* for it, nor below it.
|
|
17
|
+
*
|
|
18
|
+
* Every destination folder is proved whole once, fresh on the copy's one
|
|
19
|
+
* client (`folderHolders_prove`), and each child the copy would write into
|
|
20
|
+
* it is refused when that proof names something at its name: it is said,
|
|
21
|
+
* and nothing is uploaded, moved or deleted for it (a folder refused takes
|
|
22
|
+
* what the source holds below it along). A child free by the proof is
|
|
23
|
+
* written create-only (`file_createProved`, `HolderClient.folder_create`):
|
|
24
|
+
* one that arrives between the proof and the write is not written over. A
|
|
25
|
+
* link in the source is said and not copied. A folder whose making CUBE did
|
|
26
|
+
* not answer, though one is there after, may not be the copy's: it is
|
|
27
|
+
* taken as held, and what the source holds below it is skipped and said.
|
|
28
|
+
*
|
|
29
|
+
* Key components:
|
|
30
|
+
* - SourceEntry: one entry of a source read whole: where it is below the source, what it is, its id.
|
|
31
|
+
* - SourceFolder: a folder of a source, by its id, its path and its name below the source.
|
|
32
|
+
* - SourceTwin, SourceTree: a name distinct holders share in a source, and a source read whole.
|
|
33
|
+
* - sourceTree_walk: read a proved source folder whole, recursively, by id.
|
|
34
|
+
* - files_copyTree: copy a folder into a destination path, create-only.
|
|
35
|
+
* - path_copy: the native mount's `cp`, on proof of the source and the destination.
|
|
36
|
+
*
|
|
37
|
+
* Typical usage:
|
|
38
|
+
* ```ts
|
|
39
|
+
* const copied: VfsOutcome = await files_copyTree('/home/ada/study', '/home/ada/study-copy');
|
|
40
|
+
* ```
|
|
41
|
+
*
|
|
42
|
+
* Dependencies: the proofs of `./proof.js` (and its placing of a listing
|
|
43
|
+
* read by id), the folder a copy goes into of `./copyFolder.js` (proved
|
|
44
|
+
* again before a file's bytes are stored), the create-only write of
|
|
45
|
+
* `./replace.js`, and cumin's
|
|
46
|
+
* `chrisIO` (a file's bytes by id, on the bound client; the session's
|
|
47
|
+
* client, bound as a `HolderClient`). Paths are absolute CUBE paths.
|
|
48
|
+
*
|
|
49
|
+
* @module
|
|
50
|
+
*/
|
|
51
|
+
import { type HolderClient, type Result } from '@fnndsc/cumin';
|
|
52
|
+
import { type CpOptions, type VfsOutcome } from '@fnndsc/fond';
|
|
53
|
+
import type { PathHolder } from './index.js';
|
|
54
|
+
import { type PathHolderRecord, type PathProof } from './proof.js';
|
|
55
|
+
/**
|
|
56
|
+
* One entry of a source read whole.
|
|
57
|
+
*
|
|
58
|
+
* @example
|
|
59
|
+
* ```ts
|
|
60
|
+
* const entry: SourceEntry = { relative: 'anat/t1.nii', kind: 'file', id: 41 };
|
|
61
|
+
* ```
|
|
62
|
+
*/
|
|
63
|
+
export interface SourceEntry {
|
|
64
|
+
/** Its name below the source folder: plain parts joined by `/`. */
|
|
65
|
+
readonly relative: string;
|
|
66
|
+
/** What it is. */
|
|
67
|
+
readonly kind: PathHolder;
|
|
68
|
+
/** Its id in CUBE, as the walk's row gave it. */
|
|
69
|
+
readonly id: number;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* One folder of a source: its id (from its proof, or the row that named
|
|
73
|
+
* it), its path, and its name below the source.
|
|
74
|
+
*
|
|
75
|
+
* @example
|
|
76
|
+
* ```ts
|
|
77
|
+
* const folder: SourceFolder = { id: 70, path: '/home/ada/study/anat', relative: 'anat' };
|
|
78
|
+
* ```
|
|
79
|
+
*/
|
|
80
|
+
export interface SourceFolder {
|
|
81
|
+
/** Its id in CUBE: every listing of it is read by this id. */
|
|
82
|
+
readonly id: number;
|
|
83
|
+
/** Its absolute path, which every row listed in it must be directly inside. */
|
|
84
|
+
readonly path: string;
|
|
85
|
+
/** Its name below the source: plain parts joined by `/`; '' for the source itself. */
|
|
86
|
+
readonly relative: string;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* A name distinct holders share in a source folder: nothing is copied for it.
|
|
90
|
+
*
|
|
91
|
+
* @example
|
|
92
|
+
* ```ts
|
|
93
|
+
* const twin: SourceTwin = { relative: 'f.txt', holders: [{ kind: 'file', id: 41, href: null }, { kind: 'file', id: 42, href: null }] };
|
|
94
|
+
* ```
|
|
95
|
+
*/
|
|
96
|
+
export interface SourceTwin {
|
|
97
|
+
/** Its name below the source folder. */
|
|
98
|
+
readonly relative: string;
|
|
99
|
+
/** Every distinct holder of the name. */
|
|
100
|
+
readonly holders: readonly PathHolderRecord[];
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* A source read whole: every entry to copy, each folder before what it
|
|
104
|
+
* holds, and every name distinct holders share.
|
|
105
|
+
*
|
|
106
|
+
* @example
|
|
107
|
+
* ```ts
|
|
108
|
+
* const tree: SourceTree = { entries: [{ relative: 'a.txt', kind: 'file', id: 41 }], twins: [] };
|
|
109
|
+
* ```
|
|
110
|
+
*/
|
|
111
|
+
export interface SourceTree {
|
|
112
|
+
/** The entries, each its name's one holder. */
|
|
113
|
+
readonly entries: SourceEntry[];
|
|
114
|
+
/** The names refused: distinct holders share each. */
|
|
115
|
+
readonly twins: SourceTwin[];
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Reads a proved source folder whole, recursively, by id on the copy's
|
|
119
|
+
* client: its folders, files and links, each listing in full and every row
|
|
120
|
+
* placed, each folder before what it holds, and each folder's names
|
|
121
|
+
* settled (a name distinct holders share is a twin, not an entry).
|
|
122
|
+
*
|
|
123
|
+
* @param acts - The client the source was proved on.
|
|
124
|
+
* @param root - The source folder, by the id its proof gave, and its absolute path.
|
|
125
|
+
* @returns Every entry below it, and every twin; Err when any listing was
|
|
126
|
+
* refused, cut short, or could not be placed (the reason stacked).
|
|
127
|
+
*
|
|
128
|
+
* @example
|
|
129
|
+
* ```ts
|
|
130
|
+
* const walked: Result<SourceTree> = await sourceTree_walk(acts, { id: 7, path: '/home/ada/study' });
|
|
131
|
+
* ```
|
|
132
|
+
*/
|
|
133
|
+
export declare function sourceTree_walk(acts: HolderClient, root: Omit<SourceFolder, 'relative'>): Promise<Result<SourceTree>>;
|
|
134
|
+
/**
|
|
135
|
+
* The folder a copy becomes: its path, what its first proof found there
|
|
136
|
+
* (nothing, or a folder to merge into), and the check asked of every path
|
|
137
|
+
* the copy writes.
|
|
138
|
+
*
|
|
139
|
+
* @example
|
|
140
|
+
* ```ts
|
|
141
|
+
* const root: CopyRoot = { path: '/home/ada/backup/study', proof: { kind: 'absent' } };
|
|
142
|
+
* ```
|
|
143
|
+
*/
|
|
144
|
+
export interface CopyRoot {
|
|
145
|
+
/** Its absolute path. */
|
|
146
|
+
readonly path: string;
|
|
147
|
+
/** What its first proof found there, carried through the walk of the source. */
|
|
148
|
+
readonly proof: PathProof;
|
|
149
|
+
/**
|
|
150
|
+
* Asked of every path the copy is about to write.
|
|
151
|
+
*
|
|
152
|
+
* @param final - The path.
|
|
153
|
+
* @returns Done when it may be written, or why not.
|
|
154
|
+
*/
|
|
155
|
+
finalPath_check?(final: string): VfsOutcome;
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* Recursively copies a folder to a destination path within ChRIS,
|
|
159
|
+
* create-only: the source proved one folder, fresh, and the destination's
|
|
160
|
+
* root proved before the source is read whole by id; each destination
|
|
161
|
+
* folder proved whole once, and each child whose name is held there
|
|
162
|
+
* refused and said.
|
|
163
|
+
*
|
|
164
|
+
* @param srcPath - The source folder's path.
|
|
165
|
+
* @param destPath - The folder it becomes (made when nothing holds it; a folder there is copied into).
|
|
166
|
+
* @param options - The check asked of every path the copy writes, its root first.
|
|
167
|
+
* @returns Done when every entry was copied; else the errno and why (a
|
|
168
|
+
* check's own refusal, `EXDEV` or `EINVAL`, as it gave it).
|
|
169
|
+
*
|
|
170
|
+
* @example
|
|
171
|
+
* ```ts
|
|
172
|
+
* const copied: VfsOutcome = await files_copyTree('/home/ada/study', '/home/ada/study-copy');
|
|
173
|
+
* ```
|
|
174
|
+
*/
|
|
175
|
+
export declare function files_copyTree(srcPath: string, destPath: string, options?: Pick<CpOptions, 'finalPath_check'>): Promise<VfsOutcome>;
|
|
176
|
+
/**
|
|
177
|
+
* Copies what holds a path (the native mount's `cp`): the source and the
|
|
178
|
+
* destination proved on one client, the final path chosen once
|
|
179
|
+
* ({@link copyTarget_settle}), never inside what is copied (`EINVAL`), and
|
|
180
|
+
* asked of the dispatcher's check before anything is written. A file is
|
|
181
|
+
* stored create-only (a file there is `EEXIST`); a folder is copied with
|
|
182
|
+
* {@link files_copyTree}'s rules, its root's first proof carried
|
|
183
|
+
* through the walk of the source.
|
|
184
|
+
*
|
|
185
|
+
* @param src - The source's absolute path.
|
|
186
|
+
* @param dest - The destination's absolute path.
|
|
187
|
+
* @param options - Whether a folder may be copied, whether the destination
|
|
188
|
+
* must be one folder, the name the copy takes in a folder, and the check
|
|
189
|
+
* of each path written.
|
|
190
|
+
* @returns Done, or why not.
|
|
191
|
+
*
|
|
192
|
+
* @example
|
|
193
|
+
* ```ts
|
|
194
|
+
* const copied: VfsOutcome = await path_copy('/home/ada/a.txt', '/home/ada/docs', { recursive: false });
|
|
195
|
+
* ```
|
|
196
|
+
*/
|
|
197
|
+
export declare function path_copy(src: string, dest: string, options: CpOptions): Promise<VfsOutcome>;
|