dwv 0.33.0-beta.2 → 0.33.0-beta.4

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
@@ -1,3 +1,5 @@
1
+ import Konva from 'konva';
2
+
1
3
  /**
2
4
  * Add tags to the dictionary.
3
5
  *
@@ -25,10 +27,10 @@ export declare class App {
25
27
  /**
26
28
  * Get the image.
27
29
  *
28
- * @param {number} index The data index.
30
+ * @param {string} dataId The data id.
29
31
  * @returns {Image} The associated image.
30
32
  */
31
- getImage(index: number): Image_2;
33
+ getImage(dataId: string): Image_2;
32
34
  /**
33
35
  * Get the last loaded image.
34
36
  *
@@ -36,12 +38,12 @@ export declare class App {
36
38
  */
37
39
  getLastImage(): Image_2;
38
40
  /**
39
- * Set the image at the given index.
41
+ * Set the image at the given id.
40
42
  *
41
- * @param {number} index The data index.
43
+ * @param {string} dataId The data id.
42
44
  * @param {Image} img The associated image.
43
45
  */
44
- setImage(index: number, img: Image_2): void;
46
+ setImage(dataId: string, img: Image_2): void;
45
47
  /**
46
48
  * Set the last image.
47
49
  *
@@ -53,16 +55,16 @@ export declare class App {
53
55
  *
54
56
  * @param {Image} image The new image.
55
57
  * @param {object} meta The image meta.
56
- * @returns {number} The new image id.
58
+ * @returns {string} The new image data id.
57
59
  */
58
- addNewImage(image: Image_2, meta: object): number;
60
+ addNewImage(image: Image_2, meta: object): string;
59
61
  /**
60
62
  * Get the meta data.
61
63
  *
62
- * @param {number} index The data index.
64
+ * @param {string} dataId The data id.
63
65
  * @returns {object} The list of meta data.
64
66
  */
65
- getMetaData(index: number): object;
67
+ getMetaData(dataId: string): object;
66
68
  /**
67
69
  * Get the list of ids in the data storage.
68
70
  *
@@ -113,21 +115,21 @@ export declare class App {
113
115
  */
114
116
  getActiveLayerGroup(): LayerGroup;
115
117
  /**
116
- * Get the view layers associated to a data index.
118
+ * Get the view layers associated to a data id.
117
119
  * The layer are available after the first loaded item.
118
120
  *
119
- * @param {number} index The data index.
121
+ * @param {string} dataId The data id.
120
122
  * @returns {Array} The layers.
121
123
  */
122
- getViewLayersByDataIndex(index: number): any[];
124
+ getViewLayersByDataId(dataId: string): any[];
123
125
  /**
124
- * Get the draw layers associated to a data index.
126
+ * Get the draw layers associated to a data id.
125
127
  * The layer are available after the first loaded item.
126
128
  *
127
- * @param {number} index The data index.
129
+ * @param {string} dataId The data id.
128
130
  * @returns {Array} The layers.
129
131
  */
130
- getDrawLayersByDataIndex(index: number): any[];
132
+ getDrawLayersByDataId(dataId: string): any[];
131
133
  /**
132
134
  * Get a layer group by div id.
133
135
  * The layer is available after the first loaded item.
@@ -159,7 +161,7 @@ export declare class App {
159
161
  * Initialise the application.
160
162
  *
161
163
  * @param {object} opt The application option with:
162
- * - `dataViewConfigs`: data indexed object containing the data view
164
+ * - `dataViewConfigs`: dataId indexed object containing the data view
163
165
  * configurations in the form of a list of objects containing:
164
166
  * - divId: the HTML div id
165
167
  * - orientation: optional 'axial', 'coronal' or 'sagittal' orientation
@@ -286,6 +288,12 @@ export declare class App {
286
288
  * Init the Window/Level display
287
289
  */
288
290
  initWLDisplay(): void;
291
+ /**
292
+ * Set the imageSmoothing flag value. Default is false.
293
+ *
294
+ * @param {boolean} flag True to enable smoothing.
295
+ */
296
+ setImageSmoothing(flag: boolean): void;
289
297
  /**
290
298
  * Get the data view config.
291
299
  * Carefull, returns a reference, do not modify without resetting.
@@ -302,25 +310,25 @@ export declare class App {
302
310
  /**
303
311
  * Add a data view config.
304
312
  *
305
- * @param {number} dataId The data id.
313
+ * @param {string} dataId The data id.
306
314
  * @param {object} config The view configuration.
307
315
  */
308
- addDataViewConfig(dataId: number, config: object): void;
316
+ addDataViewConfig(dataId: string, config: object): void;
309
317
  /**
310
318
  * Remove a data view config.
311
319
  *
312
- * @param {number} dataId The data id.
320
+ * @param {string} dataId The data id.
313
321
  * @param {object} config The view configuration.
314
322
  */
315
- removeDataViewConfig(dataId: number, config: object): void;
323
+ removeDataViewConfig(dataId: string, config: object): void;
316
324
  /**
317
325
  * Update a data view config.
318
326
  *
319
- * @param {number} dataId The data id.
327
+ * @param {string} dataId The data id.
320
328
  * @param {string} divId The div id.
321
329
  * @param {object} config The view configuration.
322
330
  */
323
- updateDataViewConfig(dataId: number, divId: string, config: object): void;
331
+ updateDataViewConfig(dataId: string, divId: string, config: object): void;
324
332
  /**
325
333
  * Set the layer groups binders.
326
334
  *
@@ -330,10 +338,10 @@ export declare class App {
330
338
  /**
331
339
  * Render the current data.
332
340
  *
333
- * @param {number} dataIndex The data index to render.
341
+ * @param {string} dataId The data id to render.
334
342
  * @param {Array} [viewConfigs] The list of configs to render.
335
343
  */
336
- render(dataIndex: number, viewConfigs?: any[]): void;
344
+ render(dataId: string, viewConfigs?: any[]): void;
337
345
  /**
338
346
  * Zoom to the layers.
339
347
  *
@@ -458,18 +466,18 @@ export declare class App {
458
466
  */
459
467
  getCurrentStackIndex(): number;
460
468
  /**
461
- * Get the overlay data for a data index.
469
+ * Get the overlay data for a data id.
462
470
  *
463
- * @param {number} dataIndex The data index.
464
- * @returns {OverlayData} The overlay data.
471
+ * @param {string} dataId The data id.
472
+ * @returns {OverlayData|undefined} The overlay data.
465
473
  */
466
- getOverlayData(dataIndex: number): OverlayData;
474
+ getOverlayData(dataId: string): OverlayData | undefined;
467
475
  /**
468
476
  * Toggle overlay listeners.
469
477
  *
470
- * @param {number} dataIndex The data index.
478
+ * @param {string} dataId The data id.
471
479
  */
472
- toggleOverlayListeners(dataIndex: number): void;
480
+ toggleOverlayListeners(dataId: string): void;
473
481
  #private;
474
482
  }
475
483
 
@@ -668,23 +676,23 @@ export declare class DrawLayer {
668
676
  */
669
677
  constructor(containerDiv: HTMLDivElement);
670
678
  /**
671
- * Get the associated data index.
679
+ * Get the associated data id.
672
680
  *
673
- * @returns {number} The index.
681
+ * @returns {string} The id.
674
682
  */
675
- getDataIndex(): number;
683
+ getDataId(): string;
676
684
  /**
677
685
  * Get the Konva stage.
678
686
  *
679
- * @returns {object} The stage.
687
+ * @returns {Konva.Stage} The stage.
680
688
  */
681
- getKonvaStage(): object;
689
+ getKonvaStage(): Konva.Stage;
682
690
  /**
683
691
  * Get the Konva layer.
684
692
  *
685
- * @returns {object} The layer.
693
+ * @returns {Konva.Layer} The layer.
686
694
  */
687
- getKonvaLayer(): object;
695
+ getKonvaLayer(): Konva.Layer;
688
696
  /**
689
697
  * Get the draw controller.
690
698
  *
@@ -772,9 +780,9 @@ export declare class DrawLayer {
772
780
  *
773
781
  * @param {object} size The image size as {x,y}.
774
782
  * @param {object} spacing The image spacing as {x,y}.
775
- * @param {number} index The associated data index.
783
+ * @param {string} dataId The associated data id.
776
784
  */
777
- initialise(size: object, spacing: object, index: number): void;
785
+ initialise(size: object, spacing: object, dataId: string): void;
778
786
  /**
779
787
  * Fit the layer to its parent container.
780
788
  *
@@ -1619,6 +1627,12 @@ export declare class LayerGroup {
1619
1627
  * @param {boolean} flag True to display the crosshair.
1620
1628
  */
1621
1629
  setShowCrosshair(flag: boolean): void;
1630
+ /**
1631
+ * Set the imageSmoothing flag value.
1632
+ *
1633
+ * @param {boolean} flag True to enable smoothing.
1634
+ */
1635
+ setImageSmoothing(flag: boolean): void;
1622
1636
  /**
1623
1637
  * Get the Id of the container div.
1624
1638
  *
@@ -1658,16 +1672,16 @@ export declare class LayerGroup {
1658
1672
  /**
1659
1673
  * Get the active image layer.
1660
1674
  *
1661
- * @returns {ViewLayer} The layer.
1675
+ * @returns {ViewLayer|undefined} The layer.
1662
1676
  */
1663
- getActiveViewLayer(): ViewLayer;
1677
+ getActiveViewLayer(): ViewLayer | undefined;
1664
1678
  /**
1665
- * Get the view layers associated to a data index.
1679
+ * Get the view layers associated to a data id.
1666
1680
  *
1667
- * @param {number} index The data index.
1681
+ * @param {string} dataId The data id.
1668
1682
  * @returns {ViewLayer[]} The layers.
1669
1683
  */
1670
- getViewLayersByDataIndex(index: number): ViewLayer[];
1684
+ getViewLayersByDataId(dataId: string): ViewLayer[];
1671
1685
  /**
1672
1686
  * Search view layers for equal imae meta data.
1673
1687
  *
@@ -1684,16 +1698,16 @@ export declare class LayerGroup {
1684
1698
  /**
1685
1699
  * Get the active draw layer.
1686
1700
  *
1687
- * @returns {DrawLayer} The layer.
1701
+ * @returns {DrawLayer|undefined} The layer.
1688
1702
  */
1689
- getActiveDrawLayer(): DrawLayer;
1703
+ getActiveDrawLayer(): DrawLayer | undefined;
1690
1704
  /**
1691
- * Get the draw layers associated to a data index.
1705
+ * Get the draw layers associated to a data id.
1692
1706
  *
1693
- * @param {number} index The data index.
1707
+ * @param {string} dataId The data id.
1694
1708
  * @returns {DrawLayer[]} The layers.
1695
1709
  */
1696
- getDrawLayersByDataIndex(index: number): DrawLayer[];
1710
+ getDrawLayersByDataId(dataId: string): DrawLayer[];
1697
1711
  /**
1698
1712
  * Set the active view layer.
1699
1713
  *
@@ -1701,11 +1715,11 @@ export declare class LayerGroup {
1701
1715
  */
1702
1716
  setActiveViewLayer(index: number): void;
1703
1717
  /**
1704
- * Set the active view layer with a data index.
1718
+ * Set the active view layer with a data id.
1705
1719
  *
1706
- * @param {number} index The data index.
1720
+ * @param {string} dataId The data id.
1707
1721
  */
1708
- setActiveViewLayerByDataIndex(index: number): void;
1722
+ setActiveViewLayerByDataId(dataId: string): void;
1709
1723
  /**
1710
1724
  * Set the active draw layer.
1711
1725
  *
@@ -1713,11 +1727,11 @@ export declare class LayerGroup {
1713
1727
  */
1714
1728
  setActiveDrawLayer(index: number): void;
1715
1729
  /**
1716
- * Set the active draw layer with a data index.
1730
+ * Set the active draw layer with a data id.
1717
1731
  *
1718
- * @param {number} index The data index.
1732
+ * @param {string} dataId The data id.
1719
1733
  */
1720
- setActiveDrawLayerByDataIndex(index: number): void;
1734
+ setActiveDrawLayerByDataId(dataId: string): void;
1721
1735
  /**
1722
1736
  * Add a view layer.
1723
1737
  *
@@ -1736,6 +1750,9 @@ export declare class LayerGroup {
1736
1750
  empty(): void;
1737
1751
  /**
1738
1752
  * Remove a layer from this layer group.
1753
+ * Warning: if current active layer, the index will
1754
+ * be set to `undefined`. Call one of the setActive
1755
+ * methods to define the active index.
1739
1756
  *
1740
1757
  * @param {ViewLayer | DrawLayer} layer The layer to remove.
1741
1758
  */
@@ -1972,10 +1989,10 @@ export declare class Matrix33 {
1972
1989
  export declare class OverlayData {
1973
1990
  /**
1974
1991
  * @param {App} app The associated application.
1975
- * @param {number} dataId The associated data ID.
1992
+ * @param {string} dataId The associated data id.
1976
1993
  * @param {object} configs The overlay config.
1977
1994
  */
1978
- constructor(app: App, dataId: number, configs: object);
1995
+ constructor(app: App, dataId: string, configs: object);
1979
1996
  /**
1980
1997
  * Reset the data.
1981
1998
  */
@@ -2940,9 +2957,9 @@ export declare class View {
2940
2957
  export declare class ViewController {
2941
2958
  /**
2942
2959
  * @param {View} view The associated view.
2943
- * @param {number} index The associated data index.
2960
+ * @param {string} dataId The associated data id.
2944
2961
  */
2945
- constructor(view: View, index: number);
2962
+ constructor(view: View, dataId: string);
2946
2963
  /**
2947
2964
  * Get the plane helper.
2948
2965
  *
@@ -3069,9 +3086,9 @@ export declare class ViewController {
3069
3086
  * Set the associated image.
3070
3087
  *
3071
3088
  * @param {Image} img The associated image.
3072
- * @param {number} index The data index of the image.
3089
+ * @param {string} dataId The data id of the image.
3073
3090
  */
3074
- setImage(img: Image_2, index: number): void;
3091
+ setImage(img: Image_2, dataId: string): void;
3075
3092
  /**
3076
3093
  * Get the current spacing.
3077
3094
  *
@@ -3321,24 +3338,24 @@ export declare class ViewLayer {
3321
3338
  */
3322
3339
  constructor(containerDiv: HTMLElement);
3323
3340
  /**
3324
- * Get the associated data index.
3341
+ * Get the associated data id.
3325
3342
  *
3326
- * @returns {number} The index.
3343
+ * @returns {string} The data id.
3327
3344
  */
3328
- getDataIndex(): number;
3345
+ getDataId(): string;
3329
3346
  /**
3330
- * Set the imageSmoothingEnabled flag value.
3347
+ * Set the imageSmoothing flag value.
3331
3348
  *
3332
3349
  * @param {boolean} flag True to enable smoothing.
3333
3350
  */
3334
- enableImageSmoothing(flag: boolean): void;
3351
+ setImageSmoothing(flag: boolean): void;
3335
3352
  /**
3336
3353
  * Set the associated view.
3337
3354
  *
3338
3355
  * @param {object} view The view.
3339
- * @param {number} index The associated data index.
3356
+ * @param {string} dataId The associated data id.
3340
3357
  */
3341
- setView(view: object, index: number): void;
3358
+ setView(view: object, dataId: string): void;
3342
3359
  /**
3343
3360
  * Get the view controller.
3344
3361
  *