dwv 0.35.0-beta.9 → 0.35.1
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/assets/workers/jpeg2000.worker.min.js +2 -0
- package/dist/assets/workers/jpeg2000.worker.min.js.map +1 -0
- package/dist/assets/workers/jpegbaseline.worker.min.js +2 -0
- package/dist/assets/workers/jpegbaseline.worker.min.js.map +1 -0
- package/dist/assets/workers/jpegloss.worker.min.js +2 -0
- package/dist/assets/workers/jpegloss.worker.min.js.map +1 -0
- package/dist/assets/workers/labeling.worker.min.js +2 -0
- package/dist/assets/workers/labeling.worker.min.js.map +1 -0
- package/dist/assets/workers/rle.worker.min.js +2 -0
- package/dist/assets/workers/rle.worker.min.js.map +1 -0
- package/dist/dwv.d.ts +394 -116
- package/dist/dwv.min.js +1 -1
- package/dist/dwv.min.js.map +1 -1
- package/dist/dwv.node.min.js +2 -0
- package/dist/dwv.node.min.js.map +1 -0
- package/package.json +33 -23
- package/readme.md +1 -1
- package/decoders/dwv/decode-rle.js +0 -23
- package/decoders/dwv/rle.js +0 -129
- package/decoders/pdfjs/arithmetic_decoder.js +0 -185
- package/decoders/pdfjs/decode-jpeg2000.js +0 -18
- package/decoders/pdfjs/decode-jpegbaseline.js +0 -18
- package/decoders/pdfjs/jpg.js +0 -1072
- package/decoders/pdfjs/jpx.js +0 -2237
- package/decoders/pdfjs/readme.md +0 -14
- package/decoders/pdfjs/util.js +0 -1588
- package/decoders/rii-mango/decode-jpegloss.js +0 -34
- package/decoders/rii-mango/lossless-min.js +0 -1
- package/decoders/rii-mango/lossless.js +0 -1756
- package/decoders/rii-mango/readme.md +0 -11
package/dist/dwv.d.ts
CHANGED
|
@@ -17,19 +17,37 @@ export declare function addTagsToDictionary(group: string, tags: {
|
|
|
17
17
|
*/
|
|
18
18
|
export declare class Annotation {
|
|
19
19
|
/**
|
|
20
|
-
*
|
|
20
|
+
* Tracking id, unique within domain.
|
|
21
21
|
*
|
|
22
22
|
* @type {string}
|
|
23
23
|
*/
|
|
24
|
-
|
|
24
|
+
trackingId: string;
|
|
25
25
|
/**
|
|
26
|
-
*
|
|
26
|
+
* Tracking Unique id.
|
|
27
27
|
*
|
|
28
28
|
* @type {string}
|
|
29
29
|
*/
|
|
30
|
-
|
|
30
|
+
trackingUid: string;
|
|
31
31
|
/**
|
|
32
|
-
*
|
|
32
|
+
* Referenced image SOP isntance UID.
|
|
33
|
+
*
|
|
34
|
+
* @type {string}
|
|
35
|
+
*/
|
|
36
|
+
referencedSopInstanceUID: string;
|
|
37
|
+
/**
|
|
38
|
+
* Referenced image SOP class UID.
|
|
39
|
+
*
|
|
40
|
+
* @type {string}
|
|
41
|
+
*/
|
|
42
|
+
referencedSopClassUID: string;
|
|
43
|
+
/**
|
|
44
|
+
* Referenced frame number.
|
|
45
|
+
*
|
|
46
|
+
* @type {number|undefined}
|
|
47
|
+
*/
|
|
48
|
+
referencedFrameNumber: number | undefined;
|
|
49
|
+
/**
|
|
50
|
+
* Mathematical shape.
|
|
33
51
|
*
|
|
34
52
|
* @type {object}
|
|
35
53
|
*/
|
|
@@ -41,11 +59,11 @@ export declare class Annotation {
|
|
|
41
59
|
*/
|
|
42
60
|
referencePoints: Point2D[] | undefined;
|
|
43
61
|
/**
|
|
44
|
-
*
|
|
62
|
+
* Colour: for example 'green', '#00ff00' or 'rgb(0,255,0)'.
|
|
45
63
|
*
|
|
46
|
-
* @type {string
|
|
64
|
+
* @type {string}
|
|
47
65
|
*/
|
|
48
|
-
colour: string
|
|
66
|
+
colour: string;
|
|
49
67
|
/**
|
|
50
68
|
* Annotation quantification.
|
|
51
69
|
*
|
|
@@ -54,11 +72,11 @@ export declare class Annotation {
|
|
|
54
72
|
quantification: object | undefined;
|
|
55
73
|
/**
|
|
56
74
|
* Text expression. Can contain variables surrounded with '{}' that will
|
|
57
|
-
*
|
|
75
|
+
* be extracted from the quantification object.
|
|
58
76
|
*
|
|
59
|
-
* @type {string
|
|
77
|
+
* @type {string}
|
|
60
78
|
*/
|
|
61
|
-
textExpr: string
|
|
79
|
+
textExpr: string;
|
|
62
80
|
/**
|
|
63
81
|
* Label position. If undefined, the default shape
|
|
64
82
|
* label position will be used.
|
|
@@ -67,7 +85,7 @@ export declare class Annotation {
|
|
|
67
85
|
*/
|
|
68
86
|
labelPosition: Point2D | undefined;
|
|
69
87
|
/**
|
|
70
|
-
*
|
|
88
|
+
* Plane origin: 3D position of index [0, 0, k].
|
|
71
89
|
*
|
|
72
90
|
* @type {Point3D|undefined}
|
|
73
91
|
*/
|
|
@@ -78,6 +96,33 @@ export declare class Annotation {
|
|
|
78
96
|
* @type {Point3D[]|undefined}
|
|
79
97
|
*/
|
|
80
98
|
planePoints: Point3D[] | undefined;
|
|
99
|
+
/**
|
|
100
|
+
* Get the concepts ids of the annotation meta data.
|
|
101
|
+
*
|
|
102
|
+
* @returns {string[]} The ids.
|
|
103
|
+
*/
|
|
104
|
+
getMetaConceptIds(): string[];
|
|
105
|
+
/**
|
|
106
|
+
* Get an annotation meta data.
|
|
107
|
+
*
|
|
108
|
+
* @param {string} conceptId The value of the concept dicom code.
|
|
109
|
+
* @returns {object|undefined} The corresponding meta data item
|
|
110
|
+
* as {concept, value} or undefined.
|
|
111
|
+
*/
|
|
112
|
+
getMetaItem(conceptId: string): object | undefined;
|
|
113
|
+
/**
|
|
114
|
+
* Add annotation meta data.
|
|
115
|
+
*
|
|
116
|
+
* @param {DicomCode} concept The concept code.
|
|
117
|
+
* @param {DicomCode|string} value The value code.
|
|
118
|
+
*/
|
|
119
|
+
addMetaItem(concept: DicomCode, value: DicomCode | string): void;
|
|
120
|
+
/**
|
|
121
|
+
* Remove an annotation meta data.
|
|
122
|
+
*
|
|
123
|
+
* @param {string} conceptId The value of the concept dicom code.
|
|
124
|
+
*/
|
|
125
|
+
removeMetaItem(conceptId: string): void;
|
|
81
126
|
/**
|
|
82
127
|
* Get the orientation name for this annotation.
|
|
83
128
|
*
|
|
@@ -91,6 +136,13 @@ export declare class Annotation {
|
|
|
91
136
|
* @param {ViewController} viewController The associated view controller.
|
|
92
137
|
*/
|
|
93
138
|
init(viewController: ViewController): void;
|
|
139
|
+
/**
|
|
140
|
+
* Check if the annotation can be displayed: true if it has
|
|
141
|
+
* an associated view controller.
|
|
142
|
+
*
|
|
143
|
+
* @returns {boolean} True if the annotation can be displayed.
|
|
144
|
+
*/
|
|
145
|
+
canView(): boolean;
|
|
94
146
|
/**
|
|
95
147
|
* Check if an input view is compatible with the annotation.
|
|
96
148
|
*
|
|
@@ -133,9 +185,9 @@ export declare class Annotation {
|
|
|
133
185
|
/**
|
|
134
186
|
* Get the math shape associated draw factory.
|
|
135
187
|
*
|
|
136
|
-
* @returns {object} The factory.
|
|
188
|
+
* @returns {object|undefined} The factory.
|
|
137
189
|
*/
|
|
138
|
-
getFactory(): object;
|
|
190
|
+
getFactory(): object | undefined;
|
|
139
191
|
#private;
|
|
140
192
|
}
|
|
141
193
|
|
|
@@ -195,14 +247,16 @@ export declare class AnnotationGroup {
|
|
|
195
247
|
*
|
|
196
248
|
* @param {Annotation} annotation The annotation to update.
|
|
197
249
|
* @param {string[]} [propKeys] Optional properties that got updated.
|
|
250
|
+
* @param {boolean} [propagate] Whether the update event propagates
|
|
251
|
+
* outside of dwv or not, defaults to true.
|
|
198
252
|
*/
|
|
199
|
-
update(annotation: Annotation, propKeys?: string[]): void;
|
|
253
|
+
update(annotation: Annotation, propKeys?: string[], propagate?: boolean): void;
|
|
200
254
|
/**
|
|
201
255
|
* Remove an annotation.
|
|
202
256
|
*
|
|
203
|
-
* @param {string}
|
|
257
|
+
* @param {string} uid The UID of the annotation to remove.
|
|
204
258
|
*/
|
|
205
|
-
remove(
|
|
259
|
+
remove(uid: string): void;
|
|
206
260
|
/**
|
|
207
261
|
* Set the associated view controller.
|
|
208
262
|
*
|
|
@@ -212,10 +266,10 @@ export declare class AnnotationGroup {
|
|
|
212
266
|
/**
|
|
213
267
|
* Find an annotation.
|
|
214
268
|
*
|
|
215
|
-
* @param {string}
|
|
269
|
+
* @param {string} uid The UID of the annotation to find.
|
|
216
270
|
* @returns {Annotation|undefined} The found annotation.
|
|
217
271
|
*/
|
|
218
|
-
find(
|
|
272
|
+
find(uid: string): Annotation | undefined;
|
|
219
273
|
/**
|
|
220
274
|
* Get the meta data.
|
|
221
275
|
*
|
|
@@ -235,9 +289,9 @@ export declare class AnnotationGroup {
|
|
|
235
289
|
* Get a meta data value.
|
|
236
290
|
*
|
|
237
291
|
* @param {string} key The meta data key.
|
|
238
|
-
* @returns {string|object} The meta data value.
|
|
292
|
+
* @returns {string|object|undefined} The meta data value.
|
|
239
293
|
*/
|
|
240
|
-
getMetaValue(key: string): string | object;
|
|
294
|
+
getMetaValue(key: string): string | object | undefined;
|
|
241
295
|
/**
|
|
242
296
|
* Set a meta data.
|
|
243
297
|
*
|
|
@@ -276,25 +330,37 @@ export declare class AnnotationGroupFactory {
|
|
|
276
330
|
*/
|
|
277
331
|
getWarning(): string | undefined;
|
|
278
332
|
/**
|
|
279
|
-
* Check dicom elements.
|
|
333
|
+
* Check dicom elements.
|
|
280
334
|
*
|
|
281
335
|
* @param {Object<string, DataElement>} dataElements The DICOM data elements.
|
|
282
336
|
* @returns {string|undefined} A possible warning.
|
|
337
|
+
* @throws Error for missing or wrong data.
|
|
283
338
|
*/
|
|
284
339
|
checkElements(dataElements: {
|
|
285
340
|
[x: string]: DataElement;
|
|
286
341
|
}): string | undefined;
|
|
287
342
|
/**
|
|
288
|
-
* Get an {@link
|
|
343
|
+
* Get an {@link AnnotationGroup} object from the read DICOM file.
|
|
289
344
|
*
|
|
290
345
|
* @param {Object<string, DataElement>} dataElements The DICOM tags.
|
|
291
346
|
* @returns {AnnotationGroup} A new annotation group.
|
|
347
|
+
* @throws Error for missing or wrong data.
|
|
292
348
|
*/
|
|
293
349
|
create(dataElements: {
|
|
294
350
|
[x: string]: DataElement;
|
|
295
351
|
}): AnnotationGroup;
|
|
296
352
|
/**
|
|
297
|
-
*
|
|
353
|
+
* Get an {@link CADReport} object from the read DICOM file.
|
|
354
|
+
*
|
|
355
|
+
* @param {Object<string, DataElement>} dataElements The DICOM tags.
|
|
356
|
+
* @returns {CADReport|undefined} A new CAD report.
|
|
357
|
+
*/
|
|
358
|
+
createCADReport(dataElements: {
|
|
359
|
+
[x: string]: DataElement;
|
|
360
|
+
}): CADReport | undefined;
|
|
361
|
+
/**
|
|
362
|
+
* Convert an annotation group into a DICOM SR object using the
|
|
363
|
+
* TID 1500 template.
|
|
298
364
|
*
|
|
299
365
|
* @param {AnnotationGroup} annotationGroup The annotation group.
|
|
300
366
|
* @param {Object<string, any>} [extraTags] Optional list of extra tags.
|
|
@@ -305,6 +371,19 @@ export declare class AnnotationGroupFactory {
|
|
|
305
371
|
}): {
|
|
306
372
|
[x: string]: DataElement;
|
|
307
373
|
};
|
|
374
|
+
/**
|
|
375
|
+
* Convert a CAD report into a DICOM CAD report SR object using
|
|
376
|
+
* the TID 4100 template.
|
|
377
|
+
*
|
|
378
|
+
* @param {CADReport} report The CAD report.
|
|
379
|
+
* @param {Object<string, any>} [extraTags] Optional list of extra tags.
|
|
380
|
+
* @returns {Object<string, DataElement>} A list of dicom elements.
|
|
381
|
+
*/
|
|
382
|
+
toDicomCADReport(report: CADReport, extraTags?: {
|
|
383
|
+
[x: string]: any;
|
|
384
|
+
}): {
|
|
385
|
+
[x: string]: DataElement;
|
|
386
|
+
};
|
|
308
387
|
#private;
|
|
309
388
|
}
|
|
310
389
|
|
|
@@ -317,12 +396,13 @@ export declare class AnnotationGroupFactory {
|
|
|
317
396
|
* Main application class.
|
|
318
397
|
*
|
|
319
398
|
* @example
|
|
399
|
+
* import {App, AppOptions, ViewConfig} from '//esm.sh/dwv';
|
|
320
400
|
* // create the dwv app
|
|
321
|
-
* const app = new
|
|
401
|
+
* const app = new App();
|
|
322
402
|
* // initialise
|
|
323
|
-
* const viewConfig0 = new
|
|
403
|
+
* const viewConfig0 = new ViewConfig('layerGroup0');
|
|
324
404
|
* const viewConfigs = {'*': [viewConfig0]};
|
|
325
|
-
* const options = new
|
|
405
|
+
* const options = new AppOptions(viewConfigs);
|
|
326
406
|
* app.init(options);
|
|
327
407
|
* // load dicom data
|
|
328
408
|
* app.loadURLs([
|
|
@@ -513,12 +593,13 @@ export declare class App {
|
|
|
513
593
|
*
|
|
514
594
|
* @param {AppOptions} opt The application options.
|
|
515
595
|
* @example
|
|
596
|
+
* import {App, AppOptions, ViewConfig} from '//esm.sh/dwv';
|
|
516
597
|
* // create the dwv app
|
|
517
|
-
* const app = new
|
|
598
|
+
* const app = new App();
|
|
518
599
|
* // initialise
|
|
519
|
-
* const viewConfig0 = new
|
|
600
|
+
* const viewConfig0 = new ViewConfig('layerGroup0');
|
|
520
601
|
* const viewConfigs = {'*': [viewConfig0]};
|
|
521
|
-
* const options = new
|
|
602
|
+
* const options = new AppOptions(viewConfigs);
|
|
522
603
|
* options.viewOnFirstLoadItem = false;
|
|
523
604
|
* app.init(options);
|
|
524
605
|
* // render button
|
|
@@ -547,8 +628,18 @@ export declare class App {
|
|
|
547
628
|
reset(): void;
|
|
548
629
|
/**
|
|
549
630
|
* Reset the layout of the application.
|
|
631
|
+
*
|
|
632
|
+
* @deprecated Since v0.35, prefer resetZoomPan.
|
|
550
633
|
*/
|
|
551
634
|
resetLayout(): void;
|
|
635
|
+
/**
|
|
636
|
+
* Reset the zoom and pan of the stage.
|
|
637
|
+
*/
|
|
638
|
+
resetZoomPan(): void;
|
|
639
|
+
/**
|
|
640
|
+
* Reset the position and window level of the stage.
|
|
641
|
+
*/
|
|
642
|
+
resetViews(): void;
|
|
552
643
|
/**
|
|
553
644
|
* Add an event listener to this class.
|
|
554
645
|
*
|
|
@@ -569,6 +660,7 @@ export declare class App {
|
|
|
569
660
|
* Load a list of files. Can be image files or a state file.
|
|
570
661
|
*
|
|
571
662
|
* @param {File[]} files The list of files to load.
|
|
663
|
+
* @returns {string} The data ID, '-1' if problem.
|
|
572
664
|
* @fires App#loadstart
|
|
573
665
|
* @fires App#loadprogress
|
|
574
666
|
* @fires App#loaditem
|
|
@@ -577,7 +669,7 @@ export declare class App {
|
|
|
577
669
|
* @fires App#abort
|
|
578
670
|
* @function
|
|
579
671
|
*/
|
|
580
|
-
loadFiles: (files: File[]) =>
|
|
672
|
+
loadFiles: (files: File[]) => string;
|
|
581
673
|
/**
|
|
582
674
|
* Load a list of URLs. Can be image files or a state file.
|
|
583
675
|
*
|
|
@@ -586,6 +678,7 @@ export declare class App {
|
|
|
586
678
|
* - requestHeaders: an array of {name, value} to use as request headers,
|
|
587
679
|
* - withCredentials: boolean xhr.withCredentials flag to pass to the request,
|
|
588
680
|
* - batchSize: the size of the request url batch.
|
|
681
|
+
* @returns {string} The data ID, '-1' if problem.
|
|
589
682
|
* @fires App#loadstart
|
|
590
683
|
* @fires App#loadprogress
|
|
591
684
|
* @fires App#loaditem
|
|
@@ -594,7 +687,7 @@ export declare class App {
|
|
|
594
687
|
* @fires App#abort
|
|
595
688
|
* @function
|
|
596
689
|
*/
|
|
597
|
-
loadURLs: (urls: string[], options?: object) =>
|
|
690
|
+
loadURLs: (urls: string[], options?: object) => string;
|
|
598
691
|
/**
|
|
599
692
|
* Load from an input uri.
|
|
600
693
|
*
|
|
@@ -608,6 +701,7 @@ export declare class App {
|
|
|
608
701
|
*
|
|
609
702
|
* @param {Array} data The list of ArrayBuffers to load
|
|
610
703
|
* in the form of [{name: "", filename: "", data: data}].
|
|
704
|
+
* @returns {string} The data ID.
|
|
611
705
|
* @fires App#loadstart
|
|
612
706
|
* @fires App#loadprogress
|
|
613
707
|
* @fires App#loaditem
|
|
@@ -616,7 +710,7 @@ export declare class App {
|
|
|
616
710
|
* @fires App#abort
|
|
617
711
|
* @function
|
|
618
712
|
*/
|
|
619
|
-
loadImageObject: (data: any[]) =>
|
|
713
|
+
loadImageObject: (data: any[]) => string;
|
|
620
714
|
/**
|
|
621
715
|
* Abort all the current loads.
|
|
622
716
|
*/
|
|
@@ -693,6 +787,8 @@ export declare class App {
|
|
|
693
787
|
addDataViewConfig(dataId: string, config: ViewConfig): void;
|
|
694
788
|
/**
|
|
695
789
|
* Remove a data view config.
|
|
790
|
+
* Removes the associated layer if found, removes
|
|
791
|
+
* the layer group if empty.
|
|
696
792
|
*
|
|
697
793
|
* @param {string} dataId The data id.
|
|
698
794
|
* @param {string} divId The div id.
|
|
@@ -970,6 +1066,24 @@ export declare class AppOptions {
|
|
|
970
1066
|
*/
|
|
971
1067
|
export declare function buildMultipart(parts: any[], boundary: string): Uint8Array;
|
|
972
1068
|
|
|
1069
|
+
/**
|
|
1070
|
+
* CAD report class.
|
|
1071
|
+
*/
|
|
1072
|
+
export declare class CADReport {
|
|
1073
|
+
/**
|
|
1074
|
+
* @type {AnnotationGroup[]}
|
|
1075
|
+
*/
|
|
1076
|
+
annotationGroups: AnnotationGroup[];
|
|
1077
|
+
/**
|
|
1078
|
+
* @type {ResponseEvaluation[]}
|
|
1079
|
+
*/
|
|
1080
|
+
responseEvaluations: ResponseEvaluation[];
|
|
1081
|
+
/**
|
|
1082
|
+
* @type {string}
|
|
1083
|
+
*/
|
|
1084
|
+
comment: string;
|
|
1085
|
+
}
|
|
1086
|
+
|
|
973
1087
|
/**
|
|
974
1088
|
* Change segment colour command.
|
|
975
1089
|
*/
|
|
@@ -1231,16 +1345,6 @@ export declare class DataElement {
|
|
|
1231
1345
|
items: any[];
|
|
1232
1346
|
}
|
|
1233
1347
|
|
|
1234
|
-
/**
|
|
1235
|
-
* Decoder scripts to be passed to web workers for image decoding.
|
|
1236
|
-
*/
|
|
1237
|
-
export declare const decoderScripts: {
|
|
1238
|
-
jpeg2000: string;
|
|
1239
|
-
'jpeg-lossless': string;
|
|
1240
|
-
'jpeg-baseline': string;
|
|
1241
|
-
rle: string;
|
|
1242
|
-
};
|
|
1243
|
-
|
|
1244
1348
|
/**
|
|
1245
1349
|
* Delete segment command.
|
|
1246
1350
|
*/
|
|
@@ -1343,15 +1447,19 @@ export declare class DicomCode {
|
|
|
1343
1447
|
*/
|
|
1344
1448
|
export declare class DicomData {
|
|
1345
1449
|
/**
|
|
1346
|
-
* @param {
|
|
1450
|
+
* @param {Object<string, DataElement>} meta The DICOM meta data.
|
|
1347
1451
|
*/
|
|
1348
|
-
constructor(meta:
|
|
1452
|
+
constructor(meta: {
|
|
1453
|
+
[x: string]: DataElement;
|
|
1454
|
+
});
|
|
1349
1455
|
/**
|
|
1350
1456
|
* DICOM meta data.
|
|
1351
1457
|
*
|
|
1352
|
-
* @type {
|
|
1458
|
+
* @type {Object<string, DataElement>}
|
|
1353
1459
|
*/
|
|
1354
|
-
meta:
|
|
1460
|
+
meta: {
|
|
1461
|
+
[x: string]: DataElement;
|
|
1462
|
+
};
|
|
1355
1463
|
/**
|
|
1356
1464
|
* Image extracted from meta data.
|
|
1357
1465
|
*
|
|
@@ -1364,16 +1472,23 @@ export declare class DicomData {
|
|
|
1364
1472
|
* @type {AnnotationGroup|undefined}
|
|
1365
1473
|
*/
|
|
1366
1474
|
annotationGroup: AnnotationGroup | undefined;
|
|
1475
|
+
/**
|
|
1476
|
+
* Image buffer used to build image.
|
|
1477
|
+
*
|
|
1478
|
+
* @type {any|undefined}
|
|
1479
|
+
*/
|
|
1480
|
+
buffer: any | undefined;
|
|
1367
1481
|
}
|
|
1368
1482
|
|
|
1369
1483
|
/**
|
|
1370
1484
|
* DicomParser class.
|
|
1371
1485
|
*
|
|
1372
1486
|
* @example
|
|
1487
|
+
* import {DicomParser} from '//esm.sh/dwv';
|
|
1373
1488
|
* // XMLHttpRequest onload callback
|
|
1374
1489
|
* const onload = function (event) {
|
|
1375
1490
|
* // setup the dicom parser
|
|
1376
|
-
* const dicomParser = new
|
|
1491
|
+
* const dicomParser = new DicomParser();
|
|
1377
1492
|
* // parse the buffer
|
|
1378
1493
|
* dicomParser.parse(event.target.response);
|
|
1379
1494
|
* // get the dicom tags
|
|
@@ -1466,11 +1581,11 @@ export declare class DicomSRContent {
|
|
|
1466
1581
|
*/
|
|
1467
1582
|
relationshipType: string;
|
|
1468
1583
|
/**
|
|
1469
|
-
* Content sequence
|
|
1584
|
+
* Content sequence.
|
|
1470
1585
|
*
|
|
1471
|
-
* @type {DicomSRContent[]
|
|
1586
|
+
* @type {DicomSRContent[]}
|
|
1472
1587
|
*/
|
|
1473
|
-
contentSequence: DicomSRContent[]
|
|
1588
|
+
contentSequence: DicomSRContent[];
|
|
1474
1589
|
/**
|
|
1475
1590
|
* Value.
|
|
1476
1591
|
*
|
|
@@ -1484,12 +1599,22 @@ export declare class DicomSRContent {
|
|
|
1484
1599
|
* @returns {string} The object as string.
|
|
1485
1600
|
*/
|
|
1486
1601
|
toString(prefix?: string): string;
|
|
1602
|
+
/**
|
|
1603
|
+
* Check if this content has input header values.
|
|
1604
|
+
*
|
|
1605
|
+
* @param {string} valueType The value type.
|
|
1606
|
+
* @param {DicomCode} conceptNameCode The concept name code.
|
|
1607
|
+
* @param {string} relationshipType The relationship type.
|
|
1608
|
+
* @returns {boolean} True if equal.
|
|
1609
|
+
*/
|
|
1610
|
+
hasHeader(valueType: string, conceptNameCode: DicomCode, relationshipType: string): boolean;
|
|
1487
1611
|
}
|
|
1488
1612
|
|
|
1489
1613
|
/**
|
|
1490
1614
|
* DICOM writer.
|
|
1491
1615
|
*
|
|
1492
1616
|
* @example
|
|
1617
|
+
* import {DicomParser, DicomWriter} from '//esm.sh/dwv';
|
|
1493
1618
|
* // add link to html
|
|
1494
1619
|
* const link = document.createElement("a");
|
|
1495
1620
|
* link.appendChild(document.createTextNode("download"));
|
|
@@ -1497,10 +1622,10 @@ export declare class DicomSRContent {
|
|
|
1497
1622
|
* div.appendChild(link);
|
|
1498
1623
|
* // XMLHttpRequest onload callback
|
|
1499
1624
|
* const onload = function (event) {
|
|
1500
|
-
* const parser = new
|
|
1625
|
+
* const parser = new DicomParser();
|
|
1501
1626
|
* parser.parse(event.target.response);
|
|
1502
1627
|
* // create writer
|
|
1503
|
-
* const writer = new
|
|
1628
|
+
* const writer = new DicomWriter();
|
|
1504
1629
|
* // get buffer using default rules
|
|
1505
1630
|
* const dicomBuffer = writer.getBuffer(parser.getDicomElements());
|
|
1506
1631
|
* // create blob
|
|
@@ -1581,10 +1706,10 @@ export declare class DrawController {
|
|
|
1581
1706
|
/**
|
|
1582
1707
|
* Get an annotation.
|
|
1583
1708
|
*
|
|
1584
|
-
* @param {string}
|
|
1709
|
+
* @param {string} uid The annotation UID.
|
|
1585
1710
|
* @returns {Annotation|undefined} The annotation.
|
|
1586
1711
|
*/
|
|
1587
|
-
getAnnotation(
|
|
1712
|
+
getAnnotation(uid: string): Annotation | undefined;
|
|
1588
1713
|
/**
|
|
1589
1714
|
* Get the annotation group.
|
|
1590
1715
|
*
|
|
@@ -1614,32 +1739,34 @@ export declare class DrawController {
|
|
|
1614
1739
|
*
|
|
1615
1740
|
* @param {Annotation} annotation The annotation to update.
|
|
1616
1741
|
* @param {string[]} [propKeys] Optional properties that got updated.
|
|
1742
|
+
* @param {boolean} [propagate] Whether the update event propagates
|
|
1743
|
+
* outside of dwv or not, defaults to true.
|
|
1617
1744
|
*/
|
|
1618
|
-
updateAnnotation(annotation: Annotation, propKeys?: string[]): void;
|
|
1745
|
+
updateAnnotation(annotation: Annotation, propKeys?: string[], propagate?: boolean): void;
|
|
1619
1746
|
/**
|
|
1620
1747
|
* Remove an anotation for the list.
|
|
1621
1748
|
*
|
|
1622
|
-
* @param {string}
|
|
1749
|
+
* @param {string} uid The UID of the annotation to remove.
|
|
1623
1750
|
*/
|
|
1624
|
-
removeAnnotation(
|
|
1751
|
+
removeAnnotation(uid: string): void;
|
|
1625
1752
|
/**
|
|
1626
1753
|
* Remove an annotation via a remove command (triggers draw actions).
|
|
1627
1754
|
*
|
|
1628
|
-
* @param {string}
|
|
1755
|
+
* @param {string} uid The annotation UID.
|
|
1629
1756
|
* @param {Function} exeCallback The undo stack callback.
|
|
1630
1757
|
*/
|
|
1631
|
-
removeAnnotationWithCommand(
|
|
1758
|
+
removeAnnotationWithCommand(uid: string, exeCallback: Function): void;
|
|
1632
1759
|
/**
|
|
1633
1760
|
* Update an annotation via an update command (triggers draw actions).
|
|
1634
1761
|
*
|
|
1635
|
-
* @param {string}
|
|
1762
|
+
* @param {string} uid The annotation UID.
|
|
1636
1763
|
* @param {object} originalProps The original annotation properties
|
|
1637
1764
|
* that will be updated.
|
|
1638
1765
|
* @param {object} newProps The new annotation properties
|
|
1639
1766
|
* that will replace the original ones.
|
|
1640
1767
|
* @param {Function} exeCallback The undo stack callback.
|
|
1641
1768
|
*/
|
|
1642
|
-
updateAnnotationWithCommand(
|
|
1769
|
+
updateAnnotationWithCommand(uid: string, originalProps: object, newProps: object, exeCallback: Function): void;
|
|
1643
1770
|
/**
|
|
1644
1771
|
* Remove all annotations via remove commands (triggers draw actions).
|
|
1645
1772
|
*
|
|
@@ -1692,7 +1819,7 @@ export declare class DrawLayer {
|
|
|
1692
1819
|
*/
|
|
1693
1820
|
getDataId(): string;
|
|
1694
1821
|
/**
|
|
1695
|
-
* Get the reference
|
|
1822
|
+
* Get the reference layer id.
|
|
1696
1823
|
*
|
|
1697
1824
|
* @returns {string} The id.
|
|
1698
1825
|
*/
|
|
@@ -2138,11 +2265,11 @@ export declare class Geometry {
|
|
|
2138
2265
|
* Check if a point is in the origin list.
|
|
2139
2266
|
*
|
|
2140
2267
|
* @param {Point3D} point3D The point to check.
|
|
2141
|
-
* @param {number} tol
|
|
2142
|
-
*
|
|
2268
|
+
* @param {number} [tol] Optional number comparison tolerance
|
|
2269
|
+
* defaults to Number.EPSILON.
|
|
2143
2270
|
* @returns {boolean} True if in list.
|
|
2144
2271
|
*/
|
|
2145
|
-
includesOrigin(point3D: Point3D, tol
|
|
2272
|
+
includesOrigin(point3D: Point3D, tol?: number): boolean;
|
|
2146
2273
|
/**
|
|
2147
2274
|
* Get the object size.
|
|
2148
2275
|
* Warning: the size comes as stored in DICOM, meaning that it could
|
|
@@ -2268,6 +2395,21 @@ export declare class Geometry {
|
|
|
2268
2395
|
#private;
|
|
2269
2396
|
}
|
|
2270
2397
|
|
|
2398
|
+
/**
|
|
2399
|
+
* Get the meta data as simple elements:
|
|
2400
|
+
* - indexed by tag names instead of tag keys,
|
|
2401
|
+
* - no element object, just value if not sequence nor merged item.
|
|
2402
|
+
*
|
|
2403
|
+
* @param {Object<string, DataElement>} metaData The meta data
|
|
2404
|
+
* index by tag keys.
|
|
2405
|
+
* @returns {Object<string, any>} The simple elements.
|
|
2406
|
+
*/
|
|
2407
|
+
export declare function getAsSimpleElements(metaData: {
|
|
2408
|
+
[x: string]: DataElement;
|
|
2409
|
+
}): {
|
|
2410
|
+
[x: string]: any;
|
|
2411
|
+
};
|
|
2412
|
+
|
|
2271
2413
|
/**
|
|
2272
2414
|
* Get the default DICOM seg tags as an object.
|
|
2273
2415
|
*
|
|
@@ -2377,6 +2519,13 @@ export declare function getRectangleIndices(center: Index, size: number[], dir:
|
|
|
2377
2519
|
*/
|
|
2378
2520
|
export declare function getReverseOrientation(ori: string): string;
|
|
2379
2521
|
|
|
2522
|
+
/**
|
|
2523
|
+
* Get a segmentation DICOM code.
|
|
2524
|
+
*
|
|
2525
|
+
* @returns {DicomCode} The code.
|
|
2526
|
+
*/
|
|
2527
|
+
export declare function getSegmentationCode(): DicomCode;
|
|
2528
|
+
|
|
2380
2529
|
/**
|
|
2381
2530
|
* Get a content item object from a dicom element.
|
|
2382
2531
|
*
|
|
@@ -2442,6 +2591,14 @@ export declare function getUID(tagName: string): string;
|
|
|
2442
2591
|
*/
|
|
2443
2592
|
export declare function hasDicomPrefix(buffer: ArrayBuffer): boolean;
|
|
2444
2593
|
|
|
2594
|
+
/**
|
|
2595
|
+
* Convert a hex color into RGB.
|
|
2596
|
+
*
|
|
2597
|
+
* @param {string} hexStr The hex color as '#ab01ef'.
|
|
2598
|
+
* @returns {RGB} The RGB values as {r,g,b}.
|
|
2599
|
+
*/
|
|
2600
|
+
export declare function hexToRgb(hexStr: string): RGB;
|
|
2601
|
+
|
|
2445
2602
|
export declare namespace i18n {
|
|
2446
2603
|
/**
|
|
2447
2604
|
* Get the translated text.
|
|
@@ -2449,7 +2606,7 @@ export declare namespace i18n {
|
|
|
2449
2606
|
* @param {string} key The key to the text entry.
|
|
2450
2607
|
* @returns {string|undefined} The translated text.
|
|
2451
2608
|
*/
|
|
2452
|
-
export function t(key: string): string;
|
|
2609
|
+
export function t(key: string): string | undefined;
|
|
2453
2610
|
}
|
|
2454
2611
|
|
|
2455
2612
|
/**
|
|
@@ -2460,13 +2617,14 @@ export declare namespace i18n {
|
|
|
2460
2617
|
* - planar configuration (default RGBRGB...).
|
|
2461
2618
|
*
|
|
2462
2619
|
* @example
|
|
2620
|
+
* import {DicomParser, createImage} from '//esm.sh/dwv';
|
|
2463
2621
|
* // XMLHttpRequest onload callback
|
|
2464
2622
|
* const onload = function (event) {
|
|
2465
2623
|
* // parse the dicom buffer
|
|
2466
|
-
* const dicomParser = new
|
|
2624
|
+
* const dicomParser = new DicomParser();
|
|
2467
2625
|
* dicomParser.parse(event.target.response);
|
|
2468
2626
|
* // create the image object
|
|
2469
|
-
* const image =
|
|
2627
|
+
* const image = createImage(dicomParser.getDicomElements());
|
|
2470
2628
|
* // result div
|
|
2471
2629
|
* const div = document.getElementById('dwv');
|
|
2472
2630
|
* // display the image size
|
|
@@ -2882,6 +3040,10 @@ declare class Image_2 {
|
|
|
2882
3040
|
* Note: Uses the raw buffer values.
|
|
2883
3041
|
*/
|
|
2884
3042
|
compose(rhs: Image_2, operator: Function): Image_2;
|
|
3043
|
+
/**
|
|
3044
|
+
* Recalculate labels.
|
|
3045
|
+
*/
|
|
3046
|
+
recalculateLabels(): void;
|
|
2885
3047
|
#private;
|
|
2886
3048
|
}
|
|
2887
3049
|
export { Image_2 as Image }
|
|
@@ -3086,7 +3248,7 @@ export declare class LayerGroup {
|
|
|
3086
3248
|
*/
|
|
3087
3249
|
includes(id: string): boolean;
|
|
3088
3250
|
/**
|
|
3089
|
-
* Get
|
|
3251
|
+
* Get the view layers that satisfy the input callback function.
|
|
3090
3252
|
*
|
|
3091
3253
|
* @param {Function} [callbackFn] A function that takes
|
|
3092
3254
|
* a ViewLayer as input and returns a boolean. If undefined,
|
|
@@ -3095,6 +3257,17 @@ export declare class LayerGroup {
|
|
|
3095
3257
|
* satisfy the callbackFn.
|
|
3096
3258
|
*/
|
|
3097
3259
|
getViewLayers(callbackFn?: Function): ViewLayer[];
|
|
3260
|
+
/**
|
|
3261
|
+
* Get the view layers that satisfy the input callback function
|
|
3262
|
+
* starting from the active layer.
|
|
3263
|
+
*
|
|
3264
|
+
* @param {Function} [callbackFn] A function that takes
|
|
3265
|
+
* a ViewLayer as input and returns a boolean. If undefined,
|
|
3266
|
+
* returns all view layers.
|
|
3267
|
+
* @returns {ViewLayer[]} The layers that
|
|
3268
|
+
* satisfy the callbackFn.
|
|
3269
|
+
*/
|
|
3270
|
+
getViewLayersFromActive(callbackFn?: Function): ViewLayer[];
|
|
3098
3271
|
/**
|
|
3099
3272
|
* Test if one of the view layers satisfies an input callbackFn.
|
|
3100
3273
|
*
|
|
@@ -3120,6 +3293,12 @@ export declare class LayerGroup {
|
|
|
3120
3293
|
* @returns {number} The number of layers.
|
|
3121
3294
|
*/
|
|
3122
3295
|
getNumberOfViewLayers(): number;
|
|
3296
|
+
/**
|
|
3297
|
+
* Get the active image layer.
|
|
3298
|
+
*
|
|
3299
|
+
* @returns {ViewLayer|DrawLayer|undefined} The layer.
|
|
3300
|
+
*/
|
|
3301
|
+
getActiveLayer(): ViewLayer | DrawLayer | undefined;
|
|
3123
3302
|
/**
|
|
3124
3303
|
* Get the active image layer.
|
|
3125
3304
|
*
|
|
@@ -3132,6 +3311,13 @@ export declare class LayerGroup {
|
|
|
3132
3311
|
* @returns {ViewLayer|undefined} The layer.
|
|
3133
3312
|
*/
|
|
3134
3313
|
getBaseViewLayer(): ViewLayer | undefined;
|
|
3314
|
+
/**
|
|
3315
|
+
* Get a view layer associated to a data id.
|
|
3316
|
+
*
|
|
3317
|
+
* @param {string} id The layer id.
|
|
3318
|
+
* @returns {ViewLayer|undefined} The layer.
|
|
3319
|
+
*/
|
|
3320
|
+
getViewLayerById(id: string): ViewLayer | undefined;
|
|
3135
3321
|
/**
|
|
3136
3322
|
* Get the view layers associated to a data id.
|
|
3137
3323
|
*
|
|
@@ -3140,7 +3326,7 @@ export declare class LayerGroup {
|
|
|
3140
3326
|
*/
|
|
3141
3327
|
getViewLayersByDataId(dataId: string): ViewLayer[];
|
|
3142
3328
|
/**
|
|
3143
|
-
* Search view layers for equal
|
|
3329
|
+
* Search view layers for equal image meta data.
|
|
3144
3330
|
*
|
|
3145
3331
|
* @param {object} meta The meta data to find.
|
|
3146
3332
|
* @returns {ViewLayer[]} The list of view layers that contain matched data.
|
|
@@ -3158,6 +3344,13 @@ export declare class LayerGroup {
|
|
|
3158
3344
|
* @returns {DrawLayer|undefined} The layer.
|
|
3159
3345
|
*/
|
|
3160
3346
|
getActiveDrawLayer(): DrawLayer | undefined;
|
|
3347
|
+
/**
|
|
3348
|
+
* Get a draw layer associated to a data id.
|
|
3349
|
+
*
|
|
3350
|
+
* @param {string} id The layer id.
|
|
3351
|
+
* @returns {DrawLayer|undefined} The layer.
|
|
3352
|
+
*/
|
|
3353
|
+
getDrawLayerById(id: string): DrawLayer | undefined;
|
|
3161
3354
|
/**
|
|
3162
3355
|
* Get the draw layers associated to a data id.
|
|
3163
3356
|
*
|
|
@@ -3166,30 +3359,23 @@ export declare class LayerGroup {
|
|
|
3166
3359
|
*/
|
|
3167
3360
|
getDrawLayersByDataId(dataId: string): DrawLayer[];
|
|
3168
3361
|
/**
|
|
3169
|
-
* Set the active
|
|
3362
|
+
* Set the active layer.
|
|
3170
3363
|
*
|
|
3171
3364
|
* @param {number} index The index of the layer to set as active.
|
|
3172
3365
|
*/
|
|
3173
|
-
|
|
3174
|
-
/**
|
|
3175
|
-
* Set the active view layer with a data id.
|
|
3176
|
-
*
|
|
3177
|
-
* @param {string} dataId The data id.
|
|
3178
|
-
*/
|
|
3179
|
-
setActiveViewLayerByDataId(dataId: string): void;
|
|
3366
|
+
setActiveLayer(index: number): void;
|
|
3180
3367
|
/**
|
|
3181
|
-
* Set the active
|
|
3368
|
+
* Set the active layer with a layer id.
|
|
3182
3369
|
*
|
|
3183
|
-
* @param {
|
|
3184
|
-
* or undefined to not set any.
|
|
3370
|
+
* @param {string} id The layer id.
|
|
3185
3371
|
*/
|
|
3186
|
-
|
|
3372
|
+
setActiveLayerById(id: string): void;
|
|
3187
3373
|
/**
|
|
3188
|
-
* Set the active
|
|
3374
|
+
* Set the active layer with a data id.
|
|
3189
3375
|
*
|
|
3190
3376
|
* @param {string} dataId The data id.
|
|
3191
3377
|
*/
|
|
3192
|
-
|
|
3378
|
+
setActiveLayerByDataId(dataId: string): void;
|
|
3193
3379
|
/**
|
|
3194
3380
|
* Add a view layer.
|
|
3195
3381
|
*
|
|
@@ -3223,6 +3409,7 @@ export declare class LayerGroup {
|
|
|
3223
3409
|
* methods to define the active index.
|
|
3224
3410
|
*
|
|
3225
3411
|
* @param {ViewLayer | DrawLayer} layer The layer to remove.
|
|
3412
|
+
* @fires LayerGroup#removelayer
|
|
3226
3413
|
*/
|
|
3227
3414
|
removeLayer(layer: ViewLayer | DrawLayer): void;
|
|
3228
3415
|
/**
|
|
@@ -3317,8 +3504,18 @@ export declare class LayerGroup {
|
|
|
3317
3504
|
setOffset(newOffset: Scalar3D): void;
|
|
3318
3505
|
/**
|
|
3319
3506
|
* Reset the stage to its initial scale and no offset.
|
|
3507
|
+
*
|
|
3508
|
+
* @deprecated Since v0.35, prefer resetZoomPan.
|
|
3320
3509
|
*/
|
|
3321
3510
|
reset(): void;
|
|
3511
|
+
/**
|
|
3512
|
+
* Reset the zoom and pan of all layers.
|
|
3513
|
+
*/
|
|
3514
|
+
resetZoomPan(): void;
|
|
3515
|
+
/**
|
|
3516
|
+
* Reset the position and window level of all view layers.
|
|
3517
|
+
*/
|
|
3518
|
+
resetViews(): void;
|
|
3322
3519
|
/**
|
|
3323
3520
|
* Draw the layer.
|
|
3324
3521
|
*/
|
|
@@ -3385,10 +3582,11 @@ export declare class MaskFactory {
|
|
|
3385
3582
|
*/
|
|
3386
3583
|
getWarning(): string | undefined;
|
|
3387
3584
|
/**
|
|
3388
|
-
* Check dicom elements.
|
|
3585
|
+
* Check dicom elements.
|
|
3389
3586
|
*
|
|
3390
3587
|
* @param {Object<string, DataElement>} _dicomElements The DICOM tags.
|
|
3391
3588
|
* @returns {string|undefined} A possible warning.
|
|
3589
|
+
* @throws Error for missing or wrong data.
|
|
3392
3590
|
*/
|
|
3393
3591
|
checkElements(_dicomElements: {
|
|
3394
3592
|
[x: string]: DataElement;
|
|
@@ -3400,11 +3598,14 @@ export declare class MaskFactory {
|
|
|
3400
3598
|
* @param {Uint8Array | Int8Array |
|
|
3401
3599
|
* Uint16Array | Int16Array |
|
|
3402
3600
|
* Uint32Array | Int32Array} pixelBuffer The pixel buffer.
|
|
3601
|
+
* @param {Image} [refImage] Reference image, code will use its
|
|
3602
|
+
* origins if present (best) or try to calculate them.
|
|
3403
3603
|
* @returns {Image} A new Image.
|
|
3604
|
+
* @throws Error for missing or wrong data.
|
|
3404
3605
|
*/
|
|
3405
3606
|
create(dataElements: {
|
|
3406
3607
|
[x: string]: DataElement;
|
|
3407
|
-
}, pixelBuffer: Uint8Array | Int8Array | Uint16Array | Int16Array | Uint32Array | Int32Array): Image_2;
|
|
3608
|
+
}, pixelBuffer: Uint8Array | Int8Array | Uint16Array | Int16Array | Uint32Array | Int32Array, refImage?: Image_2): Image_2;
|
|
3408
3609
|
/**
|
|
3409
3610
|
* Convert a mask image into a DICOM segmentation object.
|
|
3410
3611
|
*
|
|
@@ -3622,11 +3823,18 @@ export declare class Matrix33 {
|
|
|
3622
3823
|
* Check for Matrix33 equality.
|
|
3623
3824
|
*
|
|
3624
3825
|
* @param {Matrix33} rhs The other matrix to compare to.
|
|
3625
|
-
* @param {number} [p] A numeric expression for the precision to use in check
|
|
3626
|
-
* (ex: 0.001). Defaults to Number.EPSILON if not provided.
|
|
3627
3826
|
* @returns {boolean} True if both matrices are equal.
|
|
3628
3827
|
*/
|
|
3629
|
-
equals(rhs: Matrix33
|
|
3828
|
+
equals(rhs: Matrix33): boolean;
|
|
3829
|
+
/**
|
|
3830
|
+
* Check for Matrix33 similarity.
|
|
3831
|
+
*
|
|
3832
|
+
* @param {Matrix33} rhs The other matrix to compare to.
|
|
3833
|
+
* @param {number} [tol] Optional number comparison tolerance,
|
|
3834
|
+
* defaults to Number.EPSILON.
|
|
3835
|
+
* @returns {boolean} True if both matrices are similar.
|
|
3836
|
+
*/
|
|
3837
|
+
isSimilar(rhs: Matrix33, tol?: number): boolean;
|
|
3630
3838
|
/**
|
|
3631
3839
|
* Get a string representation of the Matrix33.
|
|
3632
3840
|
*
|
|
@@ -4116,11 +4324,11 @@ export declare class Point3D {
|
|
|
4116
4324
|
* Check for Point3D similarity.
|
|
4117
4325
|
*
|
|
4118
4326
|
* @param {Point3D} rhs The other point to compare to.
|
|
4119
|
-
* @param {number} tol Optional comparison tolerance,
|
|
4120
|
-
*
|
|
4121
|
-
* @returns {boolean} True if both points are
|
|
4327
|
+
* @param {number} [tol] Optional number comparison tolerance,
|
|
4328
|
+
* defaults to Number.EPSILON.
|
|
4329
|
+
* @returns {boolean} True if both points are similar.
|
|
4122
4330
|
*/
|
|
4123
|
-
isSimilar(rhs: Point3D, tol
|
|
4331
|
+
isSimilar(rhs: Point3D, tol?: number): boolean;
|
|
4124
4332
|
/**
|
|
4125
4333
|
* Get a string representation of the Point3D.
|
|
4126
4334
|
*
|
|
@@ -4303,12 +4511,20 @@ export declare class PositionHelper {
|
|
|
4303
4511
|
*
|
|
4304
4512
|
* Inspired from {@link https://stackoverflow.com/a/49729715/3639892}.
|
|
4305
4513
|
*
|
|
4306
|
-
*
|
|
4307
|
-
*
|
|
4308
|
-
*
|
|
4514
|
+
* `toPrecision` uses all non zero digits of the number:
|
|
4515
|
+
* (123.009).toPrecision(4) = "123.0";
|
|
4516
|
+
* (0.09).toPrecision(4) = "0.09000".
|
|
4517
|
+
*
|
|
4518
|
+
* `toFixed` does not always behave as expected:
|
|
4519
|
+
* (123.009).toFixed(2) = "123.01";
|
|
4520
|
+
* (0.009).toFixed(2) = "0.01";
|
|
4521
|
+
* but
|
|
4522
|
+
* (-0.005).toFixed(2) = "-0.01" (expecting 0);
|
|
4523
|
+
* (1.005).toFixed(2) = "1" (expecting 1.01).
|
|
4309
4524
|
*
|
|
4310
4525
|
* @param {number} number The number to round.
|
|
4311
|
-
* @param {number} precision The rounding precision
|
|
4526
|
+
* @param {number} precision The rounding precision, ie the result number
|
|
4527
|
+
* of digits after the comma.
|
|
4312
4528
|
* @returns {number} The rounded number.
|
|
4313
4529
|
*/
|
|
4314
4530
|
export declare function precisionRound(number: number, precision: number): number;
|
|
@@ -4490,6 +4706,24 @@ export declare class RescaleSlopeAndIntercept {
|
|
|
4490
4706
|
#private;
|
|
4491
4707
|
}
|
|
4492
4708
|
|
|
4709
|
+
/**
|
|
4710
|
+
* Response evaluation class.
|
|
4711
|
+
*/
|
|
4712
|
+
export declare class ResponseEvaluation {
|
|
4713
|
+
/**
|
|
4714
|
+
* Current response.
|
|
4715
|
+
*
|
|
4716
|
+
* @type {DicomCode}
|
|
4717
|
+
*/
|
|
4718
|
+
current: DicomCode;
|
|
4719
|
+
/**
|
|
4720
|
+
* Measurement of response (mm).
|
|
4721
|
+
*
|
|
4722
|
+
* @type {number}
|
|
4723
|
+
*/
|
|
4724
|
+
measure: number;
|
|
4725
|
+
}
|
|
4726
|
+
|
|
4493
4727
|
/**
|
|
4494
4728
|
* RGB colour class.
|
|
4495
4729
|
*/
|
|
@@ -4520,6 +4754,14 @@ export declare class RGB {
|
|
|
4520
4754
|
b: number;
|
|
4521
4755
|
}
|
|
4522
4756
|
|
|
4757
|
+
/**
|
|
4758
|
+
* Convert RGB to its hex equivalent.
|
|
4759
|
+
*
|
|
4760
|
+
* @param {RGB} rgb The RGB object as {r,g,b}.
|
|
4761
|
+
* @returns {string} A string representing the hex color as '#ab01ef'.
|
|
4762
|
+
*/
|
|
4763
|
+
export declare function rgbToHex(rgb: RGB): string;
|
|
4764
|
+
|
|
4523
4765
|
/**
|
|
4524
4766
|
* Region Of Interest shape.
|
|
4525
4767
|
* Note: should be a closed path.
|
|
@@ -4566,9 +4808,9 @@ export declare class ROI {
|
|
|
4566
4808
|
* a non-self-intersecting closed polygon.
|
|
4567
4809
|
* Ref: {@link https://en.wikipedia.org/wiki/Centroid#Of_a_polygon}.
|
|
4568
4810
|
*
|
|
4569
|
-
* @returns {Point2D} The centroid point.
|
|
4811
|
+
* @returns {Point2D|undefined} The centroid point.
|
|
4570
4812
|
*/
|
|
4571
|
-
getCentroid(): Point2D;
|
|
4813
|
+
getCentroid(): Point2D | undefined;
|
|
4572
4814
|
#private;
|
|
4573
4815
|
}
|
|
4574
4816
|
|
|
@@ -4871,6 +5113,12 @@ export declare class Tag {
|
|
|
4871
5113
|
* @returns {string|undefined} The VR.
|
|
4872
5114
|
*/
|
|
4873
5115
|
getVrFromDictionary(): string | undefined;
|
|
5116
|
+
/**
|
|
5117
|
+
* Get the multiplicity from the dicom dictionary.
|
|
5118
|
+
*
|
|
5119
|
+
* @returns {number|undefined} The multiplicity.
|
|
5120
|
+
*/
|
|
5121
|
+
getMultiplicityFromDictionary(): number | undefined;
|
|
4874
5122
|
/**
|
|
4875
5123
|
* Get the tag name from the dicom dictionary.
|
|
4876
5124
|
*
|
|
@@ -4971,6 +5219,7 @@ export declare class ToolConfig {
|
|
|
4971
5219
|
* the default ones.
|
|
4972
5220
|
*
|
|
4973
5221
|
* @example
|
|
5222
|
+
* import {App, AppOptions, ViewConfig, toolList} from '//esm.sh/dwv';
|
|
4974
5223
|
* // custom tool
|
|
4975
5224
|
* class AlertTool {
|
|
4976
5225
|
* mousedown() {alert('AlertTool mousedown');}
|
|
@@ -4978,13 +5227,13 @@ export declare class ToolConfig {
|
|
|
4978
5227
|
* activate() {}
|
|
4979
5228
|
* }
|
|
4980
5229
|
* // pass it to dwv tool list
|
|
4981
|
-
*
|
|
5230
|
+
* toolList['Alert'] = AlertTool;
|
|
4982
5231
|
* // create the dwv app
|
|
4983
|
-
* const app = new
|
|
5232
|
+
* const app = new App();
|
|
4984
5233
|
* // initialise
|
|
4985
|
-
* const viewConfig0 = new
|
|
5234
|
+
* const viewConfig0 = new ViewConfig('layerGroup0');
|
|
4986
5235
|
* const viewConfigs = {'*': [viewConfig0]};
|
|
4987
|
-
* const options = new
|
|
5236
|
+
* const options = new AppOptions(viewConfigs);
|
|
4988
5237
|
* options.tools = {Alert: {}};
|
|
4989
5238
|
* app.init(options);
|
|
4990
5239
|
* // activate tool
|
|
@@ -5007,6 +5256,8 @@ export declare const toolList: {
|
|
|
5007
5256
|
* the default ones.
|
|
5008
5257
|
*
|
|
5009
5258
|
* @example
|
|
5259
|
+
* import {App, AppOptions, ViewConfig, toolOptions, ROI, Point2D}
|
|
5260
|
+
* from '//esm.sh/dwv';
|
|
5010
5261
|
* // custom factory
|
|
5011
5262
|
* class LoveFactory {
|
|
5012
5263
|
* getName() {return 'love';}
|
|
@@ -5016,10 +5267,10 @@ export declare const toolList: {
|
|
|
5016
5267
|
* setAnnotationMathShape(annotation, points) {
|
|
5017
5268
|
* const px = points[0].getX();
|
|
5018
5269
|
* const py = points[0].getY();
|
|
5019
|
-
* annotation.mathShape = new
|
|
5020
|
-
* new
|
|
5021
|
-
* new
|
|
5022
|
-
* new
|
|
5270
|
+
* annotation.mathShape = new ROI([
|
|
5271
|
+
* new Point2D(px+15,py), new Point2D(px+10,py-10),
|
|
5272
|
+
* new Point2D(px,py), new Point2D(px-10,py-10),
|
|
5273
|
+
* new Point2D(px-15,py), new Point2D(px,py+20)
|
|
5023
5274
|
* ]);
|
|
5024
5275
|
* annotation.getFactory = function () {return new LoveFactory();}
|
|
5025
5276
|
* }
|
|
@@ -5040,19 +5291,19 @@ export declare const toolList: {
|
|
|
5040
5291
|
* const group = new Konva.Group();
|
|
5041
5292
|
* group.name('love-group');
|
|
5042
5293
|
* group.visible(true);
|
|
5043
|
-
* group.id(annotation.
|
|
5294
|
+
* group.id(annotation.trackingUid);
|
|
5044
5295
|
* group.add(shape);
|
|
5045
5296
|
* return group;
|
|
5046
5297
|
* }
|
|
5047
5298
|
* }
|
|
5048
5299
|
* // pass it to dwv option list
|
|
5049
|
-
*
|
|
5300
|
+
* toolOptions['draw'] = {LoveFactory};
|
|
5050
5301
|
* // create the dwv app
|
|
5051
|
-
* const app = new
|
|
5302
|
+
* const app = new App();
|
|
5052
5303
|
* // initialise
|
|
5053
|
-
* const viewConfig0 = new
|
|
5304
|
+
* const viewConfig0 = new ViewConfig('layerGroup0');
|
|
5054
5305
|
* const viewConfigs = {'*': [viewConfig0]};
|
|
5055
|
-
* const options = new
|
|
5306
|
+
* const options = new AppOptions(viewConfigs);
|
|
5056
5307
|
* options.tools = {Draw: {options: ['Love']}};
|
|
5057
5308
|
* app.init(options);
|
|
5058
5309
|
* // activate tool
|
|
@@ -5157,15 +5408,16 @@ export declare class Vector3D {
|
|
|
5157
5408
|
* (either directly or with helper methods).
|
|
5158
5409
|
*
|
|
5159
5410
|
* @example
|
|
5411
|
+
* import {DicomParser, createImage, createView} from '//esm.sh/dwv';
|
|
5160
5412
|
* // XMLHttpRequest onload callback
|
|
5161
5413
|
* const onload = function (event) {
|
|
5162
5414
|
* // parse the dicom buffer
|
|
5163
|
-
* const dicomParser = new
|
|
5415
|
+
* const dicomParser = new DicomParser();
|
|
5164
5416
|
* dicomParser.parse(event.target.response);
|
|
5165
5417
|
* // create the image object
|
|
5166
|
-
* const image =
|
|
5418
|
+
* const image = createImage(dicomParser.getDicomElements());
|
|
5167
5419
|
* // create the view
|
|
5168
|
-
* const view =
|
|
5420
|
+
* const view = createView(dicomParser.getDicomElements(), image);
|
|
5169
5421
|
* // setup canvas
|
|
5170
5422
|
* const canvas = document.createElement('canvas');
|
|
5171
5423
|
* canvas.width = 256;
|
|
@@ -5519,12 +5771,26 @@ export declare class ViewController {
|
|
|
5519
5771
|
* Initialise the controller.
|
|
5520
5772
|
*/
|
|
5521
5773
|
initialise(): void;
|
|
5774
|
+
/**
|
|
5775
|
+
* Reset the window level.
|
|
5776
|
+
*/
|
|
5777
|
+
resetWindowLevel(): void;
|
|
5778
|
+
/**
|
|
5779
|
+
* Reset the position.
|
|
5780
|
+
*/
|
|
5781
|
+
resetPosition(): void;
|
|
5522
5782
|
/**
|
|
5523
5783
|
* Get the image modality.
|
|
5524
5784
|
*
|
|
5525
5785
|
* @returns {string} The modality.
|
|
5526
5786
|
*/
|
|
5527
5787
|
getModality(): string;
|
|
5788
|
+
/**
|
|
5789
|
+
* Get the image SOP class UID.
|
|
5790
|
+
*
|
|
5791
|
+
* @returns {string|undefined} The uid.
|
|
5792
|
+
*/
|
|
5793
|
+
getSopClassUid(): string | undefined;
|
|
5528
5794
|
/**
|
|
5529
5795
|
* Get the window/level presets names.
|
|
5530
5796
|
*
|
|
@@ -5562,6 +5828,12 @@ export declare class ViewController {
|
|
|
5562
5828
|
* @returns {PositionHelper} The helper.
|
|
5563
5829
|
*/
|
|
5564
5830
|
getPositionHelper(): PositionHelper;
|
|
5831
|
+
/**
|
|
5832
|
+
* Get a clone of the position helper.
|
|
5833
|
+
*
|
|
5834
|
+
* @returns {PositionHelper} The helper clone.
|
|
5835
|
+
*/
|
|
5836
|
+
getPositionHelperClone(): PositionHelper;
|
|
5565
5837
|
/**
|
|
5566
5838
|
* Get the current position.
|
|
5567
5839
|
*
|
|
@@ -5673,6 +5945,12 @@ export declare class ViewController {
|
|
|
5673
5945
|
* @returns {string} The unit.
|
|
5674
5946
|
*/
|
|
5675
5947
|
getPixelUnit(): string;
|
|
5948
|
+
/**
|
|
5949
|
+
* Get the image length unit.
|
|
5950
|
+
*
|
|
5951
|
+
* @returns {string} The unit.
|
|
5952
|
+
*/
|
|
5953
|
+
getLengthUnit(): string;
|
|
5676
5954
|
/**
|
|
5677
5955
|
* Get some values from the associated image in a region.
|
|
5678
5956
|
*
|