dwv 0.35.0-beta.8 → 0.35.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/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
- * The ID.
20
+ * Tracking id, unique within domain.
21
21
  *
22
22
  * @type {string}
23
23
  */
24
- id: string;
24
+ trackingId: string;
25
25
  /**
26
- * The reference image SOP UID.
26
+ * Tracking Unique id.
27
27
  *
28
28
  * @type {string}
29
29
  */
30
- referenceSopUID: string;
30
+ trackingUid: string;
31
31
  /**
32
- * The mathematical shape.
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
- * The color: for example 'green', '#00ff00' or 'rgb(0,255,0)'.
62
+ * Colour: for example 'green', '#00ff00' or 'rgb(0,255,0)'.
45
63
  *
46
- * @type {string|undefined}
64
+ * @type {string}
47
65
  */
48
- colour: string | undefined;
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
- * be extracted from the quantification object.
75
+ * be extracted from the quantification object.
58
76
  *
59
- * @type {string|undefined}
77
+ * @type {string}
60
78
  */
61
- textExpr: string | undefined;
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
- * The plane origin, the 3D position of index [0, 0, k].
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} id The id of the annotation to remove.
257
+ * @param {string} uid The UID of the annotation to remove.
204
258
  */
205
- remove(id: string): void;
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} id The id of the annotation to find.
269
+ * @param {string} uid The UID of the annotation to find.
216
270
  * @returns {Annotation|undefined} The found annotation.
217
271
  */
218
- find(id: string): Annotation | undefined;
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. Throws an error if not suitable.
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 Annotation} object from the read DICOM file.
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
- * Convert an annotation group into a DICOM SR object.
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
 
@@ -547,8 +626,18 @@ export declare class App {
547
626
  reset(): void;
548
627
  /**
549
628
  * Reset the layout of the application.
629
+ *
630
+ * @deprecated Since v0.35, prefer resetZoomPan.
550
631
  */
551
632
  resetLayout(): void;
633
+ /**
634
+ * Reset the zoom and pan of the stage.
635
+ */
636
+ resetZoomPan(): void;
637
+ /**
638
+ * Reset the position and window level of the stage.
639
+ */
640
+ resetViews(): void;
552
641
  /**
553
642
  * Add an event listener to this class.
554
643
  *
@@ -569,6 +658,7 @@ export declare class App {
569
658
  * Load a list of files. Can be image files or a state file.
570
659
  *
571
660
  * @param {File[]} files The list of files to load.
661
+ * @returns {string} The data ID, '-1' if problem.
572
662
  * @fires App#loadstart
573
663
  * @fires App#loadprogress
574
664
  * @fires App#loaditem
@@ -577,7 +667,7 @@ export declare class App {
577
667
  * @fires App#abort
578
668
  * @function
579
669
  */
580
- loadFiles: (files: File[]) => void;
670
+ loadFiles: (files: File[]) => string;
581
671
  /**
582
672
  * Load a list of URLs. Can be image files or a state file.
583
673
  *
@@ -586,6 +676,7 @@ export declare class App {
586
676
  * - requestHeaders: an array of {name, value} to use as request headers,
587
677
  * - withCredentials: boolean xhr.withCredentials flag to pass to the request,
588
678
  * - batchSize: the size of the request url batch.
679
+ * @returns {string} The data ID, '-1' if problem.
589
680
  * @fires App#loadstart
590
681
  * @fires App#loadprogress
591
682
  * @fires App#loaditem
@@ -594,7 +685,7 @@ export declare class App {
594
685
  * @fires App#abort
595
686
  * @function
596
687
  */
597
- loadURLs: (urls: string[], options?: object) => void;
688
+ loadURLs: (urls: string[], options?: object) => string;
598
689
  /**
599
690
  * Load from an input uri.
600
691
  *
@@ -608,6 +699,7 @@ export declare class App {
608
699
  *
609
700
  * @param {Array} data The list of ArrayBuffers to load
610
701
  * in the form of [{name: "", filename: "", data: data}].
702
+ * @returns {string} The data ID.
611
703
  * @fires App#loadstart
612
704
  * @fires App#loadprogress
613
705
  * @fires App#loaditem
@@ -616,7 +708,7 @@ export declare class App {
616
708
  * @fires App#abort
617
709
  * @function
618
710
  */
619
- loadImageObject: (data: any[]) => void;
711
+ loadImageObject: (data: any[]) => string;
620
712
  /**
621
713
  * Abort all the current loads.
622
714
  */
@@ -693,6 +785,8 @@ export declare class App {
693
785
  addDataViewConfig(dataId: string, config: ViewConfig): void;
694
786
  /**
695
787
  * Remove a data view config.
788
+ * Removes the associated layer if found, removes
789
+ * the layer group if empty.
696
790
  *
697
791
  * @param {string} dataId The data id.
698
792
  * @param {string} divId The div id.
@@ -970,6 +1064,24 @@ export declare class AppOptions {
970
1064
  */
971
1065
  export declare function buildMultipart(parts: any[], boundary: string): Uint8Array;
972
1066
 
1067
+ /**
1068
+ * CAD report class.
1069
+ */
1070
+ export declare class CADReport {
1071
+ /**
1072
+ * @type {AnnotationGroup[]}
1073
+ */
1074
+ annotationGroups: AnnotationGroup[];
1075
+ /**
1076
+ * @type {ResponseEvaluation[]}
1077
+ */
1078
+ responseEvaluations: ResponseEvaluation[];
1079
+ /**
1080
+ * @type {string}
1081
+ */
1082
+ comment: string;
1083
+ }
1084
+
973
1085
  /**
974
1086
  * Change segment colour command.
975
1087
  */
@@ -1231,16 +1343,6 @@ export declare class DataElement {
1231
1343
  items: any[];
1232
1344
  }
1233
1345
 
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
1346
  /**
1245
1347
  * Delete segment command.
1246
1348
  */
@@ -1343,15 +1445,19 @@ export declare class DicomCode {
1343
1445
  */
1344
1446
  export declare class DicomData {
1345
1447
  /**
1346
- * @param {object} meta The DICOM meta data.
1448
+ * @param {Object<string, DataElement>} meta The DICOM meta data.
1347
1449
  */
1348
- constructor(meta: object);
1450
+ constructor(meta: {
1451
+ [x: string]: DataElement;
1452
+ });
1349
1453
  /**
1350
1454
  * DICOM meta data.
1351
1455
  *
1352
- * @type {object}
1456
+ * @type {Object<string, DataElement>}
1353
1457
  */
1354
- meta: object;
1458
+ meta: {
1459
+ [x: string]: DataElement;
1460
+ };
1355
1461
  /**
1356
1462
  * Image extracted from meta data.
1357
1463
  *
@@ -1364,6 +1470,12 @@ export declare class DicomData {
1364
1470
  * @type {AnnotationGroup|undefined}
1365
1471
  */
1366
1472
  annotationGroup: AnnotationGroup | undefined;
1473
+ /**
1474
+ * Image buffer used to build image.
1475
+ *
1476
+ * @type {any|undefined}
1477
+ */
1478
+ buffer: any | undefined;
1367
1479
  }
1368
1480
 
1369
1481
  /**
@@ -1466,11 +1578,11 @@ export declare class DicomSRContent {
1466
1578
  */
1467
1579
  relationshipType: string;
1468
1580
  /**
1469
- * Content sequence (0040,A730).
1581
+ * Content sequence.
1470
1582
  *
1471
- * @type {DicomSRContent[]|undefined}
1583
+ * @type {DicomSRContent[]}
1472
1584
  */
1473
- contentSequence: DicomSRContent[] | undefined;
1585
+ contentSequence: DicomSRContent[];
1474
1586
  /**
1475
1587
  * Value.
1476
1588
  *
@@ -1484,6 +1596,15 @@ export declare class DicomSRContent {
1484
1596
  * @returns {string} The object as string.
1485
1597
  */
1486
1598
  toString(prefix?: string): string;
1599
+ /**
1600
+ * Check if this content has input header values.
1601
+ *
1602
+ * @param {string} valueType The value type.
1603
+ * @param {DicomCode} conceptNameCode The concept name code.
1604
+ * @param {string} relationshipType The relationship type.
1605
+ * @returns {boolean} True if equal.
1606
+ */
1607
+ hasHeader(valueType: string, conceptNameCode: DicomCode, relationshipType: string): boolean;
1487
1608
  }
1488
1609
 
1489
1610
  /**
@@ -1581,10 +1702,10 @@ export declare class DrawController {
1581
1702
  /**
1582
1703
  * Get an annotation.
1583
1704
  *
1584
- * @param {string} id The annotation id.
1705
+ * @param {string} uid The annotation UID.
1585
1706
  * @returns {Annotation|undefined} The annotation.
1586
1707
  */
1587
- getAnnotation(id: string): Annotation | undefined;
1708
+ getAnnotation(uid: string): Annotation | undefined;
1588
1709
  /**
1589
1710
  * Get the annotation group.
1590
1711
  *
@@ -1614,32 +1735,34 @@ export declare class DrawController {
1614
1735
  *
1615
1736
  * @param {Annotation} annotation The annotation to update.
1616
1737
  * @param {string[]} [propKeys] Optional properties that got updated.
1738
+ * @param {boolean} [propagate] Whether the update event propagates
1739
+ * outside of dwv or not, defaults to true.
1617
1740
  */
1618
- updateAnnotation(annotation: Annotation, propKeys?: string[]): void;
1741
+ updateAnnotation(annotation: Annotation, propKeys?: string[], propagate?: boolean): void;
1619
1742
  /**
1620
1743
  * Remove an anotation for the list.
1621
1744
  *
1622
- * @param {string} id The id of the annotation to remove.
1745
+ * @param {string} uid The UID of the annotation to remove.
1623
1746
  */
1624
- removeAnnotation(id: string): void;
1747
+ removeAnnotation(uid: string): void;
1625
1748
  /**
1626
1749
  * Remove an annotation via a remove command (triggers draw actions).
1627
1750
  *
1628
- * @param {string} id The annotation id.
1751
+ * @param {string} uid The annotation UID.
1629
1752
  * @param {Function} exeCallback The undo stack callback.
1630
1753
  */
1631
- removeAnnotationWithCommand(id: string, exeCallback: Function): void;
1754
+ removeAnnotationWithCommand(uid: string, exeCallback: Function): void;
1632
1755
  /**
1633
1756
  * Update an annotation via an update command (triggers draw actions).
1634
1757
  *
1635
- * @param {string} id The annotation id.
1758
+ * @param {string} uid The annotation UID.
1636
1759
  * @param {object} originalProps The original annotation properties
1637
1760
  * that will be updated.
1638
1761
  * @param {object} newProps The new annotation properties
1639
1762
  * that will replace the original ones.
1640
1763
  * @param {Function} exeCallback The undo stack callback.
1641
1764
  */
1642
- updateAnnotationWithCommand(id: string, originalProps: object, newProps: object, exeCallback: Function): void;
1765
+ updateAnnotationWithCommand(uid: string, originalProps: object, newProps: object, exeCallback: Function): void;
1643
1766
  /**
1644
1767
  * Remove all annotations via remove commands (triggers draw actions).
1645
1768
  *
@@ -1692,7 +1815,7 @@ export declare class DrawLayer {
1692
1815
  */
1693
1816
  getDataId(): string;
1694
1817
  /**
1695
- * Get the reference data id.
1818
+ * Get the reference layer id.
1696
1819
  *
1697
1820
  * @returns {string} The id.
1698
1821
  */
@@ -2138,11 +2261,11 @@ export declare class Geometry {
2138
2261
  * Check if a point is in the origin list.
2139
2262
  *
2140
2263
  * @param {Point3D} point3D The point to check.
2141
- * @param {number} tol The comparison tolerance
2142
- * default to Number.EPSILON.
2264
+ * @param {number} [tol] Optional number comparison tolerance
2265
+ * defaults to Number.EPSILON.
2143
2266
  * @returns {boolean} True if in list.
2144
2267
  */
2145
- includesOrigin(point3D: Point3D, tol: number): boolean;
2268
+ includesOrigin(point3D: Point3D, tol?: number): boolean;
2146
2269
  /**
2147
2270
  * Get the object size.
2148
2271
  * Warning: the size comes as stored in DICOM, meaning that it could
@@ -2268,6 +2391,21 @@ export declare class Geometry {
2268
2391
  #private;
2269
2392
  }
2270
2393
 
2394
+ /**
2395
+ * Get the meta data as simple elements:
2396
+ * - indexed by tag names instead of tag keys,
2397
+ * - no element object, just value if not sequence nor merged item.
2398
+ *
2399
+ * @param {Object<string, DataElement>} metaData The meta data
2400
+ * index by tag keys.
2401
+ * @returns {Object<string, any>} The simple elements.
2402
+ */
2403
+ export declare function getAsSimpleElements(metaData: {
2404
+ [x: string]: DataElement;
2405
+ }): {
2406
+ [x: string]: any;
2407
+ };
2408
+
2271
2409
  /**
2272
2410
  * Get the default DICOM seg tags as an object.
2273
2411
  *
@@ -2377,6 +2515,13 @@ export declare function getRectangleIndices(center: Index, size: number[], dir:
2377
2515
  */
2378
2516
  export declare function getReverseOrientation(ori: string): string;
2379
2517
 
2518
+ /**
2519
+ * Get a segmentation DICOM code.
2520
+ *
2521
+ * @returns {DicomCode} The code.
2522
+ */
2523
+ export declare function getSegmentationCode(): DicomCode;
2524
+
2380
2525
  /**
2381
2526
  * Get a content item object from a dicom element.
2382
2527
  *
@@ -2442,6 +2587,14 @@ export declare function getUID(tagName: string): string;
2442
2587
  */
2443
2588
  export declare function hasDicomPrefix(buffer: ArrayBuffer): boolean;
2444
2589
 
2590
+ /**
2591
+ * Convert a hex color into RGB.
2592
+ *
2593
+ * @param {string} hexStr The hex color as '#ab01ef'.
2594
+ * @returns {RGB} The RGB values as {r,g,b}.
2595
+ */
2596
+ export declare function hexToRgb(hexStr: string): RGB;
2597
+
2445
2598
  export declare namespace i18n {
2446
2599
  /**
2447
2600
  * Get the translated text.
@@ -2449,7 +2602,7 @@ export declare namespace i18n {
2449
2602
  * @param {string} key The key to the text entry.
2450
2603
  * @returns {string|undefined} The translated text.
2451
2604
  */
2452
- export function t(key: string): string;
2605
+ export function t(key: string): string | undefined;
2453
2606
  }
2454
2607
 
2455
2608
  /**
@@ -2882,6 +3035,10 @@ declare class Image_2 {
2882
3035
  * Note: Uses the raw buffer values.
2883
3036
  */
2884
3037
  compose(rhs: Image_2, operator: Function): Image_2;
3038
+ /**
3039
+ * Recalculate labels.
3040
+ */
3041
+ recalculateLabels(): void;
2885
3042
  #private;
2886
3043
  }
2887
3044
  export { Image_2 as Image }
@@ -3086,7 +3243,7 @@ export declare class LayerGroup {
3086
3243
  */
3087
3244
  includes(id: string): boolean;
3088
3245
  /**
3089
- * Get a list of view layers according to an input callback function.
3246
+ * Get the view layers that satisfy the input callback function.
3090
3247
  *
3091
3248
  * @param {Function} [callbackFn] A function that takes
3092
3249
  * a ViewLayer as input and returns a boolean. If undefined,
@@ -3095,6 +3252,17 @@ export declare class LayerGroup {
3095
3252
  * satisfy the callbackFn.
3096
3253
  */
3097
3254
  getViewLayers(callbackFn?: Function): ViewLayer[];
3255
+ /**
3256
+ * Get the view layers that satisfy the input callback function
3257
+ * starting from the active layer.
3258
+ *
3259
+ * @param {Function} [callbackFn] A function that takes
3260
+ * a ViewLayer as input and returns a boolean. If undefined,
3261
+ * returns all view layers.
3262
+ * @returns {ViewLayer[]} The layers that
3263
+ * satisfy the callbackFn.
3264
+ */
3265
+ getViewLayersFromActive(callbackFn?: Function): ViewLayer[];
3098
3266
  /**
3099
3267
  * Test if one of the view layers satisfies an input callbackFn.
3100
3268
  *
@@ -3120,6 +3288,12 @@ export declare class LayerGroup {
3120
3288
  * @returns {number} The number of layers.
3121
3289
  */
3122
3290
  getNumberOfViewLayers(): number;
3291
+ /**
3292
+ * Get the active image layer.
3293
+ *
3294
+ * @returns {ViewLayer|DrawLayer|undefined} The layer.
3295
+ */
3296
+ getActiveLayer(): ViewLayer | DrawLayer | undefined;
3123
3297
  /**
3124
3298
  * Get the active image layer.
3125
3299
  *
@@ -3132,6 +3306,13 @@ export declare class LayerGroup {
3132
3306
  * @returns {ViewLayer|undefined} The layer.
3133
3307
  */
3134
3308
  getBaseViewLayer(): ViewLayer | undefined;
3309
+ /**
3310
+ * Get a view layer associated to a data id.
3311
+ *
3312
+ * @param {string} id The layer id.
3313
+ * @returns {ViewLayer|undefined} The layer.
3314
+ */
3315
+ getViewLayerById(id: string): ViewLayer | undefined;
3135
3316
  /**
3136
3317
  * Get the view layers associated to a data id.
3137
3318
  *
@@ -3140,7 +3321,7 @@ export declare class LayerGroup {
3140
3321
  */
3141
3322
  getViewLayersByDataId(dataId: string): ViewLayer[];
3142
3323
  /**
3143
- * Search view layers for equal imae meta data.
3324
+ * Search view layers for equal image meta data.
3144
3325
  *
3145
3326
  * @param {object} meta The meta data to find.
3146
3327
  * @returns {ViewLayer[]} The list of view layers that contain matched data.
@@ -3158,6 +3339,13 @@ export declare class LayerGroup {
3158
3339
  * @returns {DrawLayer|undefined} The layer.
3159
3340
  */
3160
3341
  getActiveDrawLayer(): DrawLayer | undefined;
3342
+ /**
3343
+ * Get a draw layer associated to a data id.
3344
+ *
3345
+ * @param {string} id The layer id.
3346
+ * @returns {DrawLayer|undefined} The layer.
3347
+ */
3348
+ getDrawLayerById(id: string): DrawLayer | undefined;
3161
3349
  /**
3162
3350
  * Get the draw layers associated to a data id.
3163
3351
  *
@@ -3166,30 +3354,23 @@ export declare class LayerGroup {
3166
3354
  */
3167
3355
  getDrawLayersByDataId(dataId: string): DrawLayer[];
3168
3356
  /**
3169
- * Set the active view layer.
3357
+ * Set the active layer.
3170
3358
  *
3171
3359
  * @param {number} index The index of the layer to set as active.
3172
3360
  */
3173
- setActiveViewLayer(index: number): void;
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;
3361
+ setActiveLayer(index: number): void;
3180
3362
  /**
3181
- * Set the active draw layer.
3363
+ * Set the active layer with a layer id.
3182
3364
  *
3183
- * @param {number|undefined} index The index of the layer to set as active
3184
- * or undefined to not set any.
3365
+ * @param {string} id The layer id.
3185
3366
  */
3186
- setActiveDrawLayer(index: number | undefined): void;
3367
+ setActiveLayerById(id: string): void;
3187
3368
  /**
3188
- * Set the active draw layer with a data id.
3369
+ * Set the active layer with a data id.
3189
3370
  *
3190
3371
  * @param {string} dataId The data id.
3191
3372
  */
3192
- setActiveDrawLayerByDataId(dataId: string): void;
3373
+ setActiveLayerByDataId(dataId: string): void;
3193
3374
  /**
3194
3375
  * Add a view layer.
3195
3376
  *
@@ -3223,6 +3404,7 @@ export declare class LayerGroup {
3223
3404
  * methods to define the active index.
3224
3405
  *
3225
3406
  * @param {ViewLayer | DrawLayer} layer The layer to remove.
3407
+ * @fires LayerGroup#removelayer
3226
3408
  */
3227
3409
  removeLayer(layer: ViewLayer | DrawLayer): void;
3228
3410
  /**
@@ -3317,8 +3499,18 @@ export declare class LayerGroup {
3317
3499
  setOffset(newOffset: Scalar3D): void;
3318
3500
  /**
3319
3501
  * Reset the stage to its initial scale and no offset.
3502
+ *
3503
+ * @deprecated Since v0.35, prefer resetZoomPan.
3320
3504
  */
3321
3505
  reset(): void;
3506
+ /**
3507
+ * Reset the zoom and pan of all layers.
3508
+ */
3509
+ resetZoomPan(): void;
3510
+ /**
3511
+ * Reset the position and window level of all view layers.
3512
+ */
3513
+ resetViews(): void;
3322
3514
  /**
3323
3515
  * Draw the layer.
3324
3516
  */
@@ -3385,10 +3577,11 @@ export declare class MaskFactory {
3385
3577
  */
3386
3578
  getWarning(): string | undefined;
3387
3579
  /**
3388
- * Check dicom elements. Throws an error if not suitable.
3580
+ * Check dicom elements.
3389
3581
  *
3390
3582
  * @param {Object<string, DataElement>} _dicomElements The DICOM tags.
3391
3583
  * @returns {string|undefined} A possible warning.
3584
+ * @throws Error for missing or wrong data.
3392
3585
  */
3393
3586
  checkElements(_dicomElements: {
3394
3587
  [x: string]: DataElement;
@@ -3400,11 +3593,14 @@ export declare class MaskFactory {
3400
3593
  * @param {Uint8Array | Int8Array |
3401
3594
  * Uint16Array | Int16Array |
3402
3595
  * Uint32Array | Int32Array} pixelBuffer The pixel buffer.
3596
+ * @param {Image} [refImage] Reference image, code will use its
3597
+ * origins if present (best) or try to calculate them.
3403
3598
  * @returns {Image} A new Image.
3599
+ * @throws Error for missing or wrong data.
3404
3600
  */
3405
3601
  create(dataElements: {
3406
3602
  [x: string]: DataElement;
3407
- }, pixelBuffer: Uint8Array | Int8Array | Uint16Array | Int16Array | Uint32Array | Int32Array): Image_2;
3603
+ }, pixelBuffer: Uint8Array | Int8Array | Uint16Array | Int16Array | Uint32Array | Int32Array, refImage?: Image_2): Image_2;
3408
3604
  /**
3409
3605
  * Convert a mask image into a DICOM segmentation object.
3410
3606
  *
@@ -3622,11 +3818,18 @@ export declare class Matrix33 {
3622
3818
  * Check for Matrix33 equality.
3623
3819
  *
3624
3820
  * @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
3821
  * @returns {boolean} True if both matrices are equal.
3628
3822
  */
3629
- equals(rhs: Matrix33, p?: number): boolean;
3823
+ equals(rhs: Matrix33): boolean;
3824
+ /**
3825
+ * Check for Matrix33 similarity.
3826
+ *
3827
+ * @param {Matrix33} rhs The other matrix to compare to.
3828
+ * @param {number} [tol] Optional number comparison tolerance,
3829
+ * defaults to Number.EPSILON.
3830
+ * @returns {boolean} True if both matrices are similar.
3831
+ */
3832
+ isSimilar(rhs: Matrix33, tol?: number): boolean;
3630
3833
  /**
3631
3834
  * Get a string representation of the Matrix33.
3632
3835
  *
@@ -3901,6 +4104,13 @@ export declare class PlaneHelper {
3901
4104
  * @returns {Index} The corresponding index.
3902
4105
  */
3903
4106
  worldToIndex(point: Point): Index;
4107
+ /**
4108
+ * Image index to world.
4109
+ *
4110
+ * @param {Index} index The input index.
4111
+ * @returns {Point} The corresponding point.
4112
+ */
4113
+ indexToWorld(index: Index): Point;
3904
4114
  /**
3905
4115
  * Is this view in the same orientation as the image aquisition.
3906
4116
  *
@@ -4109,11 +4319,11 @@ export declare class Point3D {
4109
4319
  * Check for Point3D similarity.
4110
4320
  *
4111
4321
  * @param {Point3D} rhs The other point to compare to.
4112
- * @param {number} tol Optional comparison tolerance,
4113
- * default to Number.EPSILON.
4114
- * @returns {boolean} True if both points are equal.
4322
+ * @param {number} [tol] Optional number comparison tolerance,
4323
+ * defaults to Number.EPSILON.
4324
+ * @returns {boolean} True if both points are similar.
4115
4325
  */
4116
- isSimilar(rhs: Point3D, tol: number): boolean;
4326
+ isSimilar(rhs: Point3D, tol?: number): boolean;
4117
4327
  /**
4118
4328
  * Get a string representation of the Point3D.
4119
4329
  *
@@ -4165,11 +4375,18 @@ export declare class PositionHelper {
4165
4375
  */
4166
4376
  getScrollDimIndex(): number;
4167
4377
  /**
4168
- * Get the maximum scroll index.
4378
+ * Get the maximum dimension value.
4379
+ *
4380
+ * @param {number} dim The dimension.
4381
+ * @returns {number} The maximum value.
4382
+ */
4383
+ getMaximumDimValue(dim: number): number;
4384
+ /**
4385
+ * Get the maximum scroll value.
4169
4386
  *
4170
- * @returns {number} The maximum index.
4387
+ * @returns {number} The maximum value.
4171
4388
  */
4172
- getMaximumScrollIndex(): number;
4389
+ getMaximumScrollValue(): number;
4173
4390
  /**
4174
4391
  * Get the current position.
4175
4392
  *
@@ -4177,18 +4394,34 @@ export declare class PositionHelper {
4177
4394
  */
4178
4395
  getCurrentPosition(): Point;
4179
4396
  /**
4180
- * Get the scroll index for the current position.
4397
+ * Get the value at dimension index for the current position.
4181
4398
  *
4182
- * @returns {number} The index.
4399
+ * @param {number} dim The dimension.
4400
+ * @returns {number} The value.
4401
+ */
4402
+ getCurrentPositionDimValue(dim: number): number;
4403
+ /**
4404
+ * Get the value at scroll index for the current position.
4405
+ *
4406
+ * @returns {number} The value.
4407
+ */
4408
+ getCurrentPositionScrollValue(): number;
4409
+ /**
4410
+ * Get the current position updated at the provided dimension index
4411
+ * with the input value.
4412
+ *
4413
+ * @param {number} dim The dimension.
4414
+ * @param {number} value The value to used at dimension index.
4415
+ * @returns {Point} The position.
4183
4416
  */
4184
- getCurrentPositionScrollIndex(): number;
4417
+ getCurrentPositionAtDimValue(dim: number, value: number): Point;
4185
4418
  /**
4186
- * Get the current position updated at the provided scroll index.
4419
+ * Get the current position updated at scroll index with the input value.
4187
4420
  *
4188
- * @param {number} index The scroll index.
4421
+ * @param {number} value The value to use at scroll index.
4189
4422
  * @returns {Point} The position.
4190
4423
  */
4191
- getCurrentPositionAtScrollIndex(index: number): Point;
4424
+ getCurrentPositionAtScrollValue(value: number): Point;
4192
4425
  /**
4193
4426
  * Get the current index.
4194
4427
  *
@@ -4202,7 +4435,7 @@ export declare class PositionHelper {
4202
4435
  * @param {boolean} [silent] Flag to fire event or not.
4203
4436
  * @returns {boolean} True if possible and in bounds.
4204
4437
  */
4205
- setCurrentPositon(position: Point, silent?: boolean): boolean;
4438
+ setCurrentPosition(position: Point, silent?: boolean): boolean;
4206
4439
  /**
4207
4440
  * Set the current position only if it is in the geometry bounds.
4208
4441
  *
@@ -4210,7 +4443,7 @@ export declare class PositionHelper {
4210
4443
  * @param {boolean} [silent] Flag to fire event or not.
4211
4444
  * @returns {boolean} True if possible and in bounds.
4212
4445
  */
4213
- setCurrentPositonSafe(position: Point, silent?: boolean): boolean;
4446
+ setCurrentPositionSafe(position: Point, silent?: boolean): boolean;
4214
4447
  /**
4215
4448
  * Merge with another helper.
4216
4449
  *
@@ -4273,12 +4506,20 @@ export declare class PositionHelper {
4273
4506
  *
4274
4507
  * Inspired from {@link https://stackoverflow.com/a/49729715/3639892}.
4275
4508
  *
4276
- * Can be a solution to not have trailing zero as when
4277
- * using toFixed or toPrecision.
4278
- * '+number.toFixed(precision)' does not pass all the tests...
4509
+ * `toPrecision` uses all non zero digits of the number:
4510
+ * (123.009).toPrecision(4) = "123.0";
4511
+ * (0.09).toPrecision(4) = "0.09000".
4512
+ *
4513
+ * `toFixed` does not always behave as expected:
4514
+ * (123.009).toFixed(2) = "123.01";
4515
+ * (0.009).toFixed(2) = "0.01";
4516
+ * but
4517
+ * (-0.005).toFixed(2) = "-0.01" (expecting 0);
4518
+ * (1.005).toFixed(2) = "1" (expecting 1.01).
4279
4519
  *
4280
4520
  * @param {number} number The number to round.
4281
- * @param {number} precision The rounding precision.
4521
+ * @param {number} precision The rounding precision, ie the result number
4522
+ * of digits after the comma.
4282
4523
  * @returns {number} The rounded number.
4283
4524
  */
4284
4525
  export declare function precisionRound(number: number, precision: number): number;
@@ -4460,6 +4701,24 @@ export declare class RescaleSlopeAndIntercept {
4460
4701
  #private;
4461
4702
  }
4462
4703
 
4704
+ /**
4705
+ * Response evaluation class.
4706
+ */
4707
+ export declare class ResponseEvaluation {
4708
+ /**
4709
+ * Current response.
4710
+ *
4711
+ * @type {DicomCode}
4712
+ */
4713
+ current: DicomCode;
4714
+ /**
4715
+ * Measurement of response (mm).
4716
+ *
4717
+ * @type {number}
4718
+ */
4719
+ measure: number;
4720
+ }
4721
+
4463
4722
  /**
4464
4723
  * RGB colour class.
4465
4724
  */
@@ -4490,6 +4749,14 @@ export declare class RGB {
4490
4749
  b: number;
4491
4750
  }
4492
4751
 
4752
+ /**
4753
+ * Convert RGB to its hex equivalent.
4754
+ *
4755
+ * @param {RGB} rgb The RGB object as {r,g,b}.
4756
+ * @returns {string} A string representing the hex color as '#ab01ef'.
4757
+ */
4758
+ export declare function rgbToHex(rgb: RGB): string;
4759
+
4493
4760
  /**
4494
4761
  * Region Of Interest shape.
4495
4762
  * Note: should be a closed path.
@@ -4536,9 +4803,9 @@ export declare class ROI {
4536
4803
  * a non-self-intersecting closed polygon.
4537
4804
  * Ref: {@link https://en.wikipedia.org/wiki/Centroid#Of_a_polygon}.
4538
4805
  *
4539
- * @returns {Point2D} The centroid point.
4806
+ * @returns {Point2D|undefined} The centroid point.
4540
4807
  */
4541
- getCentroid(): Point2D;
4808
+ getCentroid(): Point2D | undefined;
4542
4809
  #private;
4543
4810
  }
4544
4811
 
@@ -4841,6 +5108,12 @@ export declare class Tag {
4841
5108
  * @returns {string|undefined} The VR.
4842
5109
  */
4843
5110
  getVrFromDictionary(): string | undefined;
5111
+ /**
5112
+ * Get the multiplicity from the dicom dictionary.
5113
+ *
5114
+ * @returns {number|undefined} The multiplicity.
5115
+ */
5116
+ getMultiplicityFromDictionary(): number | undefined;
4844
5117
  /**
4845
5118
  * Get the tag name from the dicom dictionary.
4846
5119
  *
@@ -5010,7 +5283,7 @@ export declare const toolList: {
5010
5283
  * const group = new Konva.Group();
5011
5284
  * group.name('love-group');
5012
5285
  * group.visible(true);
5013
- * group.id(annotation.id);
5286
+ * group.id(annotation.trackingUid);
5014
5287
  * group.add(shape);
5015
5288
  * return group;
5016
5289
  * }
@@ -5311,23 +5584,23 @@ export declare class View {
5311
5584
  */
5312
5585
  getOrigin(position?: Point): Point3D;
5313
5586
  /**
5314
- * Set the current position.
5587
+ * Set the current position via an index.
5315
5588
  *
5316
- * @param {Point} position The new position.
5589
+ * @param {Index} index The new index.
5317
5590
  * @param {boolean} [silent] Flag to fire event or not.
5318
5591
  * @returns {boolean} False if not in bounds.
5319
5592
  * @fires View#positionchange
5320
5593
  */
5321
- setCurrentPosition(position: Point, silent?: boolean): boolean;
5594
+ setCurrentIndex(index: Index, silent?: boolean): boolean;
5322
5595
  /**
5323
- * Set the current index.
5596
+ * Set current position.
5324
5597
  *
5325
- * @param {Index} index The new index.
5598
+ * @param {Point} position The new position.
5326
5599
  * @param {boolean} [silent] Flag to fire event or not.
5327
5600
  * @returns {boolean} False if not in bounds.
5328
5601
  * @fires View#positionchange
5329
5602
  */
5330
- setCurrentIndex(index: Index, silent?: boolean): boolean;
5603
+ setCurrentPosition(position: Point, silent?: boolean): boolean;
5331
5604
  /**
5332
5605
  * Set the view window/level.
5333
5606
  *
@@ -5489,12 +5762,26 @@ export declare class ViewController {
5489
5762
  * Initialise the controller.
5490
5763
  */
5491
5764
  initialise(): void;
5765
+ /**
5766
+ * Reset the window level.
5767
+ */
5768
+ resetWindowLevel(): void;
5769
+ /**
5770
+ * Reset the position.
5771
+ */
5772
+ resetPosition(): void;
5492
5773
  /**
5493
5774
  * Get the image modality.
5494
5775
  *
5495
5776
  * @returns {string} The modality.
5496
5777
  */
5497
5778
  getModality(): string;
5779
+ /**
5780
+ * Get the image SOP class UID.
5781
+ *
5782
+ * @returns {string|undefined} The uid.
5783
+ */
5784
+ getSopClassUid(): string | undefined;
5498
5785
  /**
5499
5786
  * Get the window/level presets names.
5500
5787
  *
@@ -5532,6 +5819,12 @@ export declare class ViewController {
5532
5819
  * @returns {PositionHelper} The helper.
5533
5820
  */
5534
5821
  getPositionHelper(): PositionHelper;
5822
+ /**
5823
+ * Get a clone of the position helper.
5824
+ *
5825
+ * @returns {PositionHelper} The helper clone.
5826
+ */
5827
+ getPositionHelperClone(): PositionHelper;
5535
5828
  /**
5536
5829
  * Get the current position.
5537
5830
  *
@@ -5643,6 +5936,12 @@ export declare class ViewController {
5643
5936
  * @returns {string} The unit.
5644
5937
  */
5645
5938
  getPixelUnit(): string;
5939
+ /**
5940
+ * Get the image length unit.
5941
+ *
5942
+ * @returns {string} The unit.
5943
+ */
5944
+ getLengthUnit(): string;
5646
5945
  /**
5647
5946
  * Get some values from the associated image in a region.
5648
5947
  *