dwv 0.34.0-beta.8 → 0.34.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
@@ -28,12 +28,6 @@ export declare class Annotation {
28
28
  * @type {string}
29
29
  */
30
30
  referenceSopUID: string;
31
- /**
32
- * The position: an Index converted to string.
33
- *
34
- * @type {string}
35
- */
36
- position: string;
37
31
  /**
38
32
  * The mathematical shape.
39
33
  *
@@ -66,23 +60,56 @@ export declare class Annotation {
66
60
  */
67
61
  textExpr: string | undefined;
68
62
  /**
69
- * Label position.
63
+ * Label position. If undefined, the default shape
64
+ * label position will be used.
70
65
  *
71
66
  * @type {Point2D|undefined}
72
67
  */
73
68
  labelPosition: Point2D | undefined;
74
69
  /**
75
- * Set the associated view controller.
70
+ * The plane origin, the 3D position of index [0, 0, k].
71
+ *
72
+ * @type {Point3D|undefined}
73
+ */
74
+ planeOrigin: Point3D | undefined;
75
+ /**
76
+ * A couple of points that help define the annotation plane.
77
+ *
78
+ * @type {Point3D[]|undefined}
79
+ */
80
+ planePoints: Point3D[] | undefined;
81
+ /**
82
+ * Get the orientation name for this annotation.
83
+ *
84
+ * @returns {string|undefined} The orientation name,
85
+ * undefined if same as reference data.
86
+ */
87
+ getOrientationName(): string | undefined;
88
+ /**
89
+ * Initialise the annotation.
76
90
  *
77
91
  * @param {ViewController} viewController The associated view controller.
78
92
  */
93
+ init(viewController: ViewController): void;
94
+ /**
95
+ * Check if an input view is compatible with the annotation.
96
+ *
97
+ * @param {PlaneHelper} planeHelper The input view to check.
98
+ * @returns {boolean} True if compatible view.
99
+ */
100
+ isCompatibleView(planeHelper: PlaneHelper): boolean;
101
+ /**
102
+ * Set the associated view controller if it is compatible.
103
+ *
104
+ * @param {ViewController} viewController The view controller.
105
+ */
79
106
  setViewController(viewController: ViewController): void;
80
107
  /**
81
- * Get the image origin for a image UID.
108
+ * Get the centroid of the math shape.
82
109
  *
83
- * @returns {Index|undefined} The origin index.
110
+ * @returns {Point|undefined} The 3D centroid point.
84
111
  */
85
- getOriginIndex(): Index | undefined;
112
+ getCentroid(): Point | undefined;
86
113
  /**
87
114
  * Set the annotation text expression.
88
115
  *
@@ -109,56 +136,6 @@ export declare class Annotation {
109
136
  * @returns {object} The factory.
110
137
  */
111
138
  getFactory(): object;
112
- /**
113
- * Get the string type of this annotation.
114
- *
115
- * @returns {string} The type.
116
- */
117
- getType(): string;
118
- #private;
119
- }
120
-
121
- /**
122
- * {@link Annotation} factory.
123
- */
124
- export declare class AnnotationFactory {
125
- /**
126
- * Get a warning string if elements are not as expected.
127
- * Created by checkElements.
128
- *
129
- * @returns {string|undefined} The warning.
130
- */
131
- getWarning(): string | undefined;
132
- /**
133
- * Check dicom elements. Throws an error if not suitable.
134
- *
135
- * @param {Object<string, DataElement>} dataElements The DICOM data elements.
136
- * @returns {string|undefined} A possible warning.
137
- */
138
- checkElements(dataElements: {
139
- [x: string]: DataElement;
140
- }): string | undefined;
141
- /**
142
- * Get an {@link Annotation} object from the read DICOM file.
143
- *
144
- * @param {Object<string, DataElement>} dataElements The DICOM tags.
145
- * @returns {AnnotationGroup} A new annotation group.
146
- */
147
- create(dataElements: {
148
- [x: string]: DataElement;
149
- }): AnnotationGroup;
150
- /**
151
- * Convert an annotation group into a DICOM SR object.
152
- *
153
- * @param {AnnotationGroup} annotationGroup The annotation group.
154
- * @param {Object<string, any>} [extraTags] Optional list of extra tags.
155
- * @returns {Object<string, DataElement>} A list of dicom elements.
156
- */
157
- toDicom(annotationGroup: AnnotationGroup, extraTags?: {
158
- [x: string]: any;
159
- }): {
160
- [x: string]: DataElement;
161
- };
162
139
  #private;
163
140
  }
164
141
 
@@ -195,6 +172,18 @@ export declare class AnnotationGroup {
195
172
  * @param {boolean} flag True to make the annotation group editable.
196
173
  */
197
174
  setEditable(flag: boolean): void;
175
+ /**
176
+ * Get the group colour.
177
+ *
178
+ * @returns {string} The colour as hex string.
179
+ */
180
+ getColour(): string;
181
+ /**
182
+ * Set the group colour.
183
+ *
184
+ * @param {string} colour The colour as hex string.
185
+ */
186
+ setColour(colour: string): void;
198
187
  /**
199
188
  * Add a new annotation.
200
189
  *
@@ -275,6 +264,50 @@ export declare class AnnotationGroup {
275
264
  #private;
276
265
  }
277
266
 
267
+ /**
268
+ * {@link AnnotationGroup} factory.
269
+ */
270
+ export declare class AnnotationGroupFactory {
271
+ /**
272
+ * Get a warning string if elements are not as expected.
273
+ * Created by checkElements.
274
+ *
275
+ * @returns {string|undefined} The warning.
276
+ */
277
+ getWarning(): string | undefined;
278
+ /**
279
+ * Check dicom elements. Throws an error if not suitable.
280
+ *
281
+ * @param {Object<string, DataElement>} dataElements The DICOM data elements.
282
+ * @returns {string|undefined} A possible warning.
283
+ */
284
+ checkElements(dataElements: {
285
+ [x: string]: DataElement;
286
+ }): string | undefined;
287
+ /**
288
+ * Get an {@link Annotation} object from the read DICOM file.
289
+ *
290
+ * @param {Object<string, DataElement>} dataElements The DICOM tags.
291
+ * @returns {AnnotationGroup} A new annotation group.
292
+ */
293
+ create(dataElements: {
294
+ [x: string]: DataElement;
295
+ }): AnnotationGroup;
296
+ /**
297
+ * Convert an annotation group into a DICOM SR object.
298
+ *
299
+ * @param {AnnotationGroup} annotationGroup The annotation group.
300
+ * @param {Object<string, any>} [extraTags] Optional list of extra tags.
301
+ * @returns {Object<string, DataElement>} A list of dicom elements.
302
+ */
303
+ toDicom(annotationGroup: AnnotationGroup, extraTags?: {
304
+ [x: string]: any;
305
+ }): {
306
+ [x: string]: DataElement;
307
+ };
308
+ #private;
309
+ }
310
+
278
311
  /**
279
312
  * List of ViewConfigs indexed by dataIds.
280
313
  *
@@ -304,6 +337,14 @@ export declare class App {
304
337
  * @returns {DicomData|undefined} The data.
305
338
  */
306
339
  getData(dataId: string): DicomData | undefined;
340
+ /**
341
+ * Get the image.
342
+ *
343
+ * @param {string} dataId The data id.
344
+ * @returns {Image|undefined} The associated image.
345
+ * @deprecated Since v0.34, please use the getData method.
346
+ */
347
+ getImage(dataId: string): Image_2 | undefined;
307
348
  /**
308
349
  * Set the image at the given id.
309
350
  *
@@ -344,7 +385,8 @@ export declare class App {
344
385
  * Can the data (of the active view of the active layer) be scrolled?
345
386
  *
346
387
  * @returns {boolean} True if the data has a third dimension greater than one.
347
- * @deprecated Please use the ViewController equivalent directly instead.
388
+ * @deprecated Since v0.33, please use the ViewController
389
+ * equivalent directly instead.
348
390
  */
349
391
  canScroll(): boolean;
350
392
  /**
@@ -352,7 +394,8 @@ export declare class App {
352
394
  * (of the active view of the active layer)?
353
395
  *
354
396
  * @returns {boolean} True if the data is monochrome.
355
- * @deprecated Please use the ViewController equivalent directly instead.
397
+ * @deprecated Since v0.33, please use the ViewController
398
+ * equivalent directly instead.
356
399
  */
357
400
  canWindowLevel(): boolean;
358
401
  /**
@@ -400,6 +443,16 @@ export declare class App {
400
443
  * @returns {ViewLayer[]} The layers.
401
444
  */
402
445
  getViewLayersByDataId(dataId: string): ViewLayer[];
446
+ /**
447
+ * Get a list of view layers according to an input callback function.
448
+ *
449
+ * @param {Function} [callbackFn] A function that takes
450
+ * a ViewLayer as input and returns a boolean. If undefined,
451
+ * returns all view layers.
452
+ * @returns {ViewLayer[]} The layers that
453
+ * satisfy the callbackFn.
454
+ */
455
+ getViewLayers(callbackFn?: Function): ViewLayer[];
403
456
  /**
404
457
  * Get the draw layers associated to a data id.
405
458
  * The layer are available after the first loaded item.
@@ -408,6 +461,16 @@ export declare class App {
408
461
  * @returns {DrawLayer[]} The layers.
409
462
  */
410
463
  getDrawLayersByDataId(dataId: string): DrawLayer[];
464
+ /**
465
+ * Get a list of draw layers according to an input callback function.
466
+ *
467
+ * @param {Function} [callbackFn] A function that takes
468
+ * a DrawLayer as input and returns a boolean. If undefined,
469
+ * returns all draw layers.
470
+ * @returns {DrawLayer[]} The layers that
471
+ * satisfy the callbackFn.
472
+ */
473
+ getDrawLayers(callbackFn?: Function): DrawLayer[];
411
474
  /**
412
475
  * Get a layer group by div id.
413
476
  * The layer is available after the first loaded item.
@@ -436,6 +499,15 @@ export declare class App {
436
499
  * @function
437
500
  */
438
501
  addToUndoStack: (cmd: object) => void;
502
+ /**
503
+ * Remove a command from the undo stack.
504
+ *
505
+ * @param {string} name The name of the command to remove.
506
+ * @returns {boolean} True if the command was found and removed.
507
+ * @fires UndoStack#undoremove
508
+ * @function
509
+ */
510
+ removeFromUndoStack: (name: string) => boolean;
439
511
  /**
440
512
  * Initialise the application.
441
513
  *
@@ -564,7 +636,8 @@ export declare class App {
564
636
  * Init the Window/Level display
565
637
  * (of the active layer of the active layer group).
566
638
  *
567
- * @deprecated Please set the opacity of the desired view layer directly.
639
+ * @deprecated Since v0.33, please set the opacity
640
+ * of the desired view layer directly.
568
641
  */
569
642
  initWLDisplay(): void;
570
643
  /**
@@ -666,31 +739,28 @@ export declare class App {
666
739
  * Set the active view layer (of the active layer group) opacity.
667
740
  *
668
741
  * @param {number} alpha The opacity ([0:1] range).
669
- * @deprecated Please set the opacity of the desired view layer directly.
742
+ * @deprecated Since v0.33, pplease set the opacity
743
+ * of the desired view layer directly.
670
744
  */
671
745
  setOpacity(alpha: number): void;
672
746
  /**
673
747
  * Set the drawings of the active layer group.
674
748
  *
675
- * @deprecated
676
- * @param {Array} _drawings An array of drawings.
677
- * @param {Array} _drawingsDetails An array of drawings details.
749
+ * @deprecated Since v0.34, please switch to DICOM SR annotations.
750
+ * @param {Array} drawings An array of drawings.
751
+ * @param {Array} drawingsDetails An array of drawings details.
752
+ * @param {string} dataId The converted data id.
678
753
  */
679
- setDrawings(_drawings: any[], _drawingsDetails: any[]): void;
680
- /**
681
- * Get the JSON state of the app.
682
- *
683
- * @deprecated
684
- * @returns {string} The state of the app as a JSON string.
685
- */
686
- getJsonState(): string;
754
+ setDrawings(drawings: any[], drawingsDetails: any[], dataId: string): void;
687
755
  /**
688
756
  * Apply a JSON state to this app.
689
757
  *
690
- * @deprecated
758
+ * @deprecated Since v0.34, please switch to DICOM SR
759
+ * for annotations.
691
760
  * @param {string} jsonState The state of the app as a JSON string.
761
+ * @param {string} dataId The state data id.
692
762
  */
693
- applyJsonState(jsonState: string): void;
763
+ applyJsonState(jsonState: string, dataId: string): void;
694
764
  /**
695
765
  * Handle resize: fit the display to the window.
696
766
  * To be called once the image is loaded.
@@ -736,14 +806,16 @@ export declare class App {
736
806
  * Set the colour map of the active view of the active layer group.
737
807
  *
738
808
  * @param {string} name The colour map name.
739
- * @deprecated Please use the ViewController equivalent directly instead.
809
+ * @deprecated Since v0.33, please use the ViewController
810
+ * equivalent directly instead.
740
811
  */
741
812
  setColourMap(name: string): void;
742
813
  /**
743
814
  * Set the window/level preset of the active view of the active layer group.
744
815
  *
745
816
  * @param {string} preset The window/level preset.
746
- * @deprecated Please use the ViewController equivalent directly instead.
817
+ * @deprecated Since v0.33, please use the ViewController
818
+ * equivalent directly instead.
747
819
  */
748
820
  setWindowLevelPreset(preset: string): void;
749
821
  /**
@@ -799,18 +871,18 @@ export declare class App {
799
871
  * Create new annotation data based on the data of
800
872
  * the active view layer.
801
873
  *
802
- * @param {LayerGroup} layerGroup The layerGroup with the data to associate
803
- * to the annotation.
874
+ * @param {string} refDataId The reference data id.
804
875
  * @returns {DicomData} The new data.
805
876
  */
806
- createAnnotationData(layerGroup: LayerGroup): DicomData;
877
+ createAnnotationData(refDataId: string): DicomData;
807
878
  /**
808
879
  * Add new data and render it with a simple new data view config.
809
880
  *
810
881
  * @param {DicomData} data The data to add.
811
882
  * @param {string} divId The div where to draw.
883
+ * @param {string} refDataId The reference data id.
812
884
  */
813
- addAndRenderAnnotationData(data: DicomData, divId: string): void;
885
+ addAndRenderAnnotationData(data: DicomData, divId: string, refDataId: string): void;
814
886
  /**
815
887
  * Add a draw layer.
816
888
  *
@@ -954,6 +1026,79 @@ export declare class ChangeSegmentColourCommand {
954
1026
  #private;
955
1027
  }
956
1028
 
1029
+ /**
1030
+ * Circle shape.
1031
+ */
1032
+ export declare class Circle {
1033
+ /**
1034
+ * @param {Point2D} centre A Point2D representing the centre
1035
+ * of the circle.
1036
+ * @param {number} radius The radius of the circle.
1037
+ */
1038
+ constructor(centre: Point2D, radius: number);
1039
+ /**
1040
+ * Get the centre (point) of the circle.
1041
+ *
1042
+ * @returns {Point2D} The center (point) of the circle.
1043
+ */
1044
+ getCenter(): Point2D;
1045
+ /**
1046
+ * Get the centroid of the circle.
1047
+ *
1048
+ * @returns {Point2D} The centroid point.
1049
+ */
1050
+ getCentroid(): Point2D;
1051
+ /**
1052
+ * Get the radius of the circle.
1053
+ *
1054
+ * @returns {number} The radius of the circle.
1055
+ */
1056
+ getRadius(): number;
1057
+ /**
1058
+ * Check for equality.
1059
+ *
1060
+ * @param {Circle} rhs The object to compare to.
1061
+ * @returns {boolean} True if both objects are equal.
1062
+ */
1063
+ equals(rhs: Circle): boolean;
1064
+ /**
1065
+ * Get the surface of the circle.
1066
+ *
1067
+ * @returns {number} The surface of the circle.
1068
+ */
1069
+ getSurface(): number;
1070
+ /**
1071
+ * Get the surface of the circle according to a spacing.
1072
+ *
1073
+ * @param {Scalar2D} spacing2D The 2D spacing.
1074
+ * @returns {number} The surface of the circle multiplied by the given
1075
+ * spacing or null for null spacings.
1076
+ */
1077
+ getWorldSurface(spacing2D: Scalar2D): number;
1078
+ /**
1079
+ * Get the rounded limits of the circle.
1080
+ *
1081
+ * See: {@link https://en.wikipedia.org/wiki/Circle#Equations}.
1082
+ *
1083
+ * Circle formula: `x*x + y*y = r*r`.
1084
+ *
1085
+ * Implies: `y = (+-) sqrt(r*r - x*x)`.
1086
+ *
1087
+ * @returns {number[][][]} The rounded limits:
1088
+ * list of [x, y] pairs (min, max).
1089
+ */
1090
+ getRound(): number[][][];
1091
+ /**
1092
+ * Quantify an circle according to view information.
1093
+ *
1094
+ * @param {ViewController} viewController The associated view controller.
1095
+ * @param {string[]} flags A list of stat values to calculate.
1096
+ * @returns {object} A quantification object.
1097
+ */
1098
+ quantify(viewController: ViewController, flags: string[]): object;
1099
+ #private;
1100
+ }
1101
+
957
1102
  /**
958
1103
  * Colour map: red, green and blue components
959
1104
  * to associate with intensity values.
@@ -1524,12 +1669,6 @@ export declare class DrawController {
1524
1669
  * @param {string} value The value of the meta data.
1525
1670
  */
1526
1671
  setAnnotationMeta(key: string, value: string): void;
1527
- /**
1528
- * Get draw store details.
1529
- *
1530
- * @deprecated
1531
- */
1532
- getDrawStoreDetails(): void;
1533
1672
  #private;
1534
1673
  }
1535
1674
 
@@ -1561,6 +1700,12 @@ export declare class DrawLayer {
1561
1700
  * @returns {string} The id.
1562
1701
  */
1563
1702
  getDataId(): string;
1703
+ /**
1704
+ * Get the reference data id.
1705
+ *
1706
+ * @returns {string} The id.
1707
+ */
1708
+ getReferenceLayerId(): string;
1564
1709
  /**
1565
1710
  * Get the Konva stage.
1566
1711
  *
@@ -1640,6 +1785,14 @@ export declare class DrawLayer {
1640
1785
  * @param {Point3D} [center] The scale center.
1641
1786
  */
1642
1787
  setScale(newScale: Scalar3D, center?: Point3D): void;
1788
+ /**
1789
+ * Initialise the layer scale.
1790
+ *
1791
+ * @param {Scalar3D} newScale The scale as {x,y,z}.
1792
+ * @param {Scalar2D} absoluteZoomOffset The zoom offset as {x,y}
1793
+ * without the fit scale (as provided by getAbsoluteZoomOffset).
1794
+ */
1795
+ initScale(newScale: Scalar3D, absoluteZoomOffset: Scalar2D): void;
1643
1796
  /**
1644
1797
  * Set the layer offset.
1645
1798
  *
@@ -1676,8 +1829,9 @@ export declare class DrawLayer {
1676
1829
  *
1677
1830
  * @param {Scalar2D} size The image size as {x,y}.
1678
1831
  * @param {Scalar2D} spacing The image spacing as {x,y}.
1832
+ * @param {string} refLayerId The reference image dataId.
1679
1833
  */
1680
- initialise(size: Scalar2D, spacing: Scalar2D): void;
1834
+ initialise(size: Scalar2D, spacing: Scalar2D, refLayerId: string): void;
1681
1835
  /**
1682
1836
  * Set the annotation group.
1683
1837
  *
@@ -1686,6 +1840,12 @@ export declare class DrawLayer {
1686
1840
  * @param {object} exeCallback The undo stack callback.
1687
1841
  */
1688
1842
  setAnnotationGroup(annotationGroup: AnnotationGroup, dataId: string, exeCallback: object): void;
1843
+ /**
1844
+ * Activate shapes at current position.
1845
+ *
1846
+ * @param {boolean} flag The flag to activate or not.
1847
+ */
1848
+ activateCurrentPositionShapes(flag: boolean): void;
1689
1849
  /**
1690
1850
  * Fit the layer to its parent container.
1691
1851
  *
@@ -1717,10 +1877,17 @@ export declare class DrawLayer {
1717
1877
  * will toggle visibility if not defined.
1718
1878
  */
1719
1879
  setLabelsVisibility(visible?: boolean): void;
1880
+ /**
1881
+ * Set a shape group label visibility according to
1882
+ * this layer setting.
1883
+ *
1884
+ * @param {Konva.Group} shapeGroup The shape group.
1885
+ */
1886
+ setLabelVisibility(shapeGroup: Konva.Group): void;
1720
1887
  /**
1721
1888
  * Delete a Draw from the stage.
1722
1889
  *
1723
- * @deprecated
1890
+ * @deprecated Since v0.34, please switch to `annotationGroup.remove`.
1724
1891
  * @param {string} _id The id of the group to delete.
1725
1892
  * @param {Function} _exeCallback The callback to call once the
1726
1893
  * DeleteCommand has been executed.
@@ -1729,7 +1896,7 @@ export declare class DrawLayer {
1729
1896
  /**
1730
1897
  * Delete all Draws from the stage.
1731
1898
  *
1732
- * @deprecated
1899
+ * @deprecated Since v0.34, please switch to `annotationGroup.remove`.
1733
1900
  * @param {Function} _exeCallback The callback to call once the
1734
1901
  * DeleteCommand has been executed.
1735
1902
  */
@@ -1753,29 +1920,16 @@ export declare class DrawLayer {
1753
1920
  * Set the current position.
1754
1921
  *
1755
1922
  * @param {Point} position The new position.
1756
- * @param {Index} index The new index.
1923
+ * @param {Index} [index] Optional coresponding index.
1757
1924
  * @returns {boolean} True if the position was updated.
1758
1925
  */
1759
- setCurrentPosition(position: Point, index: Index): boolean;
1760
- /**
1761
- * Activate the current draw layer.
1762
- *
1763
- * @param {Index} index The current position.
1764
- * @param {number} scrollIndex The scroll index.
1765
- */
1766
- activateDrawLayer(index: Index, scrollIndex: number): void;
1926
+ setCurrentPosition(position: Point, index?: Index): boolean;
1767
1927
  /**
1768
1928
  * Get the current position group.
1769
1929
  *
1770
1930
  * @returns {Konva.Group|undefined} The Konva.Group.
1771
1931
  */
1772
1932
  getCurrentPosGroup(): Konva.Group | undefined;
1773
- /**
1774
- * Get the non current position groups. Used to stop listeners.
1775
- *
1776
- * @returns {object[]} The groups that do not have the current position id.
1777
- */
1778
- getNonCurrentPosGroup(): object[];
1779
1933
  /**
1780
1934
  * Get a Konva group using its id.
1781
1935
  *
@@ -1851,11 +2005,11 @@ export declare class DrawShapeHandler {
1851
2005
  /**
1852
2006
  * Add shape group listeners.
1853
2007
  *
1854
- * @param {DrawLayer} drawLayer The origin draw layer.
1855
2008
  * @param {Konva.Group} shapeGroup The shape group to set on.
1856
2009
  * @param {Annotation} annotation The associated annotation.
2010
+ * @param {DrawLayer} drawLayer The origin draw layer.
1857
2011
  */
1858
- addShapeListeners(drawLayer: DrawLayer, shapeGroup: Konva.Group, annotation: Annotation): void;
2012
+ addShapeGroupListeners(shapeGroup: Konva.Group, annotation: Annotation, drawLayer: DrawLayer): void;
1859
2013
  /**
1860
2014
  * Remove shape group listeners.
1861
2015
  *
@@ -1865,6 +2019,86 @@ export declare class DrawShapeHandler {
1865
2019
  #private;
1866
2020
  }
1867
2021
 
2022
+ /**
2023
+ * Ellipse shape.
2024
+ */
2025
+ export declare class Ellipse {
2026
+ /**
2027
+ * @param {Point2D} centre A Point2D representing the centre
2028
+ * of the ellipse.
2029
+ * @param {number} a The radius of the ellipse on the horizontal axe.
2030
+ * @param {number} b The radius of the ellipse on the vertical axe.
2031
+ */
2032
+ constructor(centre: Point2D, a: number, b: number);
2033
+ /**
2034
+ * Get the centre (point) of the ellipse.
2035
+ *
2036
+ * @returns {Point2D} The center (point) of the ellipse.
2037
+ */
2038
+ getCenter(): Point2D;
2039
+ /**
2040
+ * Get the centroid of the ellipse.
2041
+ *
2042
+ * @returns {Point2D} The centroid point.
2043
+ */
2044
+ getCentroid(): Point2D;
2045
+ /**
2046
+ * Get the radius of the ellipse on the horizontal axe.
2047
+ *
2048
+ * @returns {number} The radius of the ellipse on the horizontal axe.
2049
+ */
2050
+ getA(): number;
2051
+ /**
2052
+ * Get the radius of the ellipse on the vertical axe.
2053
+ *
2054
+ * @returns {number} The radius of the ellipse on the vertical axe.
2055
+ */
2056
+ getB(): number;
2057
+ /**
2058
+ * Check for equality.
2059
+ *
2060
+ * @param {Ellipse} rhs The object to compare to.
2061
+ * @returns {boolean} True if both objects are equal.
2062
+ */
2063
+ equals(rhs: Ellipse): boolean;
2064
+ /**
2065
+ * Get the surface of the ellipse.
2066
+ *
2067
+ * @returns {number} The surface of the ellipse.
2068
+ */
2069
+ getSurface(): number;
2070
+ /**
2071
+ * Get the surface of the ellipse according to a spacing.
2072
+ *
2073
+ * @param {Scalar2D} spacing2D The 2D spacing.
2074
+ * @returns {number} The surface of the ellipse multiplied by the given
2075
+ * spacing or null for null spacings.
2076
+ */
2077
+ getWorldSurface(spacing2D: Scalar2D): number;
2078
+ /**
2079
+ * Get the rounded limits of the ellipse.
2080
+ *
2081
+ * See: {@link https://en.wikipedia.org/wiki/Ellipse#Standard_equation}.
2082
+ *
2083
+ * Ellipse formula: `x*x / a*a + y*y / b*b = 1`.
2084
+ *
2085
+ * Implies: `y = (+-)(b/a) * sqrt(a*a - x*x)`.
2086
+ *
2087
+ * @returns {number[][][]} The rounded limits:
2088
+ * list of [x, y] pairs (min, max).
2089
+ */
2090
+ getRound(): number[][][];
2091
+ /**
2092
+ * Quantify an ellipse according to view information.
2093
+ *
2094
+ * @param {ViewController} viewController The associated view controller.
2095
+ * @param {string[]} flags A list of stat values to calculate.
2096
+ * @returns {object} A quantification object.
2097
+ */
2098
+ quantify(viewController: ViewController, flags: string[]): object;
2099
+ #private;
2100
+ }
2101
+
1868
2102
  /**
1869
2103
  * 2D/3D Geometry class.
1870
2104
  */
@@ -2109,7 +2343,7 @@ export declare function getEllipseIndices(center: Index, radius: number[], dir:
2109
2343
  * @param {object} event The event to get the layer div id from. Expecting
2110
2344
  * an event origininating from a canvas inside a layer HTML div
2111
2345
  * with the 'layer' class and id generated with `getLayerDivId`.
2112
- * @returns {object} The layer details as {groupDivId, layerId}.
2346
+ * @returns {object} The layer details as {groupDivId, layerIndex, layerId}.
2113
2347
  */
2114
2348
  export declare function getLayerDetailsFromEvent(event: object): object;
2115
2349
 
@@ -2124,11 +2358,12 @@ export declare function getMousePoint(event: object): Point2D;
2124
2358
  /**
2125
2359
  * Get the name of an image orientation patient.
2126
2360
  *
2127
- * @param {number[]} orientation The image orientation patient.
2361
+ * @param {number[]} cosines The image orientation
2362
+ * patient cosines (6 values).
2128
2363
  * @returns {string|undefined} The orientation
2129
2364
  * name: axial, coronal or sagittal.
2130
2365
  */
2131
- export declare function getOrientationName(orientation: number[]): string | undefined;
2366
+ export declare function getOrientationName(cosines: number[]): string | undefined;
2132
2367
 
2133
2368
  /**
2134
2369
  * Get the PixelData Tag.
@@ -2137,6 +2372,16 @@ export declare function getOrientationName(orientation: number[]): string | unde
2137
2372
  */
2138
2373
  export declare function getPixelDataTag(): Tag;
2139
2374
 
2375
+ /**
2376
+ * Get the indices that form a rectangle.
2377
+ *
2378
+ * @param {Index} center The rectangle center.
2379
+ * @param {number[]} size The 2 rectangle sizes.
2380
+ * @param {number[]} dir The 2 rectangle directions.
2381
+ * @returns {Index[]} The indices of the rectangle.
2382
+ */
2383
+ export declare function getRectangleIndices(center: Index, size: number[], dir: number[]): Index[];
2384
+
2140
2385
  /**
2141
2386
  * Get patient orientation label in the reverse direction.
2142
2387
  *
@@ -2279,6 +2524,13 @@ declare class Image_2 {
2279
2524
  * @returns {Point3D|undefined} The origin.
2280
2525
  */
2281
2526
  getOriginForImageUid(uid: string): Point3D | undefined;
2527
+ /**
2528
+ * Check if the image includes an UID.
2529
+ *
2530
+ * @param {string} uid The UID.
2531
+ * @returns {boolean} True if present.
2532
+ */
2533
+ includesImageUid(uid: string): boolean;
2282
2534
  /**
2283
2535
  * Check if this image includes the input uids.
2284
2536
  *
@@ -2309,7 +2561,7 @@ declare class Image_2 {
2309
2561
  * Can window and level be applied to the data?
2310
2562
  *
2311
2563
  * @returns {boolean} True if the data is monochrome.
2312
- * @deprecated Please use isMonochrome instead.
2564
+ * @deprecated Since v0.33, please use isMonochrome instead.
2313
2565
  */
2314
2566
  canWindowLevel(): boolean;
2315
2567
  /**
@@ -2699,13 +2951,6 @@ export declare class Index {
2699
2951
  * @returns {Index} The new index.
2700
2952
  */
2701
2953
  getWithNew2D(i: number, j: number): Index;
2702
- /**
2703
- * Get a string id from the index values in the form of: '#0-1_#1-2'.
2704
- *
2705
- * @param {number[]} [dims] Optional list of dimensions to use.
2706
- * @returns {string} The string id.
2707
- */
2708
- toStringId(dims?: number[]): string;
2709
2954
  #private;
2710
2955
  }
2711
2956
 
@@ -2810,6 +3055,35 @@ export declare class LayerGroup {
2810
3055
  * a layer with the input id.
2811
3056
  */
2812
3057
  includes(id: string): boolean;
3058
+ /**
3059
+ * Get a list of view layers according to an input callback function.
3060
+ *
3061
+ * @param {Function} [callbackFn] A function that takes
3062
+ * a ViewLayer as input and returns a boolean. If undefined,
3063
+ * returns all view layers.
3064
+ * @returns {ViewLayer[]} The layers that
3065
+ * satisfy the callbackFn.
3066
+ */
3067
+ getViewLayers(callbackFn?: Function): ViewLayer[];
3068
+ /**
3069
+ * Test if one of the view layers satisfies an input callbackFn.
3070
+ *
3071
+ * @param {Function} callbackFn A function that takes
3072
+ * a ViewLayer as input and returns a boolean.
3073
+ * @returns {boolean} True if one of the ViewLayers
3074
+ * satisfies the callbackFn.
3075
+ */
3076
+ someViewLayer(callbackFn: Function): boolean;
3077
+ /**
3078
+ * Get a list of draw layers according to an input callback function.
3079
+ *
3080
+ * @param {Function} [callbackFn] A function that takes
3081
+ * a DrawLayer as input and returns a boolean. If undefined,
3082
+ * returns all draw layers.
3083
+ * @returns {DrawLayer[]} The layers that
3084
+ * satisfy the callbackFn.
3085
+ */
3086
+ getDrawLayers(callbackFn?: Function): DrawLayer[];
2813
3087
  /**
2814
3088
  * Get the number of view layers handled by this class.
2815
3089
  *
@@ -2876,9 +3150,10 @@ export declare class LayerGroup {
2876
3150
  /**
2877
3151
  * Set the active draw layer.
2878
3152
  *
2879
- * @param {number} index The index of the layer to set as active.
3153
+ * @param {number|undefined} index The index of the layer to set as active
3154
+ * or undefined to not set any.
2880
3155
  */
2881
- setActiveDrawLayer(index: number): void;
3156
+ setActiveDrawLayer(index: number | undefined): void;
2882
3157
  /**
2883
3158
  * Set the active draw layer with a data id.
2884
3159
  *
@@ -2931,14 +3206,6 @@ export declare class LayerGroup {
2931
3206
  * Remove the tooltip html div.
2932
3207
  */
2933
3208
  removeTooltipDiv(): void;
2934
- /**
2935
- * Test if one of the view layers satisfies an input callbackFn.
2936
- *
2937
- * @param {Function} callbackFn A function that takes a ViewLayer as input
2938
- * and returns a boolean.
2939
- * @returns {boolean} True if one of the ViewLayers satisfies the callbackFn.
2940
- */
2941
- someViewLayer(callbackFn: Function): boolean;
2942
3209
  /**
2943
3210
  * Can the input position be set on one of the view layers.
2944
3211
  *
@@ -3218,6 +3485,12 @@ export declare class MaskSegmentHelper {
3218
3485
  * @returns {boolean} True if the segment is included.
3219
3486
  */
3220
3487
  hasSegment(segmentNumber: number): boolean;
3488
+ /**
3489
+ * Get the number of segments of the segmentation.
3490
+ *
3491
+ * @returns {number} The number of segments.
3492
+ */
3493
+ getNumberOfSegments(): number;
3221
3494
  /**
3222
3495
  * Check if a segment is present in a mask image.
3223
3496
  *
@@ -3483,11 +3756,22 @@ export declare class OverlayData {
3483
3756
  */
3484
3757
  export declare class PlaneHelper {
3485
3758
  /**
3486
- * @param {Spacing} spacing The spacing.
3487
- * @param {Matrix33} imageOrientation The image oientation.
3759
+ * @param {Geometry} imageGeometry The image geometry.
3488
3760
  * @param {Matrix33} viewOrientation The view orientation.
3489
3761
  */
3490
- constructor(spacing: Spacing, imageOrientation: Matrix33, viewOrientation: Matrix33);
3762
+ constructor(imageGeometry: Geometry, viewOrientation: Matrix33);
3763
+ /**
3764
+ * Get the view orientation.
3765
+ *
3766
+ * @returns {Matrix33} The orientation matrix.
3767
+ */
3768
+ getViewOrientation(): Matrix33;
3769
+ /**
3770
+ * Get the target orientation.
3771
+ *
3772
+ * @returns {Matrix33} The orientation matrix.
3773
+ */
3774
+ getTargetOrientation(): Matrix33;
3491
3775
  /**
3492
3776
  * Get a 3D offset from a plane one.
3493
3777
  *
@@ -3551,6 +3835,48 @@ export declare class PlaneHelper {
3551
3835
  * @returns {Point3D} The de-orienteded point.
3552
3836
  */
3553
3837
  getImageDeOrientedPoint3D(point: Point3D): Point3D;
3838
+ /**
3839
+ * Get a world position from a 2D plane position.
3840
+ *
3841
+ * @param {Point2D} point2D The plane point.
3842
+ * @param {number} k The slice index.
3843
+ * @returns {Point3D} The world position.
3844
+ */
3845
+ getPositionFromPlanePoint(point2D: Point2D, k: number): Point3D;
3846
+ /**
3847
+ * Get a 2D plane position from a world position.
3848
+ *
3849
+ * @param {Point} point The world position.
3850
+ * @returns {Point3D} The plane point.
3851
+ */
3852
+ getPlanePointFromPosition(point: Point): Point3D;
3853
+ /**
3854
+ * Get the cosines of this plane.
3855
+ *
3856
+ * @returns {number[]} The 2 cosines vectors (3D).
3857
+ */
3858
+ getCosines(): number[];
3859
+ /**
3860
+ * Get a list of points that define the plane at input position,
3861
+ * given this classes orientation.
3862
+ *
3863
+ * @param {Point} position The position.
3864
+ * @returns {Point3D[]} An origin and 2 cosines vectors.
3865
+ */
3866
+ getPlanePoints(position: Point): Point3D[];
3867
+ /**
3868
+ * Image world to index.
3869
+ *
3870
+ * @param {Point} point The input point.
3871
+ * @returns {Index} The corresponding index.
3872
+ */
3873
+ worldToIndex(point: Point): Index;
3874
+ /**
3875
+ * Is this view in the same orientation as the image aquisition.
3876
+ *
3877
+ * @returns {boolean} True if in aquisition plane.
3878
+ */
3879
+ isAquisitionOrientation(): boolean;
3554
3880
  /**
3555
3881
  * Reorder values to follow target orientation.
3556
3882
  *
@@ -3576,7 +3902,7 @@ export declare class PlaneHelper {
3576
3902
  /**
3577
3903
  * Immutable point.
3578
3904
  * Warning: the input array is NOT cloned, modifying it will
3579
- * modify the index values.
3905
+ * modify the point values.
3580
3906
  */
3581
3907
  export declare class Point {
3582
3908
  /**
@@ -3584,26 +3910,26 @@ export declare class Point {
3584
3910
  */
3585
3911
  constructor(values: number[]);
3586
3912
  /**
3587
- * Get the index value at the given array index.
3913
+ * Get the point value at the given array index.
3588
3914
  *
3589
3915
  * @param {number} i The index to get.
3590
3916
  * @returns {number} The value.
3591
3917
  */
3592
3918
  get(i: number): number;
3593
3919
  /**
3594
- * Get the length of the index.
3920
+ * Get the length of the point.
3595
3921
  *
3596
3922
  * @returns {number} The length.
3597
3923
  */
3598
3924
  length(): number;
3599
3925
  /**
3600
- * Get a string representation of the Index.
3926
+ * Get a string representation of the point.
3601
3927
  *
3602
- * @returns {string} The Index as a string.
3928
+ * @returns {string} The point as a string.
3603
3929
  */
3604
3930
  toString(): string;
3605
3931
  /**
3606
- * Get the values of this index.
3932
+ * Get the values of this point.
3607
3933
  *
3608
3934
  * @returns {number[]} The array of values.
3609
3935
  */
@@ -3673,6 +3999,18 @@ export declare class Point2D {
3673
3999
  * @returns {number} The Y position of the point.
3674
4000
  */
3675
4001
  getY(): number;
4002
+ /**
4003
+ * Get the values of this point.
4004
+ *
4005
+ * @returns {number[]} The array of values.
4006
+ */
4007
+ getValues(): number[];
4008
+ /**
4009
+ * Get the centroid of the point, ie itself.
4010
+ *
4011
+ * @returns {Point2D} The centroid point.
4012
+ */
4013
+ getCentroid(): Point2D;
3676
4014
  /**
3677
4015
  * Check for Point2D equality.
3678
4016
  *
@@ -3724,6 +4062,12 @@ export declare class Point3D {
3724
4062
  * @returns {number} The Z position of the point.
3725
4063
  */
3726
4064
  getZ(): number;
4065
+ /**
4066
+ * Get the values of this point.
4067
+ *
4068
+ * @returns {number[]} The array of values.
4069
+ */
4070
+ getValues(): number[];
3727
4071
  /**
3728
4072
  * Check for Point3D equality.
3729
4073
  *
@@ -3785,6 +4129,137 @@ export declare class Point3D {
3785
4129
  */
3786
4130
  export declare function precisionRound(number: number, precision: number): number;
3787
4131
 
4132
+ /**
4133
+ * Protractor shape: 3 points from which to calculate an angle.
4134
+ */
4135
+ export declare class Protractor {
4136
+ /**
4137
+ * @param {Point2D[]} points The list of Point2D that make
4138
+ * the protractor.
4139
+ */
4140
+ constructor(points: Point2D[]);
4141
+ /**
4142
+ * Get a point of the list.
4143
+ *
4144
+ * @param {number} index The index of the point
4145
+ * to get (beware, no size check).
4146
+ * @returns {Point2D|undefined} The Point2D at the given index.
4147
+ */
4148
+ getPoint(index: number): Point2D | undefined;
4149
+ /**
4150
+ * Get the length of the path (should be 3).
4151
+ *
4152
+ * @returns {number} The length of the path.
4153
+ */
4154
+ getLength(): number;
4155
+ /**
4156
+ * Get the centroid of the protractor.
4157
+ *
4158
+ * @returns {Point2D} THe centroid point.
4159
+ */
4160
+ getCentroid(): Point2D;
4161
+ /**
4162
+ * Quantify a path according to view information.
4163
+ *
4164
+ * @param {ViewController} _viewController The associated view controller.
4165
+ * @param {string[]} _flags A list of stat values to calculate.
4166
+ * @returns {object} A quantification object.
4167
+ */
4168
+ quantify(_viewController: ViewController, _flags: string[]): object;
4169
+ #private;
4170
+ }
4171
+
4172
+ /**
4173
+ * Rectangle shape.
4174
+ */
4175
+ export declare class Rectangle {
4176
+ /**
4177
+ * @param {Point2D} begin A Point2D representing the beginning
4178
+ * of the rectangle.
4179
+ * @param {Point2D} end A Point2D representing the end
4180
+ * of the rectangle.
4181
+ */
4182
+ constructor(begin: Point2D, end: Point2D);
4183
+ /**
4184
+ * Get the begin point of the rectangle.
4185
+ *
4186
+ * @returns {Point2D} The begin point of the rectangle.
4187
+ */
4188
+ getBegin(): Point2D;
4189
+ /**
4190
+ * Get the end point of the rectangle.
4191
+ *
4192
+ * @returns {Point2D} The end point of the rectangle.
4193
+ */
4194
+ getEnd(): Point2D;
4195
+ /**
4196
+ * Check for equality.
4197
+ *
4198
+ * @param {Rectangle} rhs The object to compare to.
4199
+ * @returns {boolean} True if both objects are equal.
4200
+ */
4201
+ equals(rhs: Rectangle): boolean;
4202
+ /**
4203
+ * Get the surface of the rectangle.
4204
+ *
4205
+ * @returns {number} The surface of the rectangle.
4206
+ */
4207
+ getSurface(): number;
4208
+ /**
4209
+ * Get the surface of the rectangle according to a spacing.
4210
+ *
4211
+ * @param {Scalar2D} spacing2D The 2D spacing.
4212
+ * @returns {number} The surface of the rectangle multiplied by the given
4213
+ * spacing or null for null spacings.
4214
+ */
4215
+ getWorldSurface(spacing2D: Scalar2D): number;
4216
+ /**
4217
+ * Get the real width of the rectangle.
4218
+ *
4219
+ * @returns {number} The real width of the rectangle.
4220
+ */
4221
+ getRealWidth(): number;
4222
+ /**
4223
+ * Get the real height of the rectangle.
4224
+ *
4225
+ * @returns {number} The real height of the rectangle.
4226
+ */
4227
+ getRealHeight(): number;
4228
+ /**
4229
+ * Get the width of the rectangle.
4230
+ *
4231
+ * @returns {number} The width of the rectangle.
4232
+ */
4233
+ getWidth(): number;
4234
+ /**
4235
+ * Get the height of the rectangle.
4236
+ *
4237
+ * @returns {number} The height of the rectangle.
4238
+ */
4239
+ getHeight(): number;
4240
+ /**
4241
+ * Get the rounded limits of the rectangle.
4242
+ *
4243
+ * @returns {object} The rounded limits as {min, max} (Point2D).
4244
+ */
4245
+ getRound(): object;
4246
+ /**
4247
+ * Get the centroid of the rectangle.
4248
+ *
4249
+ * @returns {Point2D} The centroid point.
4250
+ */
4251
+ getCentroid(): Point2D;
4252
+ /**
4253
+ * Quantify a rectangle according to view information.
4254
+ *
4255
+ * @param {ViewController} viewController The associated view controller.
4256
+ * @param {string[]} flags A list of stat values to calculate.
4257
+ * @returns {object} A quantification object.
4258
+ */
4259
+ quantify(viewController: ViewController, flags: string[]): object;
4260
+ #private;
4261
+ }
4262
+
3788
4263
  /**
3789
4264
  * Rescale Slope and Intercept.
3790
4265
  */
@@ -3859,6 +4334,58 @@ export declare class RGB {
3859
4334
  b: number;
3860
4335
  }
3861
4336
 
4337
+ /**
4338
+ * Region Of Interest shape.
4339
+ * Note: should be a closed path.
4340
+ */
4341
+ export declare class ROI {
4342
+ /**
4343
+ * @param {Point2D[]} [points] Optional initial point list.
4344
+ */
4345
+ constructor(points?: Point2D[]);
4346
+ /**
4347
+ * Get a point of the list at a given index.
4348
+ *
4349
+ * @param {number} index The index of the point to get
4350
+ * (beware, no size check).
4351
+ * @returns {Point2D|undefined} The Point2D at the given index.
4352
+ */
4353
+ getPoint(index: number): Point2D | undefined;
4354
+ /**
4355
+ * Get the point list.
4356
+ *
4357
+ * @returns {Point2D[]} The list.
4358
+ */
4359
+ getPoints(): Point2D[];
4360
+ /**
4361
+ * Get the length of the point list.
4362
+ *
4363
+ * @returns {number} The length of the point list.
4364
+ */
4365
+ getLength(): number;
4366
+ /**
4367
+ * Add a point to the ROI.
4368
+ *
4369
+ * @param {Point2D} point The Point2D to add.
4370
+ */
4371
+ addPoint(point: Point2D): void;
4372
+ /**
4373
+ * Add points to the ROI.
4374
+ *
4375
+ * @param {Point2D[]} rhs The array of POints2D to add.
4376
+ */
4377
+ addPoints(rhs: Point2D[]): void;
4378
+ /**
4379
+ * Get the centroid of the roi. Only valid for
4380
+ * a non-self-intersecting closed polygon.
4381
+ * Ref: {@link https://en.wikipedia.org/wiki/Centroid#Of_a_polygon}.
4382
+ *
4383
+ * @returns {Point2D} The centroid point.
4384
+ */
4385
+ getCentroid(): Point2D;
4386
+ #private;
4387
+ }
4388
+
3862
4389
  /**
3863
4390
  * Mutable 2D scalar ({x,y}).
3864
4391
  */
@@ -4274,12 +4801,109 @@ export declare class ToolConfig {
4274
4801
  * List of client provided tools to be added to
4275
4802
  * the default ones.
4276
4803
  *
4804
+ * @example
4805
+ * // custom tool
4806
+ * class AlertTool {
4807
+ * mousedown() {alert('AlertTool mousedown');}
4808
+ * init() {}
4809
+ * activate() {}
4810
+ * }
4811
+ * // pass it to dwv tool list
4812
+ * dwv.toolList['Alert'] = AlertTool;
4813
+ * // create the dwv app
4814
+ * const app = new dwv.App();
4815
+ * // initialise
4816
+ * const viewConfig0 = new dwv.ViewConfig('layerGroup0');
4817
+ * const viewConfigs = {'*': [viewConfig0]};
4818
+ * const options = new dwv.AppOptions(viewConfigs);
4819
+ * options.tools = {Alert: {}};
4820
+ * app.init(options);
4821
+ * // activate tool
4822
+ * app.addEventListener('load', function () {
4823
+ * app.setTool('Alert');
4824
+ * });
4825
+ * // load dicom data
4826
+ * app.loadURLs([
4827
+ * 'https://raw.githubusercontent.com/ivmartel/dwv/master/tests/data/bbmri-53323851.dcm'
4828
+ * ]);
4829
+ *
4277
4830
  * @type {Object<string, any>}
4278
4831
  */
4279
4832
  export declare const toolList: {
4280
4833
  [x: string]: any;
4281
4834
  };
4282
4835
 
4836
+ /**
4837
+ * List of client provided tool options to be added to
4838
+ * the default ones.
4839
+ *
4840
+ * @example
4841
+ * // custom factory
4842
+ * class LoveFactory {
4843
+ * getName() {return 'love';}
4844
+ * static supports(mathShape) {return mathShape instanceof ROI;}
4845
+ * getNPoints() {return 1;}
4846
+ * getTimeout() {return 0;}
4847
+ * setAnnotationMathShape(annotation, points) {
4848
+ * const px = points[0].getX();
4849
+ * const py = points[0].getY();
4850
+ * annotation.mathShape = new dwv.ROI([
4851
+ * new dwv.Point2D(px+15,py), new dwv.Point2D(px+10,py-10),
4852
+ * new dwv.Point2D(px,py), new dwv.Point2D(px-10,py-10),
4853
+ * new dwv.Point2D(px-15,py), new dwv.Point2D(px,py+20)
4854
+ * ]);
4855
+ * annotation.getFactory = function () {return new LoveFactory();}
4856
+ * }
4857
+ * createShapeGroup(annotation, style) {
4858
+ * const roi = annotation.mathShape;
4859
+ * // konva line
4860
+ * const arr = [];
4861
+ * for (let i = 0; i < roi.getLength(); ++i) {
4862
+ * arr.push(roi.getPoint(i).getX());
4863
+ * arr.push(roi.getPoint(i).getY());
4864
+ * }
4865
+ * const shape = new Konva.Line({
4866
+ * name: 'shape', points: arr,
4867
+ * stroke: 'red', strokeWidth: 2,
4868
+ * closed: true
4869
+ * });
4870
+ * // konva group
4871
+ * const group = new Konva.Group();
4872
+ * group.name('love-group');
4873
+ * group.visible(true);
4874
+ * group.id(annotation.id);
4875
+ * group.add(shape);
4876
+ * return group;
4877
+ * }
4878
+ * }
4879
+ * // pass it to dwv option list
4880
+ * dwv.toolOptions['draw'] = {LoveFactory};
4881
+ * // create the dwv app
4882
+ * const app = new dwv.App();
4883
+ * // initialise
4884
+ * const viewConfig0 = new dwv.ViewConfig('layerGroup0');
4885
+ * const viewConfigs = {'*': [viewConfig0]};
4886
+ * const options = new dwv.AppOptions(viewConfigs);
4887
+ * options.tools = {Draw: {options: ['Love']}};
4888
+ * app.init(options);
4889
+ * // activate tool
4890
+ * app.addEventListener('load', function () {
4891
+ * app.setTool('Draw');
4892
+ * app.setToolFeatures({shapeName: 'Love'});
4893
+ * });
4894
+ * // load dicom data
4895
+ * app.loadURLs([
4896
+ * 'https://raw.githubusercontent.com/ivmartel/dwv/master/tests/data/bbmri-53323851.dcm'
4897
+ * ]);
4898
+ *
4899
+ * @type {Object<string, Object<string, any>>}
4900
+ */
4901
+ export declare const toolOptions: {
4902
+ [x: string]: {
4903
+ [x: string]: any;
4904
+ };
4905
+ };
4906
+
4283
4907
  /**
4284
4908
  * Immutable 3D vector.
4285
4909
  */
@@ -4522,9 +5146,16 @@ export declare class View {
4522
5146
  * Get the image origin for a image UID.
4523
5147
  *
4524
5148
  * @param {string} uid The UID.
4525
- * @returns {Index|undefined} The origin index.
5149
+ * @returns {Point3D|undefined} The origin.
4526
5150
  */
4527
- getOriginIndexForImageUid(uid: string): Index | undefined;
5151
+ getOriginForImageUid(uid: string): Point3D | undefined;
5152
+ /**
5153
+ * Check if the image includes an UID.
5154
+ *
5155
+ * @param {string} uid The UID.
5156
+ * @returns {boolean} True if present.
5157
+ */
5158
+ includesImageUid(uid: string): boolean;
4528
5159
  /**
4529
5160
  * Check if the current position (default) or
4530
5161
  * the provided position is in bounds.
@@ -4544,11 +5175,11 @@ export declare class View {
4544
5175
  * Set the current position.
4545
5176
  *
4546
5177
  * @param {Point} position The new position.
4547
- * @param {boolean} silent Flag to fire event or not.
5178
+ * @param {boolean} [silent] Flag to fire event or not.
4548
5179
  * @returns {boolean} False if not in bounds.
4549
5180
  * @fires View#positionchange
4550
5181
  */
4551
- setCurrentPosition(position: Point, silent: boolean): boolean;
5182
+ setCurrentPosition(position: Point, silent?: boolean): boolean;
4552
5183
  /**
4553
5184
  * Set the current index.
4554
5185
  *
@@ -4630,6 +5261,12 @@ export declare class View {
4630
5261
  * @returns {number} The index.
4631
5262
  */
4632
5263
  getScrollIndex(): number;
5264
+ /**
5265
+ * Is this view in the same orientation as the image aquisition.
5266
+ *
5267
+ * @returns {boolean} True if in aquisition plane.
5268
+ */
5269
+ isAquisitionOrientation(): boolean;
4633
5270
  #private;
4634
5271
  }
4635
5272
 
@@ -4769,12 +5406,19 @@ export declare class ViewController {
4769
5406
  */
4770
5407
  getCurrentImageUid(): string;
4771
5408
  /**
4772
- * Get the image origin index for a image UID.
5409
+ * Get the image origin for a image UID.
5410
+ *
5411
+ * @param {string} uid The UID.
5412
+ * @returns {Point3D|undefined} The origin.
5413
+ */
5414
+ getOriginForImageUid(uid: string): Point3D | undefined;
5415
+ /**
5416
+ * Check if the image includes an UID.
4773
5417
  *
4774
5418
  * @param {string} uid The UID.
4775
- * @returns {Index|undefined} The origin index.
5419
+ * @returns {boolean} True if present.
4776
5420
  */
4777
- getOriginIndexForImageUid(uid: string): Index | undefined;
5421
+ includesImageUid(uid: string): boolean;
4778
5422
  /**
4779
5423
  * Get the current oriented index.
4780
5424
  *
@@ -4796,16 +5440,30 @@ export declare class ViewController {
4796
5440
  /**
4797
5441
  * Get the first origin or at a given position.
4798
5442
  *
4799
- * @param {Point} [position] Opitonal position.
5443
+ * @param {Point} [position] Optional position.
4800
5444
  * @returns {Point3D} The origin.
4801
5445
  */
4802
5446
  getOrigin(position?: Point): Point3D;
5447
+ /**
5448
+ * Is this view in the same orientation as the image aquisition.
5449
+ *
5450
+ * @returns {boolean} True if in aquisition plane.
5451
+ */
5452
+ isAquisitionOrientation(): boolean;
5453
+ /**
5454
+ * Get a list of points that define the plane at input position,
5455
+ * given this classes orientation.
5456
+ *
5457
+ * @param {Point} position The position.
5458
+ * @returns {Point3D[]} An origin and 2 cosines vectors.
5459
+ */
5460
+ getPlanePoints(position: Point): Point3D[];
4803
5461
  /**
4804
5462
  * Get the current scroll position value.
4805
5463
  *
4806
- * @returns {object} The value.
5464
+ * @returns {number} The value.
4807
5465
  */
4808
- getCurrentScrollPosition(): object;
5466
+ getCurrentScrollPosition(): number;
4809
5467
  /**
4810
5468
  * Generate display image data to be given to a canvas.
4811
5469
  *
@@ -4865,7 +5523,7 @@ export declare class ViewController {
4865
5523
  * Can window and level be applied to the data?
4866
5524
  *
4867
5525
  * @returns {boolean} True if possible.
4868
- * @deprecated Please use isMonochrome instead.
5526
+ * @deprecated Since v0.33, please use isMonochrome instead.
4869
5527
  */
4870
5528
  canWindowLevel(): boolean;
4871
5529
  /**
@@ -4935,9 +5593,11 @@ export declare class ViewController {
4935
5593
  * Get a world position from a 2D plane position.
4936
5594
  *
4937
5595
  * @param {Point2D} point2D The input point.
5596
+ * @param {number} [k] Optional slice index,
5597
+ * if undefined, uses the current one.
4938
5598
  * @returns {Point} The associated position.
4939
5599
  */
4940
- getPositionFromPlanePoint(point2D: Point2D): Point;
5600
+ getPositionFromPlanePoint(point2D: Point2D, k?: number): Point;
4941
5601
  /**
4942
5602
  * Get a 2D plane position from a world position.
4943
5603
  *
@@ -4945,6 +5605,13 @@ export declare class ViewController {
4945
5605
  * @returns {Point2D} The 2D position.
4946
5606
  */
4947
5607
  getPlanePositionFromPosition(point: Point): Point2D;
5608
+ /**
5609
+ * Get the index of a world position.
5610
+ *
5611
+ * @param {Point} point The 3D position.
5612
+ * @returns {Index} The index.
5613
+ */
5614
+ getIndexFromPosition(point: Point): Index;
4948
5615
  /**
4949
5616
  * Set the current index.
4950
5617
  *