dwv 0.32.1 → 0.33.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/dwv.d.ts CHANGED
@@ -172,6 +172,7 @@ export declare class App {
172
172
  * after the first loaded data or not
173
173
  * - `defaultCharacterSet`: the default chraracter set string used for DICOM
174
174
  * parsing
175
+ * - `overlayConfig`: list of tags / properties used as overlay information.
175
176
  * @example
176
177
  * // create the dwv app
177
178
  * const app = new dwv.App();
@@ -298,6 +299,20 @@ export declare class App {
298
299
  * @param {object} configs The configuration list.
299
300
  */
300
301
  setDataViewConfig(configs: object): void;
302
+ /**
303
+ * Add a data view config.
304
+ *
305
+ * @param {number} dataId The data id.
306
+ * @param {object} config The view configuration.
307
+ */
308
+ addDataViewConfig(dataId: number, config: object): void;
309
+ /**
310
+ * Remove a data view config.
311
+ *
312
+ * @param {number} dataId The data id.
313
+ * @param {object} config The view configuration.
314
+ */
315
+ removeDataViewConfig(dataId: number, config: object): void;
301
316
  /**
302
317
  * Set the layer groups binders.
303
318
  *
@@ -433,6 +448,19 @@ export declare class App {
433
448
  * @returns {number} The stack index.
434
449
  */
435
450
  getCurrentStackIndex(): number;
451
+ /**
452
+ * Get the overlay data for a data index.
453
+ *
454
+ * @param {number} dataIndex The data index.
455
+ * @returns {OverlayData} The overlay data.
456
+ */
457
+ getOverlayData(dataIndex: number): OverlayData;
458
+ /**
459
+ * Toggle overlay listeners.
460
+ *
461
+ * @param {number} dataIndex The data index.
462
+ */
463
+ toggleOverlayListeners(dataIndex: number): void;
436
464
  #private;
437
465
  }
438
466
 
@@ -507,6 +535,14 @@ export declare const defaultPresets: {
507
535
  };
508
536
  };
509
537
 
538
+ export declare namespace defaults {
539
+ let labelText: {
540
+ [x: string]: {
541
+ [x: string]: string;
542
+ };
543
+ };
544
+ }
545
+
510
546
  /**
511
547
  * DicomParser class.
512
548
  *
@@ -1082,7 +1118,7 @@ export declare namespace i18n {
1082
1118
  * const dicomParser = new dwv.DicomParser();
1083
1119
  * dicomParser.parse(event.target.response);
1084
1120
  * // create the image object
1085
- * const image = createImage(dicomParser.getDicomElements());
1121
+ * const image = dwv.createImage(dicomParser.getDicomElements());
1086
1122
  * // result div
1087
1123
  * const div = document.getElementById('dwv');
1088
1124
  * // display the image size
@@ -1165,16 +1201,17 @@ declare class Image_2 {
1165
1201
  * Get the rescale slope and intercept.
1166
1202
  *
1167
1203
  * @param {Index} [index] The index (only needed for non constant rsi).
1168
- * @returns {object} The rescale slope and intercept.
1204
+ * @returns {RescaleSlopeAndIntercept} The rescale slope and intercept.
1169
1205
  */
1170
- getRescaleSlopeAndIntercept(index?: Index): object;
1206
+ getRescaleSlopeAndIntercept(index?: Index): RescaleSlopeAndIntercept;
1171
1207
  /**
1172
1208
  * Set the rescale slope and intercept.
1173
1209
  *
1174
- * @param {object} inRsi The input rescale slope and intercept.
1210
+ * @param {RescaleSlopeAndIntercept} inRsi The input rescale
1211
+ * slope and intercept.
1175
1212
  * @param {number} [offset] The rsi offset (only needed for non constant rsi).
1176
1213
  */
1177
- setRescaleSlopeAndIntercept(inRsi: object, offset?: number): void;
1214
+ setRescaleSlopeAndIntercept(inRsi: RescaleSlopeAndIntercept, offset?: number): void;
1178
1215
  /**
1179
1216
  * Are all the RSIs identity (1,0).
1180
1217
  *
@@ -1688,6 +1725,12 @@ export declare class LayerGroup {
1688
1725
  * Empty the layer list.
1689
1726
  */
1690
1727
  empty(): void;
1728
+ /**
1729
+ * Remove a layer from this layer group.
1730
+ *
1731
+ * @param {ViewLayer | DrawLayer} layer The layer to remove.
1732
+ */
1733
+ removeLayer(layer: ViewLayer | DrawLayer): void;
1691
1734
  /**
1692
1735
  * Update layers (but not the active view layer) to a position change.
1693
1736
  *
@@ -1779,13 +1822,13 @@ export declare class LayerGroup {
1779
1822
 
1780
1823
  export declare namespace logger {
1781
1824
  export namespace levels {
1782
- const TRACE: number;
1783
- const DEBUG: number;
1784
- const INFO: number;
1785
- const WARN: number;
1786
- const ERROR: number;
1825
+ let TRACE: number;
1826
+ let DEBUG: number;
1827
+ let INFO: number;
1828
+ let WARN: number;
1829
+ let ERROR: number;
1787
1830
  }
1788
- const level: number;
1831
+ let level: number;
1789
1832
  export function trace(msg: string): void;
1790
1833
  export function debug(msg: string): void;
1791
1834
  export function info(msg: string): void;
@@ -1914,6 +1957,59 @@ export declare class Matrix33 {
1914
1957
  #private;
1915
1958
  }
1916
1959
 
1960
+ /**
1961
+ * DICOM Header overlay info.
1962
+ */
1963
+ export declare class OverlayData {
1964
+ /**
1965
+ * @param {App} app The associated application.
1966
+ * @param {number} dataId The associated data ID.
1967
+ * @param {object} configs The overlay config.
1968
+ */
1969
+ constructor(app: App, dataId: number, configs: object);
1970
+ /**
1971
+ * Reset the data.
1972
+ */
1973
+ reset(): void;
1974
+ /**
1975
+ * Handle a new loaded item event.
1976
+ *
1977
+ * @param {object} data The item meta data.
1978
+ */
1979
+ addItemMeta(data: object): void;
1980
+ /**
1981
+ * Is this class listening to app events.
1982
+ *
1983
+ * @returns {boolean} True is listening to app events.
1984
+ */
1985
+ isListening(): boolean;
1986
+ /**
1987
+ * Toggle info listeners.
1988
+ */
1989
+ addAppListeners(): void;
1990
+ /**
1991
+ * Toggle info listeners.
1992
+ */
1993
+ removeAppListeners(): void;
1994
+ /**
1995
+ * Add an event listener to this class.
1996
+ *
1997
+ * @param {string} type The event type.
1998
+ * @param {object} callback The method associated with the provided
1999
+ * event type, will be called with the fired event.
2000
+ */
2001
+ addEventListener(type: string, callback: object): void;
2002
+ /**
2003
+ * Remove an event listener from this class.
2004
+ *
2005
+ * @param {string} type The event type.
2006
+ * @param {object} callback The method associated with the provided
2007
+ * event type.
2008
+ */
2009
+ removeEventListener(type: string, callback: object): void;
2010
+ #private;
2011
+ }
2012
+
1917
2013
  /**
1918
2014
  * Immutable point.
1919
2015
  * Warning: the input array is NOT cloned, modifying it will
@@ -2139,17 +2235,6 @@ export declare class RescaleLut {
2139
2235
  * @returns {RescaleSlopeAndIntercept} The rescale slope and intercept object.
2140
2236
  */
2141
2237
  getRSI(): RescaleSlopeAndIntercept;
2142
- /**
2143
- * Is the lut ready to use or not? If not, the user must
2144
- * call 'initialise'.
2145
- *
2146
- * @returns {boolean} True if the lut is ready to use.
2147
- */
2148
- isReady(): boolean;
2149
- /**
2150
- * Initialise the LUT.
2151
- */
2152
- initialise(): void;
2153
2238
  /**
2154
2239
  * Get the length of the LUT array.
2155
2240
  *
@@ -2159,7 +2244,8 @@ export declare class RescaleLut {
2159
2244
  /**
2160
2245
  * Get the value of the LUT at the given offset.
2161
2246
  *
2162
- * @param {number} offset The input offset in [0,2^bitsStored] range.
2247
+ * @param {number} offset The input offset in [0,2^bitsStored] range
2248
+ * or full range for ID rescale.
2163
2249
  * @returns {number} The float32 value of the LUT at the given offset.
2164
2250
  */
2165
2251
  getValue(offset: number): number;
@@ -2201,12 +2287,6 @@ export declare class RescaleSlopeAndIntercept {
2201
2287
  * @returns {boolean} True if both RSI are equal.
2202
2288
  */
2203
2289
  equals(rhs: RescaleSlopeAndIntercept): boolean;
2204
- /**
2205
- * Get a string representation of the RSI.
2206
- *
2207
- * @returns {string} The RSI as a string.
2208
- */
2209
- toString(): string;
2210
2290
  /**
2211
2291
  * Is this RSI an ID RSI.
2212
2292
  *
@@ -2648,18 +2728,10 @@ export declare class View {
2648
2728
  * Get the window LUT of the image.
2649
2729
  * Warning: can be undefined in no window/level was set.
2650
2730
  *
2651
- * @param {object} [rsi] Optional image rsi, will take the one of the
2652
- * current slice otherwise.
2653
2731
  * @returns {WindowLut} The window LUT of the image.
2654
2732
  * @fires View#wlchange
2655
2733
  */
2656
- getCurrentWindowLut(rsi?: object): WindowLut;
2657
- /**
2658
- * Add the window LUT to the list.
2659
- *
2660
- * @param {WindowLut} wlut The window LUT of the image.
2661
- */
2662
- addWindowLut(wlut: WindowLut): void;
2734
+ getCurrentWindowLut(): WindowLut;
2663
2735
  /**
2664
2736
  * Get the window presets.
2665
2737
  *
@@ -2690,6 +2762,12 @@ export declare class View {
2690
2762
  * @param {object} presets The window presets.
2691
2763
  */
2692
2764
  addWindowPresets(presets: object): void;
2765
+ /**
2766
+ * Get the current window level preset name.
2767
+ *
2768
+ * @returns {string} The preset name.
2769
+ */
2770
+ getCurrentWindowPresetName(): string;
2693
2771
  /**
2694
2772
  * Get the colour map of the image.
2695
2773
  *
@@ -2890,6 +2968,12 @@ export declare class ViewController {
2890
2968
  * Initialise the controller.
2891
2969
  */
2892
2970
  initialise(): void;
2971
+ /**
2972
+ * Get the image modality.
2973
+ *
2974
+ * @returns {string} The modality.
2975
+ */
2976
+ getModality(): string;
2893
2977
  /**
2894
2978
  * Get the window/level presets names.
2895
2979
  *
@@ -3156,6 +3240,12 @@ export declare class ViewController {
3156
3240
  * @returns {object} The window center and width.
3157
3241
  */
3158
3242
  getWindowLevel(): object;
3243
+ /**
3244
+ * Get the current window level preset name.
3245
+ *
3246
+ * @returns {string} The preset name.
3247
+ */
3248
+ getCurrentWindowPresetName(): string;
3159
3249
  /**
3160
3250
  * Set the window/level.
3161
3251
  *
@@ -3467,13 +3557,6 @@ export declare class WindowCenterAndWidth {
3467
3557
  * @returns {number} The window width.
3468
3558
  */
3469
3559
  getWidth(): number;
3470
- /**
3471
- * Set the output value range.
3472
- *
3473
- * @param {string} min The output value minimum.
3474
- * @param {string} max The output value maximum.
3475
- */
3476
- setRange(min: string, max: string): void;
3477
3560
  /**
3478
3561
  * Set the signed offset.
3479
3562
  *
@@ -3496,12 +3579,6 @@ export declare class WindowCenterAndWidth {
3496
3579
  * @returns {boolean} True if both window level are equal.
3497
3580
  */
3498
3581
  equals(rhs: WindowCenterAndWidth): boolean;
3499
- /**
3500
- * Get a string representation of the window level.
3501
- *
3502
- * @returns {string} The window level as a string.
3503
- */
3504
- toString(): string;
3505
3582
  #private;
3506
3583
  }
3507
3584
 
@@ -3511,55 +3588,37 @@ export declare class WindowCenterAndWidth {
3511
3588
  */
3512
3589
  export declare class WindowLut {
3513
3590
  /**
3591
+ * Construct a window LUT object, window level is set with
3592
+ * the 'setWindowLevel' method.
3593
+ *
3514
3594
  * @param {RescaleLut} rescaleLut The associated rescale LUT.
3515
3595
  * @param {boolean} isSigned Flag to know if the data is signed or not.
3596
+ * @param {boolean} isDiscrete Flag to know if the input data is discrete.
3516
3597
  */
3517
- constructor(rescaleLut: RescaleLut, isSigned: boolean);
3598
+ constructor(rescaleLut: RescaleLut, isSigned: boolean, isDiscrete: boolean);
3518
3599
  /**
3519
3600
  * Get the window / level.
3520
3601
  *
3521
3602
  * @returns {WindowCenterAndWidth} The window / level.
3522
3603
  */
3523
3604
  getWindowLevel(): WindowCenterAndWidth;
3524
- /**
3525
- * Get the signed flag.
3526
- *
3527
- * @returns {boolean} The signed flag.
3528
- */
3529
- isSigned(): boolean;
3530
3605
  /**
3531
3606
  * Get the rescale lut.
3532
3607
  *
3533
3608
  * @returns {RescaleLut} The rescale lut.
3534
3609
  */
3535
3610
  getRescaleLut(): RescaleLut;
3536
- /**
3537
- * Is the lut ready to use or not? If not, the user must
3538
- * call 'update'.
3539
- *
3540
- * @returns {boolean} True if the lut is ready to use.
3541
- */
3542
- isReady(): boolean;
3543
3611
  /**
3544
3612
  * Set the window center and width.
3545
3613
  *
3546
3614
  * @param {WindowCenterAndWidth} wl The window level.
3547
3615
  */
3548
3616
  setWindowLevel(wl: WindowCenterAndWidth): void;
3549
- /**
3550
- * Update the lut if needed..
3551
- */
3552
- update(): void;
3553
- /**
3554
- * Get the length of the LUT array.
3555
- *
3556
- * @returns {number} The length of the LUT array.
3557
- */
3558
- getLength(): number;
3559
3617
  /**
3560
3618
  * Get the value of the LUT at the given offset.
3561
3619
  *
3562
- * @param {number} offset The input offset in [0,2^bitsStored] range.
3620
+ * @param {number} offset The input offset in [0,2^bitsStored] range
3621
+ * for discrete data or full range for non discrete.
3563
3622
  * @returns {number} The integer value (default [0,255]) of the LUT
3564
3623
  * at the given offset.
3565
3624
  */