dwv 0.35.0-beta.20 → 0.35.0-beta.22

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
+ * ID, strored as tracking id, this id is not unique.
21
21
  *
22
22
  * @type {string}
23
23
  */
24
24
  id: string;
25
25
  /**
26
- * The reference image SOP UID.
26
+ * UID, stored as tracking unique id.
27
27
  *
28
28
  * @type {string}
29
29
  */
30
- referenceSopUID: string;
30
+ uid: 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,10 @@ export declare class Annotation {
78
96
  * @type {Point3D[]|undefined}
79
97
  */
80
98
  planePoints: Point3D[] | undefined;
99
+ /**
100
+ * Set the annotation id and uid.
101
+ */
102
+ setIds(): void;
81
103
  /**
82
104
  * Get the concepts ids of the annotation meta data.
83
105
  *
@@ -96,9 +118,9 @@ export declare class Annotation {
96
118
  * Add annotation meta data.
97
119
  *
98
120
  * @param {DicomCode} concept The concept code.
99
- * @param {DicomCode} value The value code.
121
+ * @param {DicomCode|string} value The value code.
100
122
  */
101
- addMetaItem(concept: DicomCode, value: DicomCode): void;
123
+ addMetaItem(concept: DicomCode, value: DicomCode | string): void;
102
124
  /**
103
125
  * Remove an annotation meta data.
104
126
  *
@@ -118,6 +140,13 @@ export declare class Annotation {
118
140
  * @param {ViewController} viewController The associated view controller.
119
141
  */
120
142
  init(viewController: ViewController): void;
143
+ /**
144
+ * Check if the annotation can be displayed: true if it has
145
+ * an associated view controller.
146
+ *
147
+ * @returns {boolean} True if the annotation can be displayed.
148
+ */
149
+ canView(): boolean;
121
150
  /**
122
151
  * Check if an input view is compatible with the annotation.
123
152
  *
@@ -227,9 +256,9 @@ export declare class AnnotationGroup {
227
256
  /**
228
257
  * Remove an annotation.
229
258
  *
230
- * @param {string} id The id of the annotation to remove.
259
+ * @param {string} uid The UID of the annotation to remove.
231
260
  */
232
- remove(id: string): void;
261
+ remove(uid: string): void;
233
262
  /**
234
263
  * Set the associated view controller.
235
264
  *
@@ -239,10 +268,10 @@ export declare class AnnotationGroup {
239
268
  /**
240
269
  * Find an annotation.
241
270
  *
242
- * @param {string} id The id of the annotation to find.
271
+ * @param {string} uid The UID of the annotation to find.
243
272
  * @returns {Annotation|undefined} The found annotation.
244
273
  */
245
- find(id: string): Annotation | undefined;
274
+ find(uid: string): Annotation | undefined;
246
275
  /**
247
276
  * Get the meta data.
248
277
  *
@@ -262,9 +291,9 @@ export declare class AnnotationGroup {
262
291
  * Get a meta data value.
263
292
  *
264
293
  * @param {string} key The meta data key.
265
- * @returns {string|object} The meta data value.
294
+ * @returns {string|object|undefined} The meta data value.
266
295
  */
267
- getMetaValue(key: string): string | object;
296
+ getMetaValue(key: string): string | object | undefined;
268
297
  /**
269
298
  * Set a meta data.
270
299
  *
@@ -1500,11 +1529,11 @@ export declare class DicomSRContent {
1500
1529
  */
1501
1530
  relationshipType: string;
1502
1531
  /**
1503
- * Content sequence (0040,A730).
1532
+ * Content sequence.
1504
1533
  *
1505
- * @type {DicomSRContent[]|undefined}
1534
+ * @type {DicomSRContent[]}
1506
1535
  */
1507
- contentSequence: DicomSRContent[] | undefined;
1536
+ contentSequence: DicomSRContent[];
1508
1537
  /**
1509
1538
  * Value.
1510
1539
  *
@@ -1518,6 +1547,15 @@ export declare class DicomSRContent {
1518
1547
  * @returns {string} The object as string.
1519
1548
  */
1520
1549
  toString(prefix?: string): string;
1550
+ /**
1551
+ * Check if this content has input header values.
1552
+ *
1553
+ * @param {string} valueType The value type.
1554
+ * @param {DicomCode} conceptNameCode The concept name code.
1555
+ * @param {string} relationshipType The relationship type.
1556
+ * @returns {boolean} True if equal.
1557
+ */
1558
+ hasHeader(valueType: string, conceptNameCode: DicomCode, relationshipType: string): boolean;
1521
1559
  }
1522
1560
 
1523
1561
  /**
@@ -1615,10 +1653,10 @@ export declare class DrawController {
1615
1653
  /**
1616
1654
  * Get an annotation.
1617
1655
  *
1618
- * @param {string} id The annotation id.
1656
+ * @param {string} uid The annotation UID.
1619
1657
  * @returns {Annotation|undefined} The annotation.
1620
1658
  */
1621
- getAnnotation(id: string): Annotation | undefined;
1659
+ getAnnotation(uid: string): Annotation | undefined;
1622
1660
  /**
1623
1661
  * Get the annotation group.
1624
1662
  *
@@ -1653,27 +1691,27 @@ export declare class DrawController {
1653
1691
  /**
1654
1692
  * Remove an anotation for the list.
1655
1693
  *
1656
- * @param {string} id The id of the annotation to remove.
1694
+ * @param {string} uid The UID of the annotation to remove.
1657
1695
  */
1658
- removeAnnotation(id: string): void;
1696
+ removeAnnotation(uid: string): void;
1659
1697
  /**
1660
1698
  * Remove an annotation via a remove command (triggers draw actions).
1661
1699
  *
1662
- * @param {string} id The annotation id.
1700
+ * @param {string} uid The annotation UID.
1663
1701
  * @param {Function} exeCallback The undo stack callback.
1664
1702
  */
1665
- removeAnnotationWithCommand(id: string, exeCallback: Function): void;
1703
+ removeAnnotationWithCommand(uid: string, exeCallback: Function): void;
1666
1704
  /**
1667
1705
  * Update an annotation via an update command (triggers draw actions).
1668
1706
  *
1669
- * @param {string} id The annotation id.
1707
+ * @param {string} uid The annotation UID.
1670
1708
  * @param {object} originalProps The original annotation properties
1671
1709
  * that will be updated.
1672
1710
  * @param {object} newProps The new annotation properties
1673
1711
  * that will replace the original ones.
1674
1712
  * @param {Function} exeCallback The undo stack callback.
1675
1713
  */
1676
- updateAnnotationWithCommand(id: string, originalProps: object, newProps: object, exeCallback: Function): void;
1714
+ updateAnnotationWithCommand(uid: string, originalProps: object, newProps: object, exeCallback: Function): void;
1677
1715
  /**
1678
1716
  * Remove all annotations via remove commands (triggers draw actions).
1679
1717
  *
@@ -2302,6 +2340,21 @@ export declare class Geometry {
2302
2340
  #private;
2303
2341
  }
2304
2342
 
2343
+ /**
2344
+ * Get the meta data as simple elements:
2345
+ * - indexed by tag names instead of tag keys,
2346
+ * - no element object, just value if not sequence nor merged item.
2347
+ *
2348
+ * @param {Object<string, DataElement>} metaData The meta data
2349
+ * index by tag keys.
2350
+ * @returns {Object<string, any>} The simple elements.
2351
+ */
2352
+ export declare function getAsSimpleElements(metaData: {
2353
+ [x: string]: DataElement;
2354
+ }): {
2355
+ [x: string]: any;
2356
+ };
2357
+
2305
2358
  /**
2306
2359
  * Get the default DICOM seg tags as an object.
2307
2360
  *
@@ -2411,6 +2464,13 @@ export declare function getRectangleIndices(center: Index, size: number[], dir:
2411
2464
  */
2412
2465
  export declare function getReverseOrientation(ori: string): string;
2413
2466
 
2467
+ /**
2468
+ * Get a segmentation DICOM code.
2469
+ *
2470
+ * @returns {DicomCode} The code.
2471
+ */
2472
+ export declare function getSegmentationCode(): DicomCode;
2473
+
2414
2474
  /**
2415
2475
  * Get a content item object from a dicom element.
2416
2476
  *
@@ -2476,6 +2536,14 @@ export declare function getUID(tagName: string): string;
2476
2536
  */
2477
2537
  export declare function hasDicomPrefix(buffer: ArrayBuffer): boolean;
2478
2538
 
2539
+ /**
2540
+ * Convert a hex color into RGB.
2541
+ *
2542
+ * @param {string} hexStr The hex color as '#ab01ef'.
2543
+ * @returns {RGB} The RGB values as {r,g,b}.
2544
+ */
2545
+ export declare function hexToRgb(hexStr: string): RGB;
2546
+
2479
2547
  export declare namespace i18n {
2480
2548
  /**
2481
2549
  * Get the translated text.
@@ -4354,12 +4422,20 @@ export declare class PositionHelper {
4354
4422
  *
4355
4423
  * Inspired from {@link https://stackoverflow.com/a/49729715/3639892}.
4356
4424
  *
4357
- * Can be a solution to not have trailing zero as when
4358
- * using toFixed or toPrecision.
4359
- * '+number.toFixed(precision)' does not pass all the tests...
4425
+ * `toPrecision` uses all non zero digits of the number:
4426
+ * (123.009).toPrecision(4) = "123.0";
4427
+ * (0.09).toPrecision(4) = "0.09000".
4428
+ *
4429
+ * `toFixed` does not always behave as expected:
4430
+ * (123.009).toFixed(2) = "123.01";
4431
+ * (0.009).toFixed(2) = "0.01";
4432
+ * but
4433
+ * (-0.005).toFixed(2) = "-0.01" (expecting 0);
4434
+ * (1.005).toFixed(2) = "1" (expecting 1.01).
4360
4435
  *
4361
4436
  * @param {number} number The number to round.
4362
- * @param {number} precision The rounding precision.
4437
+ * @param {number} precision The rounding precision, ie the result number
4438
+ * of digits after the comma.
4363
4439
  * @returns {number} The rounded number.
4364
4440
  */
4365
4441
  export declare function precisionRound(number: number, precision: number): number;
@@ -4571,6 +4647,14 @@ export declare class RGB {
4571
4647
  b: number;
4572
4648
  }
4573
4649
 
4650
+ /**
4651
+ * Convert RGB to its hex equivalent.
4652
+ *
4653
+ * @param {RGB} rgb The RGB object as {r,g,b}.
4654
+ * @returns {string} A string representing the hex color as '#ab01ef'.
4655
+ */
4656
+ export declare function rgbToHex(rgb: RGB): string;
4657
+
4574
4658
  /**
4575
4659
  * Region Of Interest shape.
4576
4660
  * Note: should be a closed path.
@@ -4922,6 +5006,12 @@ export declare class Tag {
4922
5006
  * @returns {string|undefined} The VR.
4923
5007
  */
4924
5008
  getVrFromDictionary(): string | undefined;
5009
+ /**
5010
+ * Get the multiplicity from the dicom dictionary.
5011
+ *
5012
+ * @returns {number|undefined} The multiplicity.
5013
+ */
5014
+ getMultiplicityFromDictionary(): number | undefined;
4925
5015
  /**
4926
5016
  * Get the tag name from the dicom dictionary.
4927
5017
  *
@@ -5091,7 +5181,7 @@ export declare const toolList: {
5091
5181
  * const group = new Konva.Group();
5092
5182
  * group.name('love-group');
5093
5183
  * group.visible(true);
5094
- * group.id(annotation.id);
5184
+ * group.id(annotation.uid);
5095
5185
  * group.add(shape);
5096
5186
  * return group;
5097
5187
  * }
@@ -5576,6 +5666,12 @@ export declare class ViewController {
5576
5666
  * @returns {string} The modality.
5577
5667
  */
5578
5668
  getModality(): string;
5669
+ /**
5670
+ * Get the image SOP class UID.
5671
+ *
5672
+ * @returns {string|undefined} The uid.
5673
+ */
5674
+ getSopClassUid(): string | undefined;
5579
5675
  /**
5580
5676
  * Get the window/level presets names.
5581
5677
  *